Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes
Zend_Db_Select Class Reference
Inheritance diagram for Zend_Db_Select:
Select Zend_Db_Table_Select

Public Member Functions

 __construct (Zend_Db_Adapter_Abstract $adapter)
 
 getBind ()
 
 bind ($bind)
 
 distinct ($flag=true)
 
 from ($name, $cols=' *', $schema=null)
 
 columns ($cols=' *', $correlationName=null)
 
 union ($select=array(), $type=self::SQL_UNION)
 
 join ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 
 joinInner ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 
 joinLeft ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 
 joinRight ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 
 joinFull ($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
 
 joinCross ($name, $cols=self::SQL_WILDCARD, $schema=null)
 
 joinNatural ($name, $cols=self::SQL_WILDCARD, $schema=null)
 
 where ($cond, $value=null, $type=null)
 
 orWhere ($cond, $value=null, $type=null)
 
 group ($spec)
 
 having ($cond, $value=null, $type=null)
 
 orHaving ($cond, $value=null, $type=null)
 
 order ($spec)
 
 limit ($count=null, $offset=null)
 
 limitPage ($page, $rowCount)
 
 forUpdate ($flag=true)
 
 getPart ($part)
 
 query ($fetchMode=null, $bind=array())
 
 assemble ()
 
 reset ($part=null)
 
 getAdapter ()
 
 _joinUsing ($type, $name, $cond, $cols=' *', $schema=null)
 
 __call ($method, array $args)
 
 __toString ()
 

Data Fields

const DISTINCT = 'distinct'
 
const COLUMNS = 'columns'
 
const FROM = 'from'
 
const UNION = 'union'
 
const WHERE = 'where'
 
const GROUP = 'group'
 
const HAVING = 'having'
 
const ORDER = 'order'
 
const LIMIT_COUNT = 'limitcount'
 
const LIMIT_OFFSET = 'limitoffset'
 
const FOR_UPDATE = 'forupdate'
 
const INNER_JOIN = 'inner join'
 
const LEFT_JOIN = 'left join'
 
const RIGHT_JOIN = 'right join'
 
const FULL_JOIN = 'full join'
 
const CROSS_JOIN = 'cross join'
 
const NATURAL_JOIN = 'natural join'
 
const SQL_WILDCARD = '*'
 
const SQL_SELECT = 'SELECT'
 
const SQL_UNION = 'UNION'
 
const SQL_UNION_ALL = 'UNION ALL'
 
const SQL_FROM = 'FROM'
 
const SQL_WHERE = 'WHERE'
 
const SQL_DISTINCT = 'DISTINCT'
 
const SQL_GROUP_BY = 'GROUP BY'
 
const SQL_ORDER_BY = 'ORDER BY'
 
const SQL_HAVING = 'HAVING'
 
const SQL_FOR_UPDATE = 'FOR UPDATE'
 
const SQL_AND = 'AND'
 
const SQL_AS = 'AS'
 
const SQL_OR = 'OR'
 
const SQL_ON = 'ON'
 
const SQL_ASC = 'ASC'
 
const SQL_DESC = 'DESC'
 
const REGEX_COLUMN_EXPR = '/^([\w]*\s*\(([^\(\)]|(?1))*\))$/'
 
const REGEX_COLUMN_EXPR_ORDER = '/^([\w]+\s*\(([^\(\)]|(?1))*\))$/'
 
const REGEX_COLUMN_EXPR_GROUP = '/^([\w]+\s*\(([^\(\)]|(?1))*\))$/'
 
const REGEX_SQL_COMMENTS
 

Protected Member Functions

 _join ($type, $name, $cond, $cols, $schema=null)
 
 _tableCols ($correlationName, $cols, $afterCorrelationName=null)
 
 _where ($condition, $value=null, $type=null, $bool=true)
 
 _getDummyTable ()
 
 _getQuotedSchema ($schema=null)
 
 _getQuotedTable ($tableName, $correlationName=null)
 
 _renderDistinct ($sql)
 
 _renderColumns ($sql)
 
 _renderFrom ($sql)
 
 _renderUnion ($sql)
 
 _renderWhere ($sql)
 
 _renderGroup ($sql)
 
 _renderHaving ($sql)
 
 _renderOrder ($sql)
 
 _renderLimitoffset ($sql)
 
 _renderForupdate ($sql)
 

Protected Attributes

 $_bind = array()
 
 $_adapter
 
 $_parts = array()
 
 $_tableCols = array()
 

Static Protected Attributes

static $_partsInit
 
static $_joinTypes
 
static $_unionTypes
 

Detailed Description

Definition at line 44 of file Select.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Zend_Db_Adapter_Abstract  $adapter)

Class constructor

Parameters
Zend_Db_Adapter_Abstract$adapter

Definition at line 184 of file Select.php.

185  {
186  $this->_adapter = $adapter;
187  $this->_parts = self::$_partsInit;
188  }
static $_partsInit
Definition: Select.php:126
$adapter
Definition: webapi_user.php:16

Member Function Documentation

◆ __call()

__call (   $method,
array  $args 
)

Turn magic function calls into non-magic function calls for joinUsing syntax

Parameters
string$method
array$argsOPTIONAL Zend_Db_Table_Select query modifier
Returns
Zend_Db_Select
Exceptions
Zend_Db_Select_ExceptionIf an invalid method is called.

Recognize methods for Has-Many cases: findParent<Class>() findParent<Class>By<Rule>() Use the non-greedy pattern repeat modifier e.g. \w+?

Definition at line 1333 of file Select.php.

1334  {
1335  $matches = array();
1336 
1343  if (preg_match('/^join([a-zA-Z]*?)Using$/', $method, $matches)) {
1344  $type = strtolower($matches[1]);
1345  if ($type) {
1346  $type .= ' join';
1347  if (!in_array($type, self::$_joinTypes)) {
1348  #require_once 'Zend/Db/Select/Exception.php';
1349  throw new Zend_Db_Select_Exception("Unrecognized method '$method()'");
1350  }
1351  if (in_array($type, array(self::CROSS_JOIN, self::NATURAL_JOIN))) {
1352  #require_once 'Zend/Db/Select/Exception.php';
1353  throw new Zend_Db_Select_Exception("Cannot perform a joinUsing with method '$method()'");
1354  }
1355  } else {
1357  }
1358  array_unshift($args, $type);
1359  return call_user_func_array(array($this, '_joinUsing'), $args);
1360  }
1361 
1362  #require_once 'Zend/Db/Select/Exception.php';
1363  throw new Zend_Db_Select_Exception("Unrecognized method '$method()'");
1364  }
$type
Definition: item.phtml:13
const INNER_JOIN
Definition: Select.php:59
$method
Definition: info.phtml:13

