26 #require_once 'Zend/Db.php'; 31 #require_once 'Zend/Db/Statement/Interface.php'; 112 $sql = $sql->assemble();
117 $this->_queryId = $this->_adapter->getProfiler()->queryStart($sql);
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();
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);
227 $this->_bindColumn[$column] =& $param;
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;
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);
337 public function fetchAll($style =
null, $col =
null)
348 while (
false !== ($val = $this->
fetchColumn($col))) {
366 if (!is_array(
$row)) {
383 if (!is_array(
$row)) {
386 foreach (
$row as $key => $val) {
400 if (array_key_exists($key, $this->_attribute)) {
401 return $this->_attribute[$key];
414 $this->_attribute[$key] = $val;
431 $this->_fetchMode =
$mode;
439 #require_once 'Zend/Db/Statement/Exception.php'; 461 if (isset($this->_bindColumn[$key])) {
462 $this->_bindColumn[$key] =
$value;
bindParam($parameter, &$variable, $type=null, $length=null, $options=null)
fetchObject($class='stdClass', array $config=array())
execute(array $params=null)
fetchAll($style=null, $col=null)
fetch($style=null, $cursor=null, $offset=null)
bindColumn($column, &$param, $type=null)
$_option $_optionId $class
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
bindValue($parameter, $value, $type=null)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
__construct($adapter, $sql)