當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBFactory::getDbInfo方法代碼示例

本文整理匯總了PHP中DBFactory::getDbInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBFactory::getDbInfo方法的具體用法?PHP DBFactory::getDbInfo怎麽用?PHP DBFactory::getDbInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBFactory的用法示例。


在下文中一共展示了DBFactory::getDbInfo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * 構造方法
  * 
  * @access public
  * @param mixed $name
  * @return mixed
  */
 public function __construct($name)
 {
     $dbinfo = DBFactory::getDbInfo();
     $this->tablePre = $dbinfo['tablePre'];
     $this->table = $name;
     $this->dbo = DBFactory::getInstance();
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:14,代碼來源:query_class.php

示例2: update

 public function update()
 {
     $updateFile = Tiny::getPath('data') . 'update.php';
     $this->assign('status', '0');
     if (file_exists($updateFile)) {
         $updateInfo = (include $updateFile);
         if (isset($updateInfo['version'])) {
             $version = $updateInfo['version'];
             $versionFile = APP_CODE_ROOT . 'version.php';
             $currentVersion = (include $versionFile);
             if ($currentVersion == $version[0]) {
                 $do = Req::args('do');
                 if ($do == 'yes') {
                     $dbinfo = DBFactory::getDbInfo();
                     $this->assign('status', '1');
                     if (isset($updateInfo['sql'][$dbinfo['type']])) {
                         $sqls = $updateInfo['sql'][$dbinfo['type']];
                         $db = DBFactory::getInstance();
                         if (is_array($sqls)) {
                             foreach ($sqls as $sql) {
                                 $db->doSql($sql);
                             }
                         }
                         File::putContents($versionFile, "<?php return '{$version[1]}';?>");
                         unlink($updateFile);
                         $this->assign('info', '升級成功!');
                     } else {
                         $this->assign('info', '不支持' . $dbinfo['type'] . '數據庫類型的升級!');
                     }
                 } else {
                     $this->assign('info', '係統可從當前版本:' . $currentVersion . '升級到' . $version[1]);
                 }
             } else {
                 $this->assign('status', '-1');
                 $this->assign('info', '沒有可升級的信息!');
             }
         } else {
             $this->assign('status', '-1');
             $this->assign('info', '沒有可升級的信息!');
         }
     } else {
         $this->assign('status', '-1');
         $this->assign('info', '沒有可升級的信息!');
     }
     $this->redirect();
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:46,代碼來源:admin.php

示例3: goods_save


//.........這裏部分代碼省略.........
         //$sql = Tiny::getSqlLog(); Tiny::log(__FILE__.__LINE__."-".var_export($sql, true));
         Log::op($this->manager['id'], "修改商品", "管理員[" . $this->manager['name'] . "]:修改了商品 " . Req::args('name'));
     }
     //貨品添加處理
     $g_store_nums = $g_warning_line = $g_weight = $g_sell_price = $g_market_price = $g_cost_price = 0;
     $products = new Model("products");
     $k = 0;
     foreach ($values_dcr as $key => $value) {
         $result = $products->where("goods_id = " . $goods_id . " and specs_key = '{$key}'")->find();
         $data = array('goods_id' => $goods_id, 'pro_no' => $pro_no[$k], 'store_nums' => $store_nums[$k], 'warning_line' => $warning_line[$k], 'weight' => $weight[$k], 'sell_price' => $sell_price[$k], 'market_price' => $market_price[$k], 'cost_price' => $cost_price[$k], 'specs_key' => $key, 'spec' => serialize($value));
         $g_store_nums += $data['store_nums'];
         if ($g_warning_line == 0) {
             $g_warning_line = $data['warning_line'];
         } else {
             if ($g_warning_line > $data['warning_line']) {
                 $g_warning_line = $data['warning_line'];
             }
         }
         if ($g_weight == 0) {
             $g_weight = $data['weight'];
         } else {
             if ($g_weight < $data['weight']) {
                 $g_weight = $data['weight'];
             }
         }
         if ($g_sell_price == 0) {
             $g_sell_price = $data['sell_price'];
         } else {
             if ($g_sell_price > $data['sell_price']) {
                 $g_sell_price = $data['sell_price'];
             }
         }
         if ($g_market_price == 0) {
             $g_market_price = $data['market_price'];
         } else {
             if ($g_market_price < $data['market_price']) {
                 $g_market_price = $data['market_price'];
             }
         }
         if ($g_cost_price == 0) {
             $g_cost_price = $data['cost_price'];
         } else {
             if ($g_cost_price < $data['cost_price']) {
                 $g_cost_price = $data['cost_price'];
             }
         }
         if (!$result) {
             $products->data($data)->insert();
         } else {
             $products->data($data)->where("goods_id=" . $goods_id . " and specs_key='{$key}'")->update();
         }
         $k++;
     }
     //如果沒有規格
     if ($k == 0) {
         $g_store_nums = $store_nums;
         $g_warning_line = $warning_line;
         $g_weight = $weight;
         $g_sell_price = $sell_price;
         $g_market_price = $market_price;
         $g_cost_price = $cost_price;
         $data = array('goods_id' => $goods_id, 'pro_no' => $pro_no, 'store_nums' => $store_nums, 'warning_line' => $warning_line, 'weight' => $weight, 'sell_price' => $sell_price, 'market_price' => $market_price, 'cost_price' => $cost_price, 'specs_key' => '', 'spec' => serialize(array()));
         $result = $products->where("goods_id = " . $goods_id)->find();
         if (!$result) {
             $products->data($data)->insert();
         } else {
             $products->data($data)->where("goods_id=" . $goods_id)->update();
         }
     }
     //更新商品相關貨品的部分信息
     $goods->data(array('store_nums' => $g_store_nums, 'warning_line' => $g_warning_line, 'weight' => $g_weight, 'sell_price' => $g_sell_price, 'market_price' => $g_market_price, 'cost_price' => $g_cost_price))->where("id=" . $goods_id)->update();
     $keys = array_keys($values_dcr);
     $keys = implode("','", $keys);
     //清理多餘的貨品
     $products->where("goods_id=" . $goods_id . " and specs_key not in('{$keys}')")->delete();
     //規格與屬性表添加部分
     $spec_attr = new Model("spec_attr");
     //處理屬性部分
     $value_str = '';
     if ($attrs) {
         foreach ($attrs as $key => $attr) {
             if (is_numeric($attr)) {
                 $value_str .= "({$goods_id},{$key},{$attr}),";
             }
         }
     }
     foreach ($specs_new as $key => $spec) {
         if (isset($spec['value'])) {
             foreach ($spec['value'] as $k => $v) {
                 $value_str .= "({$goods_id},{$key},{$k}),";
             }
         }
     }
     $value_str = rtrim($value_str, ',');
     //更新商品鍵值對表
     $spec_attr->where("goods_id = " . $goods_id)->delete();
     $dbinfo = DBFactory::getDbInfo();
     $spec_attr->query("insert into {$dbinfo['tablePre']}spec_attr values {$value_str}");
     $this->redirect("goods_list");
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:101,代碼來源:goods.php

示例4: getTableName

 /**
  * get完整表名
  * @author COU
  * 2015/07/03
  * @access public
  * @param  $tableNameStr   表名後綴
  * @return tableName
  */
 public function getTableName($tableNameStr)
 {
     $db = DBFactory::getDbInfo();
     $tableName = $db['tablePre'] . "{$tableNameStr}";
     return $tableName;
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:14,代碼來源:model_class.php


注:本文中的DBFactory::getDbInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。