◆ __toString()

__toString ( )

Implements magic method.

Returns
string This object as a SELECT string.

Definition at line 1371 of file Select.php.

1372  {
1373  try {
1374  $sql = $this->assemble();
1375  } catch (Exception $e) {
1376  trigger_error($e->getMessage(), E_USER_WARNING);
1377  $sql = '';
1378  }
1379  return (string)$sql;
1380  }

◆ _getDummyTable()

_getDummyTable ( )
protected
Returns
array

Definition at line 1049 of file Select.php.

1050  {
1051  return array();
1052  }

◆ _getQuotedSchema()

_getQuotedSchema (   $schema = null)
protected

Return a quoted schema name

Parameters
string$schemaThe schema name OPTIONAL
Returns
string|null

Definition at line 1060 of file Select.php.

1061  {
1062  if ($schema === null) {
1063  return null;
1064  }
1065  return $this->_adapter->quoteIdentifier($schema, true) . '.';
1066  }

◆ _getQuotedTable()

_getQuotedTable (   $tableName,
  $correlationName = null 
)
protected

Return a quoted table name

Parameters
string$tableNameThe table name
string$correlationNameThe correlation name OPTIONAL
Returns
string

Definition at line 1075 of file Select.php.

1076  {
1077  return $this->_adapter->quoteTableAs($tableName, $correlationName, true);
1078  }
$tableName
Definition: trigger.php:13

◆ _join()

_join (   $type,
  $name,
  $cond,
  $cols,
  $schema = null 
)
protected

Populate the $_parts 'join' key

Does the dirty work of populating the join key.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
null | string$typeType of join; inner, left, and null are currently supported
array | string | Zend_Db_Expr$nameTable name
string$condJoin on this condition
array | string$colsThe columns to select from the joined table
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object
Exceptions
Zend_Db_Select_Exception
See also
Zend_Db_Select_Exception
Zend_Db_Select_Exception

Definition at line 779 of file Select.php.

780  {
781  if (!in_array($type, self::$_joinTypes) && $type != self::FROM) {
785  #require_once 'Zend/Db/Select/Exception.php';
786  throw new Zend_Db_Select_Exception("Invalid join type '$type'");
787  }
788 
789  if (count($this->_parts[self::UNION])) {
790  #require_once 'Zend/Db/Select/Exception.php';
791  throw new Zend_Db_Select_Exception("Invalid use of table with " . self::SQL_UNION);
792  }
793 
794  if (empty($name)) {
795  $correlationName = $tableName = '';
796  } elseif (is_array($name)) {
797  // Must be array($correlationName => $tableName) or array($ident, ...)
798  foreach ($name as $_correlationName => $_tableName) {
799  if (is_string($_correlationName)) {
800  // We assume the key is the correlation name and value is the table name
801  $tableName = $_tableName;
802  $correlationName = $_correlationName;
803  } else {
804  // We assume just an array of identifiers, with no correlation name
805  $tableName = $_tableName;
806  $correlationName = $this->_uniqueCorrelation($tableName);
807  }
808  break;
809  }
810  } elseif ($name instanceof Zend_Db_Expr|| $name instanceof Zend_Db_Select) {
811  $tableName = $name;
812  $correlationName = $this->_uniqueCorrelation('t');
813  } elseif (preg_match('/^(.+)\s+AS\s+(.+)$/i', $name, $m)) {
814  $tableName = $m[1];
815  $correlationName = $m[2];
816  } else {
817  $tableName = $name;
818  $correlationName = $this->_uniqueCorrelation($tableName);
819  }
820 
821  // Schema from table name overrides schema argument
822  if (!is_object($tableName) && false !== strpos($tableName, '.')) {
823  list($schema, $tableName) = explode('.', $tableName);
824  }
825 
826  $lastFromCorrelationName = null;
827  if (!empty($correlationName)) {
828  if (array_key_exists($correlationName, $this->_parts[self::FROM])) {
832  #require_once 'Zend/Db/Select/Exception.php';
833  throw new Zend_Db_Select_Exception("You cannot define a correlation name '$correlationName' more than once");
834  }
835 
836  if ($type == self::FROM) {
837  // append this from after the last from joinType
838  $tmpFromParts = $this->_parts[self::FROM];
839  $this->_parts[self::FROM] = array();
840  // move all the froms onto the stack
841  while ($tmpFromParts) {
842  $currentCorrelationName = key($tmpFromParts);
843  if ($tmpFromParts[$currentCorrelationName]['joinType'] != self::FROM) {
844  break;
845  }
846  $lastFromCorrelationName = $currentCorrelationName;
847  $this->_parts[self::FROM][$currentCorrelationName] = array_shift($tmpFromParts);
848  }
849  } else {
850  $tmpFromParts = array();
851  }
852  $this->_parts[self::FROM][$correlationName] = array(
853  'joinType' => $type,
854  'schema' => $schema,
855  'tableName' => $tableName,
856  'joinCondition' => $cond
857  );
858  while ($tmpFromParts) {
859  $currentCorrelationName = key($tmpFromParts);
860  $this->_parts[self::FROM][$currentCorrelationName] = array_shift($tmpFromParts);
861  }
862  }
863 
864  // add to the columns from this joined table
865  if ($type == self::FROM && $lastFromCorrelationName == null) {
866  $lastFromCorrelationName = true;
867  }
868  $this->_tableCols($correlationName, $cols, $lastFromCorrelationName);
869 
870  return $this;
871  }
$tableName
Definition: trigger.php:13
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
const FROM
Definition: Select.php:49
$type
Definition: item.phtml:13
_tableCols($correlationName, $cols, $afterCorrelationName=null)
Definition: Select.php:950
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ _joinUsing()

_joinUsing (   $type,
  $name,
  $cond,
  $cols = '*',
  $schema = null 
)

Handle JOIN... USING... syntax

This is functionality identical to the existing JOIN methods, however the join condition can be passed as a single column name. This method then completes the ON condition by using the same field for the FROM table and the JOIN table.

