API16

JInstaller/parseQueries: Difference between revisions

From Joomla! Documentation

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...
 
m preparing for archive only
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
Backward compatible Method to parse through a queries element of the installation manifest file and take appropriate action.
Backward compatible Method to parse through a queries element of the installation manifest file and take appropriate action.


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JInstaller/parseQueries|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JInstaller/parseQueries}}
 
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 65: Line 63:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JInstaller/parseQueries|Edit See Also]]<nowiki>]</nowiki>
<! removed transcluded page call, red link never existed >
</span>
{{SeeAlso:JInstaller/parseQueries}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=parseQueries
  category=parseQueries
  category=JInstaller
  category=JInstaller
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API16]]

Latest revision as of 01:48, 25 March 2017

Description

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


<! removed transcluded page call, red link never existed >

Syntax

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

Returns

mixed Number of queries processed or False on error

Defined in

libraries/joomla/installer/installer.php

Importing

jimport( 'joomla.installer.installer' );

Source Body

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

        if (!($element instanceof JXMLElement) || ! 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);
}


<! removed transcluded page call, red link never existed >

Examples

Code Examples