- Timestamp:
- 2012/06/20 11:57:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php
r21898 r21927 75 75 // 正常に接続されている場合 76 76 if (!$objQuery->isError()) { 77 list($db_type) = explode(':', $dsn);78 79 77 // カラムリストを取得 80 78 $columns = $objQuery->listTableFields($table_name); … … 111 109 $exists = $objQuery->exists($table_name, $where, $arrWhereVal); 112 110 113 // データを追加する 114 if (!$exists && $add) { 115 $objQuery->exec($sql); 116 } 117 return $ret; 111 // データが存在する場合 TRUE 112 if ($exists) { 113 return TRUE; 114 // $add が TRUE の場合はデータを追加する 115 } elseif ($add) { 116 return $objQuery->exec($sql); 117 // $add が FALSE で、データが存在しない場合 FALSE 118 } else { 119 return FALSE; 120 } 118 121 } 119 122 … … 129 132 */ 130 133 function sfGetBasisData($force = false, $col = '') { 131 static $data ;132 133 if ($force || !isset($data)) {134 static $data = array(); 135 136 if ($force || empty($data)) { 134 137 $objQuery =& SC_Query_Ex::getSingletonInstance(); 135 138 … … 177 180 if (!$this->g_root_on) { 178 181 $this->g_root_on = true; 179 $objQuery =& SC_Query_Ex::getSingletonInstance();180 182 181 183 if (!isset($_GET['product_id'])) $_GET['product_id'] = ''; … … 292 294 return; 293 295 } else { 294 foreach ($arrTree as $ key => $val) {296 foreach ($arrTree as $val) { 295 297 if ($val['category_id'] == $parent) { 296 298 $result[] = array( … … 367 369 368 370 // カテゴリ名称を取得する 369 foreach ($arrCatID as $ key => $val) {371 foreach ($arrCatID as $val) { 370 372 $sql = 'SELECT category_name FROM dtb_category WHERE category_id = ?'; 371 373 $arrVal = array($val); … … 448 450 449 451 $max = count($arrRet); 452 $arrList = array(); 450 453 for ($cnt = 0; $cnt < $max; $cnt++) { 451 454 $id = $arrRet[$cnt]['category_id']; … … 486 489 $max = count($arrRet); 487 490 491 $arrValue = array(); 492 $arrOutput = array(); 488 493 for ($cnt = 0; $cnt < $max; $cnt++) { 489 494 if ($parent_zero) { … … 523 528 } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_products','product_id', $product_id, $status)) { 524 529 $objQuery =& SC_Query_Ex::getSingletonInstance(); 525 $where = 'product_id = ?';526 530 $category_id = $objQuery->getCol('category_id', 'dtb_product_categories', 'product_id = ?', array($product_id)); 527 531 } else { … … 943 947 $arrList = $objQuery->select($col, $table, $where, $arrVal); 944 948 $count = count($arrList); 949 $arrRet = array(); 945 950 for ($cnt = 0; $cnt < $count; $cnt++) { 946 951 $key = $arrList[$cnt][$keyname]; … … 1278 1283 } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord('dtb_products','product_id', $product_id, $status)) { 1279 1284 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1280 $where = 'product_id = ?';1281 1285 $maker_id = $objQuery->getCol('maker_id', 'dtb_products', 'product_id = ?', array($product_id)); 1282 1286 $this->g_maker_id = $maker_id; … … 1320 1324 1321 1325 $max = count($arrRet); 1326 $arrList = array(); 1322 1327 for ($cnt = 0; $cnt < $max; $cnt++) { 1323 1328 $id = $arrRet[$cnt]['maker_id']; … … 1343 1348 /** 1344 1349 * 店舗基本情報に基づいて税金付与した金額を返す 1350 * SC_Utils_Ex::sfCalcIncTax とどちらか統一したほうが良い 1345 1351 * 1346 1352 * @param integer $price 計算対象の金額
Note: See TracChangeset
for help on using the changeset viewer.