$select = $db->select()->from('table1') ->joinUsing('table2', 'column1');

// SELECT * FROM table1 JOIN table2 ON table1.column1 = table2.column2

These joins are called by the developer simply by adding 'Using' to the method name. E.g.

  • joinUsing
  • joinInnerUsing
  • joinFullUsing
  • joinRightUsing
  • joinLeftUsing
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 898 of file Select.php.

899  {
900  if (empty($this->_parts[self::FROM])) {
901  #require_once 'Zend/Db/Select/Exception.php';
902  throw new Zend_Db_Select_Exception("You can only perform a joinUsing after specifying a FROM table");
903  }
904 
905  $join = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true);
906  $from = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true);
907 
908  $joinCond = array();
909  foreach ((array)$cond as $fieldName) {
910  $cond1 = $from . '.' . $fieldName;
911  $cond2 = $join . '.' . $fieldName;
912  $joinCond[] = $cond1 . ' = ' . $cond2;
913  }
914  $cond = implode(' '.self::SQL_AND.' ', $joinCond);
915 
916  return $this->_join($type, $name, $cond, $cols, $schema);
917  }
$type
Definition: item.phtml:13
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ _renderColumns()

_renderColumns (   $sql)
protected

Render DISTINCT clause

Parameters
string$sqlSQL query
Returns
string|null

Definition at line 1101 of file Select.php.

1102  {
1103  if (!count($this->_parts[self::COLUMNS])) {
1104  return null;
1105  }
1106 
1107  $columns = array();
1108  foreach ($this->_parts[self::COLUMNS] as $columnEntry) {
1109  list($correlationName, $column, $alias) = $columnEntry;
1110  if ($column instanceof Zend_Db_Expr) {
1111  $columns[] = $this->_adapter->quoteColumnAs($column, $alias, true);
1112  } else {
1113  if ($column == self::SQL_WILDCARD) {
1114  $column = new Zend_Db_Expr(self::SQL_WILDCARD);
1115  $alias = null;
1116  }
1117  if (empty($correlationName)) {
1118  $columns[] = $this->_adapter->quoteColumnAs($column, $alias, true);
1119  } else {
1120  $columns[] = $this->_adapter->quoteColumnAs(array($correlationName, $column), $alias, true);
1121  }
1122  }
1123  }
1124 
1125  return $sql . ' ' . implode(', ', $columns);
1126  }
$columns
Definition: default.phtml:15
if(!trim($html)) $alias
Definition: details.phtml:20

◆ _renderDistinct()

_renderDistinct (   $sql)
protected

Render DISTINCT clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1086 of file Select.php.

1087  {
1088  if ($this->_parts[self::DISTINCT]) {
1089  $sql .= ' ' . self::SQL_DISTINCT;
1090  }
1091 
1092  return $sql;
1093  }
const SQL_DISTINCT
Definition: Select.php:72

◆ _renderForupdate()

_renderForupdate (   $sql)
protected

Render FOR UPDATE clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1315 of file Select.php.

1316  {
1317  if ($this->_parts[self::FOR_UPDATE]) {
1318  $sql .= ' ' . self::SQL_FOR_UPDATE;
1319  }
1320 
1321  return $sql;
1322  }
const SQL_FOR_UPDATE
Definition: Select.php:76

◆ _renderFrom()

_renderFrom (   $sql)
protected

Render FROM clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1134 of file Select.php.

1135  {
1136  /*
1137  * If no table specified, use RDBMS-dependent solution
1138  * for table-less query. e.g. DUAL in Oracle.
1139  */
1140  if (empty($this->_parts[self::FROM])) {
1141  $this->_parts[self::FROM] = $this->_getDummyTable();
1142  }
1143 
1144  $from = array();
1145 
1146  foreach ($this->_parts[self::FROM] as $correlationName => $table) {
1147  $tmp = '';
1148 
1149  $joinType = ($table['joinType'] == self::FROM) ? self::INNER_JOIN : $table['joinType'];
1150 
1151  // Add join clause (if applicable)
1152  if (! empty($from)) {
1153  $tmp .= ' ' . strtoupper($joinType) . ' ';
1154  }
1155 
1156  $tmp .= $this->_getQuotedSchema($table['schema']);
1157  $tmp .= $this->_getQuotedTable($table['tableName'], $correlationName);
1158 
1159  // Add join conditions (if applicable)
1160  if (!empty($from) && ! empty($table['joinCondition'])) {
1161  $tmp .= ' ' . self::SQL_ON . ' ' . $table['joinCondition'];
1162  }
1163 
1164  // Add the table name and condition add to the list
1165  $from[] = $tmp;
1166  }
1167 
1168  // Add the list of all joins
1169  if (!empty($from)) {
1170  $sql .= ' ' . self::SQL_FROM . ' ' . implode("\n", $from);
1171  }
1172 
1173  return $sql;
1174  }
_getQuotedSchema($schema=null)
Definition: Select.php:1060
const FROM
Definition: Select.php:49
_getQuotedTable($tableName, $correlationName=null)
Definition: Select.php:1075
$table
Definition: trigger.php:14

◆ _renderGroup()

_renderGroup (   $sql)
protected

Render GROUP clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1222 of file Select.php.

1223  {
1224  if ($this->_parts[self::FROM] && $this->_parts[self::GROUP]) {
1225  $group = array();
1226  foreach ($this->_parts[self::GROUP] as $term) {
1227  $group[] = $this->_adapter->quoteIdentifier($term, true);
1228  }
1229  $sql .= ' ' . self::SQL_GROUP_BY . ' ' . implode(",\n\t", $group);
1230  }
1231 
1232  return $sql;
1233  }
$group
Definition: sections.phtml:16

◆ _renderHaving()

_renderHaving (   $sql)
protected

Render HAVING clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1241 of file Select.php.

1242  {
1243  if ($this->_parts[self::FROM] && $this->_parts[self::HAVING]) {
1244  $sql .= ' ' . self::SQL_HAVING . ' ' . implode(' ', $this->_parts[self::HAVING]);
1245  }
1246 
1247  return $sql;
1248  }

◆ _renderLimitoffset()

_renderLimitoffset (   $sql)
protected

Render LIMIT OFFSET clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1285 of file Select.php.

