API16:JDatabaseQuery/ toString
From Joomla! Documentation
Contents |
Description
string The completed query
Description:JDatabaseQuery/ toString
Syntax
__toString()
Returns
string The completed query
Defined in
libraries/joomla/database/databasequery.php
Importing
jimport( 'joomla.database.databasequery' );
Source Body
public function __toString() { $query = ''; switch ($this->_type) { case 'select': $query .= (string) $this->_select; $query .= (string) $this->_from; if ($this->_join) { // special case for joins foreach ($this->_join as $join) { $query .= (string) $join; } } if ($this->_where) { $query .= (string) $this->_where; } if ($this->_group) { $query .= (string) $this->_group; } if ($this->_having) { $query .= (string) $this->_having; } if ($this->_order) { $query .= (string) $this->_order; } break; case 'delete': $query .= (string) $this->_delete; $query .= (string) $this->_from; if ($this->_where) { $query .= (string) $this->_where; } break; case 'update': $query .= (string) $this->_update; $query .= (string) $this->_set; if ($this->_where) { $query .= (string) $this->_where; } break; case 'insert': $query .= (string) $this->_insert; $query .= (string) $this->_set; if ($this->_where) { $query .= (string) $this->_where; } break; } return $query; }
[Edit See Also] SeeAlso:JDatabaseQuery/ toString