当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Db_Adapter_Interface::quoteInto方法代码示例

本文整理汇总了PHP中Varien_Db_Adapter_Interface::quoteInto方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Db_Adapter_Interface::quoteInto方法的具体用法?PHP Varien_Db_Adapter_Interface::quoteInto怎么用?PHP Varien_Db_Adapter_Interface::quoteInto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Db_Adapter_Interface的用法示例。


在下文中一共展示了Varien_Db_Adapter_Interface::quoteInto方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAttributeCodes

 /**
  * Retrieve attribute codes using for flat
  *
  * @return array
  */
 public function getAttributeCodes()
 {
     if ($this->_attributeCodes === null) {
         $this->_attributeCodes = array();
         $systemAttributes = array();
         $attributeNodes = Mage::getConfig()->getNode(self::XML_NODE_ATTRIBUTE_NODES)->children();
         foreach ($attributeNodes as $node) {
             $attributes = Mage::getConfig()->getNode((string) $node)->asArray();
             $attributes = array_keys($attributes);
             $systemAttributes = array_unique(array_merge($attributes, $systemAttributes));
         }
         $bind = array('backend_type' => Mage_Eav_Model_Entity_Attribute_Abstract::TYPE_STATIC, 'entity_type_id' => $this->getEntityTypeId());
         $select = $this->_connection->select()->from(array('main_table' => $this->getTable('eav/attribute')))->join(array('additional_table' => $this->getTable('catalog/eav_attribute')), 'additional_table.attribute_id = main_table.attribute_id')->where('main_table.entity_type_id = :entity_type_id');
         $whereCondition = array('main_table.backend_type = :backend_type', $this->_connection->quoteInto('additional_table.is_used_for_promo_rules = ?', 1), $this->_connection->quoteInto('additional_table.used_in_product_listing = ?', 1), $this->_connection->quoteInto('additional_table.used_for_sort_by = ?', 1), $this->_connection->quoteInto('main_table.attribute_code IN(?)', $systemAttributes));
         if ($this->getFlatHelper()->isAddFilterableAttributes()) {
             $whereCondition[] = $this->_connection->quoteInto('additional_table.is_filterable > ?', 0);
         }
         $select->where(implode(' OR ', $whereCondition));
         $attributesData = $this->_connection->fetchAll($select, $bind);
         Mage::getSingleton('eav/config')->importAttributesData($this->getEntityType(), $attributesData);
         foreach ($attributesData as $data) {
             $this->_attributeCodes[$data['attribute_id']] = $data['attribute_code'];
         }
         unset($attributesData);
     }
     return $this->_attributeCodes;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:32,代码来源:Product.php

示例2: getOperatorCondition

 /**
  * Convert operator for sql where
  *
  * @param string $field
  * @param string $operator
  * @param string|array $value
  * @return string
  */
 public function getOperatorCondition($field, $operator, $value)
 {
     switch ($operator) {
         case '!=':
         case '>=':
         case '<=':
         case '>':
         case '<':
             $selectOperator = sprintf('%s?', $operator);
             break;
         case '{}':
         case '!{}':
             if (preg_match('/^.*(category_id)$/', $field) && is_array($value)) {
                 $selectOperator = ' IN (?)';
             } else {
                 $selectOperator = ' LIKE ?';
             }
             if (substr($operator, 0, 1) == '!') {
                 $selectOperator = ' NOT' . $selectOperator;
             }
             break;
         case '[]':
         case '![]':
         case '()':
         case '!()':
             $selectOperator = 'FIND_IN_SET(?,' . $this->_adapter->quoteIdentifier($field) . ')';
             if (substr($operator, 0, 1) == '!') {
                 $selectOperator = 'NOT ' . $selectOperator;
             }
             break;
         default:
             $selectOperator = '=?';
             break;
     }
     $field = $this->_adapter->quoteIdentifier($field);
     if (is_array($value) && in_array($operator, array('==', '!=', '>=', '<=', '>', '<', '{}', '!{}'))) {
         $results = array();
         foreach ($value as $v) {
             $results[] = $this->_adapter->quoteInto("{$field}{$selectOperator}", $v);
         }
         $result = implode(' AND ', $results);
     } elseif (in_array($operator, array('()', '!()', '[]', '![]'))) {
         if (!is_array($value)) {
             $value = array($value);
         }
         $results = array();
         foreach ($value as $v) {
             $results[] = $this->_adapter->quoteInto("{$selectOperator}", $v);
         }
         $result = implode(in_array($operator, array('()', '!()')) ? ' OR ' : ' AND ', $results);
     } else {
         $result = $this->_adapter->quoteInto("{$field}{$selectOperator}", $value);
     }
     return $result;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:63,代码来源:SqlBuilder.php

示例3: getEventConditionsSql

 /**
  * Get events conditons SQL
  *
  * @param array $conditions
  * @param string $conditionsLogic
  *
  * @return string
  */
 public function getEventConditionsSql($conditions, $conditionsLogic)
 {
     $conditionStrings = array();
     foreach ($conditions as $condition) {
         $sql = $condition[self::INDEX_CONDITION];
         if (isset($condition[self::INDEX_PARAM])) {
             foreach ($condition[self::INDEX_PARAM] as $param) {
                 $sql = $this->_connection->quoteInto($sql, $param, null, 1);
             }
         }
         $conditionStrings[] = $sql;
     }
     return implode(' ' . $conditionsLogic . ' ', $conditionStrings);
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:22,代码来源:Trigger.php

示例4: joinTableToSelect

 /**
  * Join url rewrite to select
  *
  * @param Varien_Db_Select $select
  * @param int $storeId
  * @return Mage_Catalog_Helper_Category_Url_Rewrite
  */
 public function joinTableToSelect(Varien_Db_Select $select, $storeId)
 {
     $select->joinLeft(array('url_rewrite' => $this->_resource->getTableName('core/url_rewrite')), 'url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND ' . $this->_connection->quoteInto('url_rewrite.store_id = ? AND ', (int) $storeId) . $this->_connection->prepareSqlCondition('url_rewrite.id_path', array('like' => 'category/%')), array('request_path' => 'url_rewrite.request_path'));
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:12,代码来源:Rewrite.php

示例5: joinTableToSelect

 /**
  * Join url rewrite to select
  *
  * @param Varien_Db_Select $select
  * @param int $storeId
  * @return Enterprise_Catalog_Helper_Category_UrlRewrite
  */
 public function joinTableToSelect(Varien_Db_Select $select, $storeId)
 {
     $requestPath = $this->_connection->getIfNullSql('url_rewrite.request_path', 'default_ur.request_path');
     $select->joinLeft(array('url_rewrite_category' => $this->_resource->getTableName('enterprise_catalog/category')), 'url_rewrite_category.category_id = main_table.entity_id' . ' AND ' . $this->_connection->quoteInto('url_rewrite_category.store_id = ?', (int) $storeId), array(''))->joinLeft(array('url_rewrite' => $this->_resource->getTableName('enterprise_urlrewrite/url_rewrite')), 'url_rewrite_category.url_rewrite_id = url_rewrite.url_rewrite_id AND url_rewrite.is_system = 1', array(''))->joinLeft(array('default_urc' => $this->_resource->getTableName('enterprise_catalog/category')), 'default_urc.category_id = url_rewrite_category.category_id AND default_urc.store_id = 0', array(''))->joinLeft(array('default_ur' => $this->_resource->getTableName('enterprise_urlrewrite/url_rewrite')), 'default_ur.url_rewrite_id = default_urc.url_rewrite_id  AND default_ur.is_system = 1', array('request_path' => $requestPath));
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:13,代码来源:UrlRewrite.php

示例6: _deleteSpecificTypeValues

 /**
  * Delete custom option type values
  *
  * @param array $optionIds
  * @return Mage_ImportExport_Model_Import_Entity_Product_Option
  */
 protected function _deleteSpecificTypeValues(array $optionIds)
 {
     $this->_connection->delete($this->_tables['catalog_product_option_type_value'], $this->_connection->quoteInto('option_id IN (?)', $optionIds));
     return $this;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:11,代码来源:Option.php

示例7: _purchasableQueryHelper

 /**
  * Constructs the query returning purchasable products
  *
  * @param Varien_Db_Adapter_Interface $dbRead               Read connection
  * @param Varien_Data_Collection_Db   $productCollection    Products
  * @param Varien_Db_Select            $productToParentQuery Parent resolution
  * @param Varien_Data_Collection_Db   $parentCollection     Parents
  * @param array                       $purchasableFilter    Visibility filter
  * @param bool                        $resetColumns         Flat product fix
  *
  * @return Varien_Db_Select
  */
 private function _purchasableQueryHelper($dbRead, $productCollection, $productToParentQuery, $parentCollection, $purchasableFilter, $resetColumns)
 {
     $productQuery = $productCollection->getSelect();
     if ($resetColumns) {
         $productQuery->reset(Zend_Db_Select::COLUMNS)->columns(array('e.entity_id', 'e.sku', 'e.attribute_set_id', 'e.type_id'));
     }
     $query = $dbRead->select();
     $query->from(array('product' => new Zend_Db_Expr("({$productQuery})")), array('entity_id', 'sku'))->joinLeft(array('product_to_parent' => new Zend_Db_Expr("({$productToParentQuery})")), 'product_to_parent.product_id = product.entity_id', array())->joinLeft(array('parent' => new Zend_Db_Expr("({$parentCollection->getSelect()})")), $dbRead->quoteInto('parent.entity_id = product_to_parent.parent_id ' . 'AND parent.type_id = ?', Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE), array())->where('parent.status IS NULL OR parent.status = ?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
     return $query;
 }
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:22,代码来源:Api.php


注:本文中的Varien_Db_Adapter_Interface::quoteInto方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。