1286  {
1287  $count = 0;
1288  $offset = 0;
1289 
1290  if (!empty($this->_parts[self::LIMIT_OFFSET])) {
1291  $offset = (int) $this->_parts[self::LIMIT_OFFSET];
1292  $count = PHP_INT_MAX;
1293  }
1294 
1295  if (!empty($this->_parts[self::LIMIT_COUNT])) {
1296  $count = (int) $this->_parts[self::LIMIT_COUNT];
1297  }
1298 
1299  /*
1300  * Add limits clause
1301  */
1302  if ($count > 0) {
1303  $sql = trim($this->_adapter->limit($sql, $count, $offset));
1304  }
1305 
1306  return $sql;
1307  }
$count
Definition: recent.phtml:13

◆ _renderOrder()

_renderOrder (   $sql)
protected

Render ORDER clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1256 of file Select.php.

1257  {
1258  if ($this->_parts[self::ORDER]) {
1259  $order = array();
1260  foreach ($this->_parts[self::ORDER] as $term) {
1261  if (is_array($term)) {
1262  if(is_numeric($term[0]) && strval(intval($term[0])) == $term[0]) {
1263  $order[] = (int)trim($term[0]) . ' ' . $term[1];
1264  } else {
1265  $order[] = $this->_adapter->quoteIdentifier($term[0], true) . ' ' . $term[1];
1266  }
1267  } elseif (is_numeric($term) && strval(intval($term)) == $term) {
1268  $order[] = (int)trim($term);
1269  } else {
1270  $order[] = $this->_adapter->quoteIdentifier($term, true);
1271  }
1272  }
1273  $sql .= ' ' . self::SQL_ORDER_BY . ' ' . implode(', ', $order);
1274  }
1275 
1276  return $sql;
1277  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$order
Definition: order.php:55

◆ _renderUnion()

_renderUnion (   $sql)
protected

Render UNION query

Parameters
string$sqlSQL query
Returns
string

Definition at line 1182 of file Select.php.

1183  {
1184  if ($this->_parts[self::UNION]) {
1185  $parts = count($this->_parts[self::UNION]);
1186  foreach ($this->_parts[self::UNION] as $cnt => $union) {
1187  list($target, $type) = $union;
1188  if ($target instanceof Zend_Db_Select) {
1189  $target = $target->assemble();
1190  }
1191  $sql .= $target;
1192  if ($cnt < $parts - 1) {
1193  $sql .= ' ' . $type . ' ';
1194  }
1195  }
1196  }
1197 
1198  return $sql;
1199  }
$target
Definition: skip.phtml:8
$type
Definition: item.phtml:13

◆ _renderWhere()

_renderWhere (   $sql)
protected

Render WHERE clause

Parameters
string$sqlSQL query
Returns
string

Definition at line 1207 of file Select.php.

1208  {
1209  if ($this->_parts[self::FROM] && $this->_parts[self::WHERE]) {
1210  $sql .= ' ' . self::SQL_WHERE . ' ' . implode(' ', $this->_parts[self::WHERE]);
1211  }
1212 
1213  return $sql;
1214  }

◆ _tableCols()

_tableCols (   $correlationName,
  $cols,
  $afterCorrelationName = null 
)
protected

Adds to the internal table-to-column mapping array.

Parameters
string$tblThe table/join the columns come from.
array | string$colsThe list of columns; preferably as an array, but possibly as a string containing one column.
bool|stringTrue if it should be prepended, a correlation name if it should be inserted
Returns
void

Definition at line 950 of file Select.php.

951  {
952  if (!is_array($cols)) {
953  $cols = array($cols);
954  }
955 
956  if ($correlationName == null) {
957  $correlationName = '';
958  }
959 
960  $columnValues = array();
961 
962  foreach (array_filter($cols) as $alias => $col) {
963  $currentCorrelationName = $correlationName;
964  if (is_string($col)) {
965  // Check for a column matching "<column> AS <alias>" and extract the alias name
966  $col = trim(str_replace("\n", ' ', $col));
967  if (preg_match('/^(.+)\s+' . self::SQL_AS . '\s+(.+)$/i', $col, $m)) {
968  $col = $m[1];
969  $alias = $m[2];
970  }
971  // Check for columns that look like functions and convert to Zend_Db_Expr
972  if (preg_match(self::REGEX_COLUMN_EXPR, $col)) {
973  $col = new Zend_Db_Expr($col);
974  } elseif (preg_match('/(.+)\.(.+)/', $col, $m)) {
975  $currentCorrelationName = $m[1];
976  $col = $m[2];
977  }
978  }
979  $columnValues[] = array($currentCorrelationName, $col, is_string($alias) ? $alias : null);
980  }
981 
982  if ($columnValues) {
983 
984  // should we attempt to prepend or insert these values?
985  if ($afterCorrelationName === true || is_string($afterCorrelationName)) {
986  $tmpColumns = $this->_parts[self::COLUMNS];
987  $this->_parts[self::COLUMNS] = array();
988  } else {
989  $tmpColumns = array();
990  }
991 
992  // find the correlation name to insert after
993  if (is_string($afterCorrelationName)) {
994  while ($tmpColumns) {
995  $this->_parts[self::COLUMNS][] = $currentColumn = array_shift($tmpColumns);
996  if ($currentColumn[0] == $afterCorrelationName) {
997  break;
998  }
999  }
1000  }
1001 
1002  // apply current values to current stack
1003  foreach ($columnValues as $columnValue) {
1004  array_push($this->_parts[self::COLUMNS], $columnValue);
1005  }
1006 
1007  // finish ensuring that all previous values are applied (if they exist)
1008  while ($tmpColumns) {
1009  array_push($this->_parts[self::COLUMNS], array_shift($tmpColumns));
1010  }
1011  }
1012  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
const COLUMNS
Definition: Select.php:48
if(!trim($html)) $alias
Definition: details.phtml:20

◆ _where()

_where (   $condition,
  $value = null,
  $type = null,
  $bool = true 
)
protected

Internal function for creating the where clause

Parameters
string$condition
mixed$valueoptional
string$typeoptional
boolean$booltrue = AND, false = OR
Returns
string clause

Definition at line 1023 of file Select.php.

1024  {
1025  if (count($this->_parts[self::UNION])) {
1026  #require_once 'Zend/Db/Select/Exception.php';
1027  throw new Zend_Db_Select_Exception("Invalid use of where clause with " . self::SQL_UNION);
1028  }
1029 
1030  if ($value !== null) {
1031  $condition = $this->_adapter->quoteInto($condition, $value, $type);
1032  }
1033 
1034  $cond = "";
1035  if ($this->_parts[self::WHERE]) {
1036  if ($bool === true) {
1037  $cond = self::SQL_AND . ' ';
1038  } else {
1039  $cond = self::SQL_OR . ' ';
1040  }
1041  }
1042 
1043  return $cond . "($condition)";
1044  }
$type
Definition: item.phtml:13
$value
Definition: gender.phtml:16

◆ assemble()

assemble ( )

Converts this object to an SQL SELECT string.

Returns
string|null This object as a SELECT string. (or null if a string cannot be produced.)

Definition at line 724 of file Select.php.

725  {
726  $sql = self::SQL_SELECT;
727  foreach (array_keys(self::$_partsInit) as $part) {
728  $method = '_render' . ucfirst($part);
729  if (method_exists($this, $method)) {
730  $sql = $this->$method($sql);
731  }
732  }
733  return $sql;
734  }
const SQL_SELECT
Definition: Select.php:67
$method
Definition: info.phtml:13

◆ bind()

bind (   $bind)

Set bind variables

Parameters
mixed$bind
Returns
Zend_Db_Select

Definition at line 206 of file Select.php.

207  {
208  $this->_bind = $bind;
209 
210  return $this;
211  }

◆ columns()

columns (   $cols = '*',
  $correlationName = null 
)

Specifies the columns used in the FROM clause.

The parameter can be a single string or Zend_Db_Expr object, or else an array of strings or Zend_Db_Expr objects.

Parameters
array | string | Zend_Db_Expr$colsThe columns to select from this table.
string$correlationNameCorrelation name of target table. OPTIONAL
Returns
Zend_Db_Select This Zend_Db_Select object.
See also
Zend_Db_Select_Exception

Definition at line 264 of file Select.php.

265  {
266  if ($correlationName === null && count($this->_parts[self::FROM])) {
267  $correlationNameKeys = array_keys($this->_parts[self::FROM]);
268  $correlationName = current($correlationNameKeys);
269  }
270 
271  if (!array_key_exists($correlationName, $this->_parts[self::FROM])) {
275  #require_once 'Zend/Db/Select/Exception.php';
276  throw new Zend_Db_Select_Exception("No table has been specified for the FROM clause");
277  }
278 
279  $this->_tableCols($correlationName, $cols);
280 
281  return $this;
282  }
_tableCols($correlationName, $cols, $afterCorrelationName=null)
Definition: Select.php:950

◆ distinct()

distinct (   $flag = true)

Makes the query SELECT DISTINCT.

Parameters
bool$flagWhether or not the SELECT is DISTINCT (default true).
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 219 of file Select.php.

220  {
221  $this->_parts[self::DISTINCT] = (bool) $flag;
222  return $this;
223  }
const DISTINCT
Definition: Select.php:47

◆ forUpdate()

forUpdate (   $flag = true)

Makes the query SELECT FOR UPDATE.

Parameters
bool$flagWhether or not the SELECT is FOR UPDATE (default true).
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 675 of file Select.php.

676  {
677  $this->_parts[self::FOR_UPDATE] = (bool) $flag;
678  return $this;
679  }
const FOR_UPDATE
Definition: Select.php:57

◆ from()

from (   $name,
  $cols = '*',
  $schema = null 
)

Adds a FROM table and optional columns to the query.

The first parameter $name can be a simple string, in which case the correlation name is generated automatically. If you want to specify the correlation name, the first parameter must be an associative array in which the key is the correlation name, and the value is the physical table name. For example, array('alias' => 'table'). The correlation name is prepended to all columns fetched for this table.

The second parameter can be a single string or Zend_Db_Expr object, or else an array of strings or Zend_Db_Expr objects.

The first parameter can be null or an empty string, in which case no correlation name is generated or prepended to the columns named in the second parameter.

Parameters
array | string | Zend_Db_Expr$nameThe table name or an associative array relating correlation name to table name.
array | string | Zend_Db_Expr$colsThe columns to select from this table.
string$schemaThe schema name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 249 of file Select.php.

250  {
251  return $this->_join(self::FROM, $name, null, $cols, $schema);
252  }
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ getAdapter()

getAdapter ( )

Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Select object.

Returns
Zend_Db_Adapter_Abstract

Definition at line 758 of file Select.php.

759  {
760  return $this->_adapter;
761  }

◆ getBind()

getBind ( )

Get bind variables

Returns
array

Definition at line 195 of file Select.php.

196  {
197  return $this->_bind;
198  }

◆ getPart()

getPart (   $part)

Get part of the structured information for the current query.

Parameters
string$part
Returns
mixed
Exceptions
Zend_Db_Select_Exception

Definition at line 688 of file Select.php.

689  {
690  $part = strtolower($part);
691  if (!array_key_exists($part, $this->_parts)) {
692  #require_once 'Zend/Db/Select/Exception.php';
693  throw new Zend_Db_Select_Exception("Invalid Select part '$part'");
694  }
695  return $this->_parts[$part];
696  }

◆ group()

group (   $spec)

Adds grouping to the query.

Parameters
array | string$specThe column(s) to group by.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 526 of file Select.php.

527  {
528  if (!is_array($spec)) {
529  $spec = array($spec);
530  }
531 
532  foreach ($spec as $val) {
533  // Remove comments from SQL statement
534  $noComments = preg_replace(self::REGEX_SQL_COMMENTS, '$1', (string) $val);
535  if (preg_match(self::REGEX_COLUMN_EXPR_GROUP, $noComments)) {
536  $val = new Zend_Db_Expr($val);
537  }
538  $this->_parts[self::GROUP][] = $val;
539  }
540 
541  return $this;
542  }
const GROUP
Definition: Select.php:52

◆ having()

having (   $cond,
  $value = null,
  $type = null 
)

Adds a HAVING condition to the query by AND.

If a value is passed as the second param, it will be quoted and replaced into the condition wherever a question-mark appears. See where() for an example

Parameters
string$condThe HAVING condition.
mixed$valueOPTIONAL The value to quote into the condition.
int$typeOPTIONAL The type of the given value
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 556 of file Select.php.

557  {
558  if ($value !== null) {
559  $cond = $this->_adapter->quoteInto($cond, $value, $type);
560  }
561 
562  if ($this->_parts[self::HAVING]) {
563  $this->_parts[self::HAVING][] = self::SQL_AND . " ($cond)";
564  } else {
565  $this->_parts[self::HAVING][] = "($cond)";
566  }
567 
568  return $this;
569  }
const HAVING
Definition: Select.php:53
$type
Definition: item.phtml:13
$value
Definition: gender.phtml:16

◆ join()

join (   $name,
  $cond,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Adds a JOIN table and columns to the query.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
array | string | Zend_Db_Expr$nameThe table name.
string$condJoin on this condition.
array | string$colsThe columns to select from the joined table.
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 334 of file Select.php.

335  {
336  return $this->joinInner($name, $cond, $cols, $schema);
337  }
joinInner($name, $cond, $cols=self::SQL_WILDCARD, $schema=null)
Definition: Select.php:355
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ joinCross()

joinCross (   $name,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Add a CROSS JOIN table and colums to the query. A cross join is a cartesian product; there is no join condition.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
array | string | Zend_Db_Expr$nameThe table name.
array | string$colsThe columns to select from the joined table.
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 437 of file Select.php.

438  {
439  return $this->_join(self::CROSS_JOIN, $name, null, $cols, $schema);
440  }
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ joinFull()

joinFull (   $name,
  $cond,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Add a FULL OUTER JOIN table and colums to the query. A full outer join is like combining a left outer join and a right outer join. All rows from both tables are included, paired with each other on the same row of the result set if they satisfy the join condition, and otherwise paired with NULLs in place of columns from the other table.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
array | string | Zend_Db_Expr$nameThe table name.
string$condJoin on this condition.
array | string$colsThe columns to select from the joined table.
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 420 of file Select.php.

421  {
422  return $this->_join(self::FULL_JOIN, $name, $cond, $cols, $schema);
423  }
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ joinInner()

joinInner (   $name,
  $cond,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Add an INNER JOIN table and colums to the query Rows in both tables are matched according to the expression in the $cond argument. The result set is comprised of all cases where rows from the left table match rows from the right table.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
array | string | Zend_Db_Expr$nameThe table name.
string$condJoin on this condition.
array | string$colsThe columns to select from the joined table.
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 355 of file Select.php.

356  {
357  return $this->_join(self::INNER_JOIN, $name, $cond, $cols, $schema);
358  }
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ joinLeft()

joinLeft (   $name,
  $cond,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Add a LEFT OUTER JOIN table and colums to the query All rows from the left operand table are included, matching rows from the right operand table included, and the columns from the right operand table are filled with NULLs if no row exists matching the left table.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
array | string | Zend_Db_Expr$nameThe table name.
string$condJoin on this condition.
array | string$colsThe columns to select from the joined table.
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 376 of file Select.php.

377  {
378  return $this->_join(self::LEFT_JOIN, $name, $cond, $cols, $schema);
379  }
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ joinNatural()

joinNatural (   $name,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Add a NATURAL JOIN table and colums to the query. A natural join assumes an equi-join across any column(s) that appear with the same name in both tables. Only natural inner joins are supported by this API, even though SQL permits natural outer joins as well.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
array | string | Zend_Db_Expr$nameThe table name.
array | string$colsThe columns to select from the joined table.
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 457 of file Select.php.

458  {
459  return $this->_join(self::NATURAL_JOIN, $name, null, $cols, $schema);
460  }
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ joinRight()

joinRight (   $name,
  $cond,
  $cols = self::SQL_WILDCARD,
  $schema = null 
)

Add a RIGHT OUTER JOIN table and colums to the query. Right outer join is the complement of left outer join. All rows from the right operand table are included, matching rows from the left operand table included, and the columns from the left operand table are filled with NULLs if no row exists matching the right table.

The $name and $cols parameters follow the same logic as described in the from() method.

Parameters
array | string | Zend_Db_Expr$nameThe table name.
string$condJoin on this condition.
array | string$colsThe columns to select from the joined table.
string$schemaThe database name to specify, if any.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 398 of file Select.php.

399  {
400  return $this->_join(self::RIGHT_JOIN, $name, $cond, $cols, $schema);
401  }
_join($type, $name, $cond, $cols, $schema=null)
Definition: Select.php:779
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ limit()

limit (   $count = null,
  $offset = null 
)

Sets a limit count and offset to the query.

Parameters
int$countOPTIONAL The number of rows to return.
int$offsetOPTIONAL Start returning after this many rows.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 646 of file Select.php.

647  {
648  $this->_parts[self::LIMIT_COUNT] = (int) $count;
649  $this->_parts[self::LIMIT_OFFSET] = (int) $offset;
650  return $this;
651  }
$count
Definition: recent.phtml:13
const LIMIT_OFFSET
Definition: Select.php:56
const LIMIT_COUNT
Definition: Select.php:55

◆ limitPage()

limitPage (   $page,
  $rowCount 
)

Sets the limit and count by page number.

Parameters
int$pageLimit results to this page number.
int$rowCountUse this many rows per page.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 660 of file Select.php.

661  {
662  $page = ($page > 0) ? $page : 1;
663  $rowCount = ($rowCount > 0) ? $rowCount : 1;
664  $this->_parts[self::LIMIT_COUNT] = (int) $rowCount;
665  $this->_parts[self::LIMIT_OFFSET] = (int) $rowCount * ($page - 1);
666  return $this;
667  }
$page
Definition: pages.php:8
const LIMIT_OFFSET
Definition: Select.php:56
const LIMIT_COUNT
Definition: Select.php:55

◆ order()

order (   $spec)

Adds a row order to the query.

Parameters
mixed$specThe column(s) and direction to order by.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 604 of file Select.php.

605  {
606  if (!is_array($spec)) {
607  $spec = array($spec);
608  }
609 
610  // force 'ASC' or 'DESC' on each order spec, default is ASC.
611  foreach ($spec as $val) {
612  if ($val instanceof Zend_Db_Expr) {
613  $expr = $val->__toString();
614  if (empty($expr)) {
615  continue;
616  }
617  $this->_parts[self::ORDER][] = $val;
618  } else {
619  if (empty($val)) {
620  continue;
621  }
622  $direction = self::SQL_ASC;
623  if (preg_match('/(.*\W)(' . self::SQL_ASC . '|' . self::SQL_DESC . ')\b/si', $val, $matches)) {
624  $val = trim($matches[1]);
625  $direction = $matches[2];
626  }
627  // Remove comments from SQL statement
628  $noComments = preg_replace(self::REGEX_SQL_COMMENTS, '$1', (string) $val);
629  if (preg_match(self::REGEX_COLUMN_EXPR_ORDER, $noComments)) {
630  $val = new Zend_Db_Expr($val);
631  }
632  $this->_parts[self::ORDER][] = array($val, $direction);
633  }
634  }
635 
636  return $this;
637  }
const ORDER
Definition: Select.php:54
const SQL_ASC
Definition: Select.php:81

◆ orHaving()

orHaving (   $cond,
  $value = null,
  $type = null 
)

Adds a HAVING condition to the query by OR.

Otherwise identical to orHaving().

Parameters
string$condThe HAVING condition.
mixed$valueOPTIONAL The value to quote into the condition.
int$typeOPTIONAL The type of the given value
Returns
Zend_Db_Select This Zend_Db_Select object.
See also
having()

Definition at line 583 of file Select.php.

584  {
585  if ($value !== null) {
586  $cond = $this->_adapter->quoteInto($cond, $value, $type);
587  }
588 
589  if ($this->_parts[self::HAVING]) {
590  $this->_parts[self::HAVING][] = self::SQL_OR . " ($cond)";
591  } else {
592  $this->_parts[self::HAVING][] = "($cond)";
593  }
594 
595  return $this;
596  }
const HAVING
Definition: Select.php:53
$type
Definition: item.phtml:13
$value
Definition: gender.phtml:16

◆ orWhere()

orWhere (   $cond,
  $value = null,
  $type = null 
)

Adds a WHERE condition to the query by OR.

Otherwise identical to where().

Parameters
string$condThe WHERE condition.
mixed$valueOPTIONAL The value to quote into the condition.
int$typeOPTIONAL The type of the given value
Returns
Zend_Db_Select This Zend_Db_Select object.
See also
where()

Definition at line 513 of file Select.php.

514  {
515  $this->_parts[self::WHERE][] = $this->_where($cond, $value, $type, false);
516 
517  return $this;
518  }
$type
Definition: item.phtml:13
$value
Definition: gender.phtml:16
const WHERE
Definition: Select.php:51
_where($condition, $value=null, $type=null, $bool=true)
Definition: Select.php:1023

◆ query()

query (   $fetchMode = null,
  $bind = array() 
)

Executes the current select object and returns the result

Parameters
integer$fetchModeOPTIONAL
mixed$bindAn array of data to bind to the placeholders.
Returns
PDO_Statement|Zend_Db_Statement

Definition at line 705 of file Select.php.

706  {
707  if (!empty($bind)) {
708  $this->bind($bind);
709  }
710 
711  $stmt = $this->_adapter->query($this);
712  if ($fetchMode == null) {
713  $fetchMode = $this->_adapter->getFetchMode();
714  }
715  $stmt->setFetchMode($fetchMode);
716  return $stmt;
717  }
bind($bind)
Definition: Select.php:206

◆ reset()

reset (   $part = null)

Clear parts of the Select object, or an individual part.

Parameters
string$partOPTIONAL
Returns
Zend_Db_Select

Definition at line 742 of file Select.php.

743  {
744  if ($part == null) {
745  $this->_parts = self::$_partsInit;
746  } elseif (array_key_exists($part, self::$_partsInit)) {
747  $this->_parts[$part] = self::$_partsInit[$part];
748  }
749  return $this;
750  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
static $_partsInit
Definition: Select.php:126

◆ union()

union (   $select = array(),
  $type = self::SQL_UNION 
)

Adds a UNION clause to the query.

The first parameter has to be an array of Zend_Db_Select or sql query strings.

$sql1 = $db->select(); $sql2 = "SELECT ..."; $select = $db->select() ->union(array($sql1, $sql2)) ->order("id");

Parameters
array$selectArray of select clauses for the union.
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 301 of file Select.php.

302  {
303  if (!is_array($select)) {
304  #require_once 'Zend/Db/Select/Exception.php';
305  throw new Zend_Db_Select_Exception(
306  "union() only accepts an array of Zend_Db_Select instances of sql query strings."
307  );
308  }
309 
310  if (!in_array($type, self::$_unionTypes)) {
311  #require_once 'Zend/Db/Select/Exception.php';
312  throw new Zend_Db_Select_Exception("Invalid union type '{$type}'");
313  }
314 
315  foreach ($select as $target) {
316  $this->_parts[self::UNION][] = array($target, $type);
317  }
318 
319  return $this;
320  }
$target
Definition: skip.phtml:8
$type
Definition: item.phtml:13
const UNION
Definition: Select.php:50

◆ where()

where (   $cond,
  $value = null,
  $type = null 
)

Adds a WHERE condition to the query by AND.

If a value is passed as the second param, it will be quoted and replaced into the condition wherever a question-mark appears. Array values are quoted and comma-separated.

// simplest but non-secure $select->where("id = $id");

// secure (ID is quoted but matched anyway) $select->where('id = ?', $id);

// alternatively, with named binding $select->where('id = :id');

Note that it is more correct to use named bindings in your queries for values other than strings. When you use named bindings, don't forget to pass the values when actually making a query:

$db->fetchAll($select, array('id' => 5));

Parameters
string$condThe WHERE condition.
mixed$valueOPTIONAL The value to quote into the condition.
int$typeOPTIONAL The type of the given value
Returns
Zend_Db_Select This Zend_Db_Select object.

Definition at line 494 of file Select.php.

495  {
496  $this->_parts[self::WHERE][] = $this->_where($cond, $value, $type, true);
497 
498  return $this;
499  }
$type
Definition: item.phtml:13
$value
Definition: gender.phtml:16
const WHERE
Definition: Select.php:51
_where($condition, $value=null, $type=null, $bool=true)
Definition: Select.php:1023

Field Documentation

◆ $_adapter

$_adapter
protected

Definition at line 117 of file Select.php.

◆ $_bind

$_bind = array()
protected

Definition at line 110 of file Select.php.

◆ $_joinTypes

$_joinTypes
staticprotected
Initial value:
= array(
self::INNER_JOIN,
self::LEFT_JOIN,
self::RIGHT_JOIN,
self::FULL_JOIN,
self::CROSS_JOIN,
self::NATURAL_JOIN,
)

Definition at line 145 of file Select.php.

◆ $_parts

$_parts = array()
protected

Definition at line 170 of file Select.php.

◆ $_partsInit

$_partsInit
staticprotected
Initial value:
= array(
self::DISTINCT => false,
self::COLUMNS => array(),
self::UNION => array(),
self::FROM => array(),
self::WHERE => array(),
self::GROUP => array(),
self::HAVING => array(),
self::ORDER => array(),
self::LIMIT_COUNT => null,
self::LIMIT_OFFSET => null,
self::FOR_UPDATE => false
)

Definition at line 126 of file Select.php.

◆ $_tableCols

$_tableCols = array()
protected

Definition at line 177 of file Select.php.

◆ $_unionTypes

$_unionTypes
staticprotected
Initial value:
= array(
self::SQL_UNION,
self::SQL_UNION_ALL
)

Definition at line 159 of file Select.php.

◆ COLUMNS

const COLUMNS = 'columns'

Definition at line 48 of file Select.php.

◆ CROSS_JOIN

const CROSS_JOIN = 'cross join'

Definition at line 63 of file Select.php.

◆ DISTINCT

const DISTINCT = 'distinct'

Definition at line 47 of file Select.php.

◆ FOR_UPDATE

const FOR_UPDATE = 'forupdate'

Definition at line 57 of file Select.php.

◆ FROM

const FROM = 'from'

Definition at line 49 of file Select.php.

◆ FULL_JOIN

const FULL_JOIN = 'full join'

Definition at line 62 of file Select.php.

◆ GROUP

const GROUP = 'group'

Definition at line 52 of file Select.php.

◆ HAVING

const HAVING = 'having'

Definition at line 53 of file Select.php.

◆ INNER_JOIN

const INNER_JOIN = 'inner join'

Definition at line 59 of file Select.php.

◆ LEFT_JOIN

const LEFT_JOIN = 'left join'

Definition at line 60 of file Select.php.

◆ LIMIT_COUNT

const LIMIT_COUNT = 'limitcount'

Definition at line 55 of file Select.php.

◆ LIMIT_OFFSET

const LIMIT_OFFSET = 'limitoffset'

Definition at line 56 of file Select.php.

◆ NATURAL_JOIN

const NATURAL_JOIN = 'natural join'

Definition at line 64 of file Select.php.

◆ ORDER

const ORDER = 'order'

Definition at line 54 of file Select.php.

◆ REGEX_COLUMN_EXPR

const REGEX_COLUMN_EXPR = '/^([\w]*\s*\(([^\(\)]|(?1))*\))$/'

Definition at line 84 of file Select.php.

◆ REGEX_COLUMN_EXPR_GROUP

const REGEX_COLUMN_EXPR_GROUP = '/^([\w]+\s*\(([^\(\)]|(?1))*\))$/'

Definition at line 86 of file Select.php.

◆ REGEX_COLUMN_EXPR_ORDER

const REGEX_COLUMN_EXPR_ORDER = '/^([\w]+\s*\(([^\(\)]|(?1))*\))$/'

Definition at line 85 of file Select.php.

◆ REGEX_SQL_COMMENTS

const REGEX_SQL_COMMENTS
Initial value:
= '@
(([\'"]).*?[^\\\]\2) # $1 : Skip single & double quoted expressions
|( # $3 : Match comments
(?:\#|--).*?$ # - Single line comments
| # - Multi line (nested) comments
/\* # . comment open marker
(?: [^/*] # . non comment-marker characters
|/(?!\*) # . ! not a comment open
|\*(?!/) # . ! not a comment close
|(?R) # . recursive case
)* # . repeat eventually
\*\/ # . comment close marker
)\s* # Trim after comments
|(?<=;)\s+ # Trim after semi-colon
@msx'

Definition at line 89 of file Select.php.

◆ RIGHT_JOIN

const RIGHT_JOIN = 'right join'

Definition at line 61 of file Select.php.

◆ SQL_AND

const SQL_AND = 'AND'

Definition at line 77 of file Select.php.

◆ SQL_AS

const SQL_AS = 'AS'

Definition at line 78 of file Select.php.

◆ SQL_ASC

const SQL_ASC = 'ASC'

Definition at line 81 of file Select.php.

◆ SQL_DESC

const SQL_DESC = 'DESC'

Definition at line 82 of file Select.php.

◆ SQL_DISTINCT

const SQL_DISTINCT = 'DISTINCT'

Definition at line 72 of file Select.php.

◆ SQL_FOR_UPDATE

const SQL_FOR_UPDATE = 'FOR UPDATE'

Definition at line 76 of file Select.php.

◆ SQL_FROM

const SQL_FROM = 'FROM'

Definition at line 70 of file Select.php.

◆ SQL_GROUP_BY

const SQL_GROUP_BY = 'GROUP BY'

Definition at line 73 of file Select.php.

◆ SQL_HAVING

const SQL_HAVING = 'HAVING'

Definition at line 75 of file Select.php.

◆ SQL_ON

const SQL_ON = 'ON'

Definition at line 80 of file Select.php.

◆ SQL_OR

const SQL_OR = 'OR'

Definition at line 79 of file Select.php.

◆ SQL_ORDER_BY

const SQL_ORDER_BY = 'ORDER BY'

Definition at line 74 of file Select.php.

◆ SQL_SELECT

const SQL_SELECT = 'SELECT'

Definition at line 67 of file Select.php.

◆ SQL_UNION

const SQL_UNION = 'UNION'

Definition at line 68 of file Select.php.

◆ SQL_UNION_ALL

const SQL_UNION_ALL = 'UNION ALL'

Definition at line 69 of file Select.php.

◆ SQL_WHERE

const SQL_WHERE = 'WHERE'

Definition at line 71 of file Select.php.

◆ SQL_WILDCARD

const SQL_WILDCARD = '*'

Definition at line 66 of file Select.php.

◆ UNION

const UNION = 'union'

Definition at line 50 of file Select.php.

◆ WHERE

const WHERE = 'where'

Definition at line 51 of file Select.php.


The documentation for this class was generated from the following file: