API15

JInstaller/parseQueries

From Joomla! Documentation

< API15:JInstaller
Revision as of 17:23, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Backward compatible Method to parse through a queries element of the installation manifest file and take appropriate action. <span class="editsection" style="font-size...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Backward compatible Method to parse through a queries element of the installation manifest file and take appropriate action.

[Edit Descripton]

Template:Description:JInstaller/parseQueries

Syntax[edit]

parseQueries($element)
Parameter Name Default Value Description
$element $element The xml node to process

Returns[edit]

mixed Number of queries processed or False on error

Defined in[edit]

libraries/joomla/installer/installer.php

Importing[edit]

jimport( 'joomla.installer.installer' );

Source Body[edit]

function parseQueries($element)
{
        // Get the database connector object
        $db = & $this->_db;

        if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) {
                // Either the tag does not exist or has no children therefore we return zero files processed.
                return 0;
        }

        // Get the array of query nodes to process
        $queries = $element->children();
        if (count($queries) == 0) {
                // No queries to process
                return 0;
        }

        // Process each query in the $queries array (children of $tagName).
        foreach ($queries as $query)
        {
                $db->setQuery($query->data());
                if (!$db->query()) {
                        JError::raiseWarning(1, 'JInstaller::install: '.JText::_('SQL Error')." ".$db->stderr(true));
                        return false;
                }
        }
        return (int) count($queries);
}

[Edit See Also] Template:SeeAlso:JInstaller/parseQueries

Examples[edit]

<CodeExamplesForm />