• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DbQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getProductInformations

 /**
  * Gets reference, ean13 and upc of the current product
  * Stores it in stock for stock_mvt integrity and history purposes
  */
 protected function getProductInformations()
 {
     // if combinations
     if ((int) $this->id_product_attribute > 0) {
         $query = new DbQuery();
         $query->select('reference, ean13, upc');
         $query->from('product_attribute');
         $query->where('id_product = ' . (int) $this->id_product);
         $query->where('id_product_attribute = ' . (int) $this->id_product_attribute);
         $rows = Db::getInstance()->executeS($query);
         if (!is_array($rows)) {
             return;
         }
         foreach ($rows as $row) {
             $this->reference = $row['reference'];
             $this->ean13 = $row['ean13'];
             $this->upc = $row['upc'];
         }
     } else {
         $product = new Product((int) $this->id_product);
         if (Validate::isLoadedObject($product)) {
             $this->reference = $product->reference;
             $this->ean13 = $product->ean13;
             $this->upc = $product->upc;
         }
     }
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:31,代码来源:Stock.php


示例2: renderView

    public function renderView()
    {
        $badges_feature = new Collection('badge', $this->context->language->id);
        $badges_feature->where('type', '=', 'feature');
        $badges_feature->orderBy('id_group');
        $badges_feature->orderBy('group_position');
        $badges_achievement = new Collection('badge', $this->context->language->id);
        $badges_achievement->where('type', '=', 'achievement');
        $badges_achievement->orderBy('id_group');
        $badges_achievement->orderBy('group_position');
        $badges_international = new Collection('badge', $this->context->language->id);
        $badges_international->where('type', '=', 'international');
        $badges_international->orderBy('id_group');
        $badges_international->orderBy('group_position');
        $groups = array();
        $query = new DbQuery();
        $query->select('DISTINCT(b.`id_group`), bl.group_name, b.type');
        $query->from('badge', 'b');
        $query->join('
			LEFT JOIN `' . _DB_PREFIX_ . 'badge_lang` bl ON bl.`id_badge` = b.`id_badge`');
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
        foreach ($result as $res) {
            $groups['badges_' . $res['type']][$res['id_group']] = $res['group_name'];
        }
        $badges_type = array('badges_feature' => array('name' => $this->l('Features'), 'badges' => $badges_feature), 'badges_achievement' => array('name' => $this->l('Achievements'), 'badges' => $badges_achievement), 'badges_international' => array('name' => $this->l('International'), 'badges' => $badges_international));
        $levels = array(1 => $this->l('1. Beginner'), 2 => $this->l('2. Pro'), 3 => $this->l('3. Expert'), 4 => $this->l('4. Wizard'), 5 => $this->l('5. Guru'), 6 => $this->l('6. Legend'));
        $this->tpl_view_vars = array('badges_type' => $badges_type, 'current_level_percent' => (int) Configuration::get('GF_CURRENT_LEVEL_PERCENT'), 'current_level' => (int) Configuration::get('GF_CURRENT_LEVEL'), 'groups' => $groups, 'levels' => $levels);
        return parent::renderView();
    }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:29,代码来源:AdminGamificationController.php


示例3: getStockValue

 public function getStockValue()
 {
     $query = new DbQuery();
     $query->select('SUM(s.`price_te` * (s.`physical_quantity`+s.`physical_quantity_remainder`)');
     $query->from('stock', 's');
     $query->where('s.`id_warehouse` = ' . (int) $this->id);
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:8,代码来源:Warehouse.php


示例4: getErpAssociation

 /**
  * Returns id_erpip_supply_order_receipt_history for a given id_supply_order_receipt_history
  * @param int $id_supply_order_receipt_history
  * @return int $id_erpip_supply_order_receipt_history
  */
 public static function getErpAssociation($id_supply_order_receipt_history)
 {
     $query = new DbQuery();
     $query->select('id_erpip_supply_order_receipt_history');
     $query->from('erpip_supply_order_receipt_history');
     $query->where('id_supply_order_receipt_history = ' . (int) $id_supply_order_receipt_history);
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:13,代码来源:ErpSupplyOrderReceiptHistory.php


示例5: getErpSupplierIdBySupplierId

 /**
  * Returns id_erpip_supplier for a given id_supplier
  * @param int $id_supplier
  * @return int $id_erpip_supplier
  */
 public static function getErpSupplierIdBySupplierId($id_supplier)
 {
     $query = new DbQuery();
     $query->select('id_erpip_supplier');
     $query->from('erpip_supplier');
     $query->where('id_supplier = ' . (int) $id_supplier);
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:13,代码来源:ErpSupplier.php


示例6: getLastId

 public function getLastId()
 {
     // build query
     $query = new DbQuery();
     $query->select('id_stock_image');
     $query->from('stock_image', 'si');
     $query->orderBy('id_stock_image DESC');
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:9,代码来源:StockImage.php


示例7: getNextBadgeId

 public function getNextBadgeId()
 {
     $query = new DbQuery();
     $query->select('b.`id_badge`');
     $query->from('badge', 'b');
     $query->where('b.id_group = \'' . pSQL($this->id_group) . '\' AND b.validated = 0');
     $query->orderBy('b.group_position');
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:9,代码来源:Badge.php


示例8: exists

 /**
  * For a given id_stock_mvt_reason, tells if it exists
  *
  * @since 1.5.0
  * @param int $id_stock_mvt_reason
  * @return bool
  */
 public static function exists($id_stock_mvt_reason)
 {
     $query = new DbQuery();
     $query->select('smr.id_stock_mvt_reason');
     $query->from('stock_mvt_reason', 'smr');
     $query->where('smr.id_stock_mvt_reason = ' . (int) $id_stock_mvt_reason);
     $query->where('smr.deleted = 0');
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:16,代码来源:StockMvtReason.php


示例9: getFieldsValues

 private function getFieldsValues()
 {
     $sql = new DbQuery();
     $sql->select('*');
     $sql->from('expressmailing_fax');
     $sql->where('campaign_id = ' . $this->campaign_id);
     $result = Db::getInstance()->getRow($sql);
     $this->campaign_api_message_id = $result['campaign_api_message_id'];
     return true;
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:10,代码来源:adminmarketingfstep7.php


示例10: getImageContentIdsByIdImage

 public static function getImageContentIdsByIdImage($id_image)
 {
     // build query
     $query = new DbQuery();
     $query->select('id_stock_image_content');
     $query->from('stock_image_content', 'sic');
     $query->where('id_stock_image=' . (int) $id_image);
     $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
     return $result;
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:10,代码来源:StockImageContent.php


示例11: getIdByProductAndWarehouse

    /**
     * For a given product and warehouse, gets the WarehouseProductLocation corresponding ID
     *
     * @param int $id_product
     * @param int $id_product_attribute
     * @param int $id_supplier
     * @return int $id_warehouse_product_location ID of the WarehouseProductLocation
     */
    public static function getIdByProductAndWarehouse($id_product, $id_product_attribute, $id_warehouse)
    {
        // build query
        $query = new DbQuery();
        $query->select('wpl.id_warehouse_product_location');
        $query->from('warehouse_product_location', 'wpl');
        $query->where('wpl.id_product = ' . (int) $id_product . '
			AND wpl.id_product_attribute = ' . (int) $id_product_attribute . '
			AND wpl.id_warehouse = ' . (int) $id_warehouse);
        return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
    }
开发者ID:jpodracky,项目名称:dogs,代码行数:19,代码来源:WarehouseProductLocation.php


示例12: getIdBySlug

 public static function getIdBySlug($slug)
 {
     if (!Validate::isLinkRewrite($slug)) {
         return Tools::displayError('getIdBySlug - invalid slug');
     }
     $sql = new DbQuery();
     $sql->select('id_simpleblog_post_type');
     $sql->from('simpleblog_post_type', 'sbpt');
     $sql->where('slug = \'' . $slug . '\'');
     return Db::getInstance()->getValue($sql);
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:11,代码来源:SimpleBlogPostType.php


示例13: getByProductId

 public static function getByProductId($id_product)
 {
     if (!Validate::isUnsignedInt($id_product)) {
         die(Tools::displayError());
     }
     $sql = new DbQuery();
     $sql->select('id_simpleblog_post, id_product');
     $sql->from('simpleblog_related_post');
     $sql->where('id_product = ' . $id_product);
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:11,代码来源:SimpleBlogRelatedPost.php


示例14: getAssociations

 public static function getAssociations()
 {
     $query = new DbQuery();
     $query->select('name');
     $query->from('my_associations');
     $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
     /*$sql = 'SELECT name 
               FROM my_associations';
       
       $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);*/
     return $res;
 }
开发者ID:yewed,项目名称:share,代码行数:12,代码来源:Association.php


示例15: comments

 /**
  * Retrieve my comments
  * @param array $params filters (column)
  * @return array
  * @throws Exception
  */
 public function comments($params = array())
 {
     $query = new DbQuery();
     $query->select('*')->from('comment')->where('id_user = ' . (int) $this->id)->orderBy('date_add DESC');
     if (isset($params['username'])) {
         $query->where('username = "' . pSQL($params['username']) . '"');
     }
     $results = Db::getInstance()->ExecuteS($query);
     if (!Validate::isNonEmptyArray($results)) {
         return array();
     }
     return ObjectModel::hydrateCollection('Comment', $results);
 }
开发者ID:jessylenne,项目名称:sf2-technical-test,代码行数:19,代码来源:User.php


示例16: deleteByIds

 public static function deleteByIds($ids)
 {
     foreach ($ids as $id) {
         $query = new DbQuery();
         $query->delete('stock_mvt_reason_lang', 'id_stock_mvt_reason = "' . pSQL($id['id_stock_mvt_reason']) . '"');
         Db::getInstance(_PS_USE_SQL_SLAVE_)->execute($query);
         $query = null;
         $query = new DbQuery();
         $query->delete('stock_mvt_reason', 'id_stock_mvt_reason = "' . pSQL($id['id_stock_mvt_reason']) . '"');
         Db::getInstance(_PS_USE_SQL_SLAVE_)->execute($query);
     }
     return true;
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:13,代码来源:ErpStockMvtReason.php


示例17: delete

 /**
  * @see ObjectModel::delete()
  */
 public function delete()
 {
     @unlink(_PS_DOWNLOAD_DIR_ . $this->file);
     $sql = new DbQuery();
     $sql->select('pa.`id_product`');
     $sql->from('product_attachment', 'pa');
     $sql->where('pa.`id_attachment` = ' . (int) $this->id);
     $products = Db::getInstance()->executeS($sql);
     Db::getInstance()->delete('product_attachment', '`id_attachment` = ' . (int) $this->id);
     foreach ($products as $product) {
         Product::updateCacheAttachment((int) $product['id_product']);
     }
     return parent::delete();
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:17,代码来源:Attachment.php


示例18: getFieldsValues

 private function getFieldsValues()
 {
     $sql = new DbQuery();
     $sql->select('*');
     $sql->from('expressmailing_sms');
     $sql->where('campaign_id = ' . $this->campaign_id);
     $result = Db::getInstance()->getRow($sql);
     $file_copy = $result['path_to_import'];
     $preview = array();
     $preview = EMTools::getCSVPreview($file_copy);
     $this->context->smarty->assign('preview', $preview);
     $this->context->smarty->assign('campaign_id', $this->campaign_id);
     $this->context->smarty->assign('next_page', 'AdminMarketingSStep2');
     $this->context->smarty->assign('prev_page', 'AdminMarketingSStep2');
     return true;
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:16,代码来源:adminmarketingsstep3.php


示例19: getUrlsSharedCart

 public function getUrlsSharedCart()
 {
     if (!$this->getGroup()->share_order) {
         return false;
     }
     $query = new DbQuery();
     $query->select('domain');
     $query->from('shop_url');
     $query->where('active = 1');
     $query .= $this->addSqlRestriction(Shop::SHARE_ORDER);
     $domains = array();
     foreach (Db::getInstance()->executeS($query) as $row) {
         $domains[] = $row['domain'];
     }
     return $domains;
 }
开发者ID:evgrishin,项目名称:mh16014,代码行数:16,代码来源:Shop.php


示例20: getResponseByQuestion

 public static function getResponseByQuestion($id_question)
 {
     $query = new DbQuery();
     $query->from('lgconsultas_respuestas');
     $query->where('id_consulta = ' . (int) $id_question);
     $row = DB::getInstance()->executeS($query);
     if ($row) {
         $rows = ObjectModel::hydrateCollection('LGRespuesta', $row);
         $object = array_pop($rows);
     } else {
         $object = new LGRespuesta();
         $object->id_consulta = (int) $id_question;
         $object->id_employee = (int) 0;
         $object->respuesta = '';
         $object->date_add = '';
     }
     return $object;
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:18,代码来源:LGRespuesta.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DbSimple_Generic类代码示例发布时间:2022-05-23
下一篇:
PHP DbManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap