|
| __construct ($adapter, $sql) |
|
| bindColumn ($column, &$param, $type=null) |
|
| bindParam ($parameter, &$variable, $type=null, $length=null, $options=null) |
|
| bindValue ($parameter, $value, $type=null) |
|
| execute (array $params=null) |
|
| fetchAll ($style=null, $col=null) |
|
| fetchColumn ($col=0) |
|
| fetchObject ($class='stdClass', array $config=array()) |
|
| getAttribute ($key) |
|
| setAttribute ($key, $val) |
|
| setFetchMode ($mode) |
|
| _fetchBound ($row) |
|
| getAdapter () |
|
| getDriverStatement () |
|
| closeCursor () |
|
| columnCount () |
|
| errorCode () |
|
| errorInfo () |
|
| fetch ($style=null, $cursor=null, $offset=null) |
|
| nextRowset () |
|
| rowCount () |
|
Definition at line 42 of file Statement.php.
◆ __construct()
__construct |
( |
|
$adapter, |
|
|
|
$sql |
|
) |
| |
Constructor for a statement.
- Parameters
-
Definition at line 108 of file Statement.php.
112 $sql = $sql->assemble();
117 $this->_queryId = $this->_adapter->getProfiler()->queryStart($sql);
◆ _fetchBound()
Helper function to map retrieved row to bound column variables
- Parameters
-
- Returns
- bool True
Definition at line 452 of file Statement.php.
461 if (isset($this->_bindColumn[$key])) {
462 $this->_bindColumn[$key] =
$value;
◆ _parseParameters()
- Parameters
-
- Returns
- void
- See also
- Zend_Db_Statement_Exception
-
Zend_Db_Statement_Exception
Definition at line 135 of file Statement.php.
140 $this->_sqlSplit = preg_split(
'/(\?|\:[a-zA-Z0-9_]+)/',
141 $sql, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
144 $this->_sqlParam = array();
145 foreach ($this->_sqlSplit as $key => $val) {
147 if ($this->_adapter->supportsParameters(
'positional') ===
false) {
151 #require_once 'Zend/Db/Statement/Exception.php'; 154 }
else if ($val[0] ==
':') {
155 if ($this->_adapter->supportsParameters(
'named') ===
false) {
159 #require_once 'Zend/Db/Statement/Exception.php'; 163 $this->_sqlParam[] = $val;
167 $this->_bindParam = array();
◆ _prepare()
Internal method called by abstract statment constructor to setup the driver level statement
- Returns
- void
Definition at line 126 of file Statement.php.
◆ _stripQuoted()
Remove parts of a SQL string that contain quoted strings of values or identifiers.
- Parameters
-
- Returns
- string
Definition at line 177 of file Statement.php.
182 $q = $this->_adapter->quote(
'a');
186 $qe = $this->_adapter->quote($q);
187 $qe = substr($qe, 1, 2);
188 $qe = preg_quote($qe);
189 $escapeChar = substr($qe,0,1);
192 $escapeChar = preg_quote($escapeChar);
194 $sql = preg_replace(
"/$q([^$q{$escapeChar}]*|($qe)*)*$q/s",
'', $sql);
200 $sql = preg_replace(
"/\"(\\\\\"|[^\"])*\"/Us",
'', $sql);
204 $d = $this->_adapter->quoteIdentifier(
'a');
208 $de = $this->_adapter->quoteIdentifier($d);
209 $de = substr($de, 1, 2);
210 $de = preg_quote($de);
212 $sql = preg_replace(
"/$d($de|\\\\{2}|[^$d])*$d/Us",
'', $sql);
◆ bindColumn()
bindColumn |
( |
|
$column, |
|
|
& |
$param, |
|
|
|
$type = null |
|
) |
| |
Bind a column of the statement result set to a PHP variable.
- Parameters
-
string | $column | Name the column in the result set, either by position or by name. |
mixed | $param | Reference to the PHP variable containing the value. |
mixed | $type | OPTIONAL |
- Returns
- bool
Implements Zend_Db_Statement_Interface.
Definition at line 225 of file Statement.php.
227 $this->_bindColumn[$column] =& $param;
◆ bindParam()
bindParam |
( |
|
$parameter, |
|
|
& |
$variable, |
|
|
|
$type = null , |
|
|
|
$length = null , |
|
|
|
$options = null |
|
) |
| |
Binds a parameter to the specified variable name.
- Parameters
-
mixed | $parameter | Name the parameter, either integer or string. |
mixed | $variable | Reference to PHP variable containing the value. |
mixed | $type | OPTIONAL Datatype of SQL parameter. |
mixed | $length | OPTIONAL Length of SQL parameter. |
mixed | $options | OPTIONAL Other options. |
- Returns
- bool
- See also
- Zend_Db_Statement_Exception
-
Zend_Db_Statement_Exception
Implements Zend_Db_Statement_Interface.
Definition at line 241 of file Statement.php.
243 if (!is_int($parameter) && !is_string($parameter)) {
247 #require_once 'Zend/Db/Statement/Exception.php'; 252 if (($intval = (
int) $parameter) > 0 && $this->_adapter->supportsParameters(
'positional')) {
253 if ($intval >= 1 || $intval <= count($this->_sqlParam)) {
256 }
else if ($this->_adapter->supportsParameters(
'named')) {
257 if ($parameter[0] !=
':') {
258 $parameter =
':' . $parameter;
260 if (in_array($parameter, $this->_sqlParam) !==
false) {
261 $position = $parameter;
265 if ($position ===
null) {
269 #require_once 'Zend/Db/Statement/Exception.php'; 274 $this->_bindParam[$position] =&
$variable;
◆ bindValue()
bindValue |
( |
|
$parameter, |
|
|
|
$value, |
|
|
|
$type = null |
|
) |
| |
Binds a value to a parameter.
- Parameters
-
mixed | $parameter | Name the parameter, either integer or string. |
mixed | $value | Scalar value to bind to the parameter. |
mixed | $type | OPTIONAL Datatype of the parameter. |
- Returns
- bool
Implements Zend_Db_Statement_Interface.
Definition at line 286 of file Statement.php.
bindParam($parameter, &$variable, $type=null, $length=null, $options=null)
◆ execute()
execute |
( |
array |
$params = null | ) |
|
Executes a prepared statement.
- Parameters
-
array | $params | OPTIONAL Values to bind to parameter placeholders. |
- Returns
- bool
Implements Zend_Db_Statement_Interface.
Definition at line 297 of file Statement.php.
302 if ($this->_queryId ===
null) {
303 return $this->_execute(
$params);
310 $prof = $this->_adapter->getProfiler();
311 $qp = $prof->getQueryProfile($this->_queryId);
312 if ($qp->hasEnded()) {
313 $this->_queryId = $prof->queryClone($qp);
314 $qp = $prof->getQueryProfile($this->_queryId);
319 $qp->bindParams($this->_bindParam);
321 $qp->start($this->_queryId);
323 $retval = $this->_execute(
$params);
325 $prof->queryEnd($this->_queryId);
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ fetchAll()
fetchAll |
( |
|
$style = null , |
|
|
|
$col = null |
|
) |
| |
Returns an array containing all of the result set rows.
- Parameters
-
int | $style | OPTIONAL Fetch mode. |
int | $col | OPTIONAL Column number, if fetch mode is by column. |
- Returns
- array Collection of rows, each in a format by the fetch mode.
Implements Zend_Db_Statement_Interface.
Definition at line 337 of file Statement.php.
348 while (
false !== ($val = $this->
fetchColumn($col))) {
fetch($style=null, $cursor=null, $offset=null)
◆ fetchColumn()
Returns a single column from the next row of a result set.
- Parameters
-
int | $col | OPTIONAL Position of the column to fetch. |
- Returns
- string One value from the next row of result set, or false.
Implements Zend_Db_Statement_Interface.
Definition at line 361 of file Statement.php.
366 if (!is_array(
$row)) {
fetch($style=null, $cursor=null, $offset=null)
◆ fetchObject()
fetchObject |
( |
|
$class = 'stdClass' , |
|
|
array |
$config = array() |
|
) |
| |
Fetches the next row and returns it as an object.
- Parameters
-
string | $class | OPTIONAL Name of the class to create. |
array | $config | OPTIONAL Constructor arguments for the class. |
- Returns
- mixed One object instance of the specified class, or false.
Implements Zend_Db_Statement_Interface.
Definition at line 379 of file Statement.php.
383 if (!is_array(
$row)) {
386 foreach (
$row as $key => $val) {
fetch($style=null, $cursor=null, $offset=null)
$_option $_optionId $class
◆ getAdapter()
◆ getAttribute()
Retrieve a statement attribute.
- Parameters
-
string | $key | Attribute name. |
- Returns
- mixed Attribute value.
Implements Zend_Db_Statement_Interface.
Definition at line 398 of file Statement.php.
400 if (array_key_exists($key, $this->_attribute)) {
401 return $this->_attribute[$key];
◆ getDriverStatement()
Gets the resource or object setup by the _parse
- Returns
- unknown_type
Definition at line 484 of file Statement.php.
◆ setAttribute()
setAttribute |
( |
|
$key, |
|
|
|
$val |
|
) |
| |
Set a statement attribute.
- Parameters
-
string | $key | Attribute name. |
mixed | $val | Attribute value. |
- Returns
- bool
Implements Zend_Db_Statement_Interface.
Definition at line 412 of file Statement.php.
414 $this->_attribute[$key] = $val;
◆ setFetchMode()
Set the default fetch mode for this statement.
- Parameters
-
- Returns
- bool
- Exceptions
-
- See also
- Zend_Db_Statement_Exception
Implements Zend_Db_Statement_Interface.
Definition at line 424 of file Statement.php.
431 $this->_fetchMode =
$mode;
439 #require_once 'Zend/Db/Statement/Exception.php';
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
◆ $_adapter
◆ $_attribute
◆ $_bindColumn
◆ $_bindParam
◆ $_fetchMode
◆ $_queryId
◆ $_sqlParam
◆ $_sqlSplit
◆ $_stmt
The documentation for this class was generated from the following file: