- Timestamp:
- 2013/02/18 19:09:54 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php
r22487 r22567 29 29 * @version $Id:SC_Helper_DB.php 15532 2007-08-31 14:39:46Z nanasess $ 30 30 */ 31 class SC_Helper_DB { 31 class SC_Helper_DB 32 { 32 33 33 34 // {{{ properties … … 64 65 * 引数 $add == false でカラムが存在しない場合 false 65 66 */ 66 function sfColumnExists($table_name, $col_name, $col_type = '', $dsn = '', $add = false) { 67 function sfColumnExists($table_name, $col_name, $col_type = '', $dsn = '', $add = false) 68 { 67 69 $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 68 70 $dsn = $dbFactory->getDSN($dsn); … … 102 104 * $add == false で, データが存在しない場合 false 103 105 */ 104 function sfDataExists($table_name, $where, $arrWhereVal, $dsn = '', $sql = '', $add = false) { 106 function sfDataExists($table_name, $where, $arrWhereVal, $dsn = '', $sql = '', $add = false) 107 { 105 108 $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 106 109 $dsn = $dbFactory->getDSN($dsn); … … 131 134 * @return array 店舗基本情報の配列 132 135 */ 133 function sfGetBasisData($force = false, $col = '') { 136 function sfGetBasisData($force = false, $col = '') 137 { 134 138 static $data = array(); 135 139 … … 158 162 * @return array 店舗基本情報の配列 159 163 */ 160 function sfGetBasisDataCache($generate = false){ 164 function sfGetBasisDataCache($generate = false) 165 { 161 166 // テーブル名 162 167 $name = 'dtb_baseinfo'; … … 190 195 * @return bool キャッシュデータファイル生成結果 191 196 */ 192 function sfCreateBasisDataCache() { 197 function sfCreateBasisDataCache() 198 { 193 199 // テーブル名 194 200 $name = 'dtb_baseinfo'; … … 223 229 * @deprecated 224 230 */ 225 function sfGetBasisCount() { 231 function sfGetBasisCount() 232 { 226 233 $objQuery =& SC_Query_Ex::getSingletonInstance(); 227 234 … … 234 241 * @return boolean 有無 235 242 */ 236 function sfGetBasisExists() { 243 function sfGetBasisExists() 244 { 237 245 $objQuery =& SC_Query_Ex::getSingletonInstance(); 238 246 … … 241 249 242 250 /* 選択中のアイテムのルートカテゴリIDを取得する */ 243 function sfGetRootId() { 251 function sfGetRootId() 252 { 244 253 245 254 if (!$this->g_root_on) { … … 277 286 * @return array オーダー前ポイントの配列 278 287 */ 279 function sfGetRollbackPoint($order_id, $use_point, $add_point, $order_status) { 288 function sfGetRollbackPoint($order_id, $use_point, $add_point, $order_status) 289 { 280 290 $objQuery =& SC_Query_Ex::getSingletonInstance(); 281 291 $arrRet = $objQuery->select('customer_id', 'dtb_order', 'order_id = ?', array($order_id)); … … 309 319 * @return array カテゴリツリーの配列 310 320 */ 311 function sfGetCatTree($parent_category_id, $count_check = false) { 321 function sfGetCatTree($parent_category_id, $count_check = false) 322 { 312 323 $objQuery =& SC_Query_Ex::getSingletonInstance(); 313 324 $col = ''; … … 355 366 * @see sfGetCatTree() 356 367 */ 357 function findTree(&$arrTree, $parent, &$result) { 368 function findTree(&$arrTree, $parent, &$result) 369 { 358 370 if ($result[count($result) - 1]['parent_category_id'] === 0) { 359 371 return; … … 379 391 * @return array カテゴリツリーの配列 380 392 */ 381 function sfGetMultiCatTree($product_id, $count_check = false) { 393 function sfGetMultiCatTree($product_id, $count_check = false) 394 { 382 395 $objQuery =& SC_Query_Ex::getSingletonInstance(); 383 396 $col = ''; … … 427 440 * @return string 親カテゴリを連結した文字列 428 441 */ 429 function sfGetCatCombName($category_id) { 442 function sfGetCatCombName($category_id) 443 { 430 444 // 商品が属するカテゴリIDを縦に取得 431 445 $objQuery =& SC_Query_Ex::getSingletonInstance(); … … 452 466 * @return array 指定したカテゴリIDのカテゴリ 453 467 */ 454 function sfGetCat($category_id) { 468 function sfGetCat($category_id) 469 { 455 470 $objQuery =& SC_Query_Ex::getSingletonInstance(); 456 471 … … 468 483 * @return array 指定したカテゴリIDの大カテゴリ 469 484 */ 470 function sfGetFirstCat($category_id) { 485 function sfGetFirstCat($category_id) 486 { 471 487 // 商品が属するカテゴリIDを縦に取得 472 488 $objQuery =& SC_Query_Ex::getSingletonInstance(); … … 493 509 * @return array カテゴリツリーの配列 494 510 */ 495 function sfGetCategoryList($addwhere = '', $products_check = false, $head = CATEGORY_HEAD) { 511 function sfGetCategoryList($addwhere = '', $products_check = false, $head = CATEGORY_HEAD) 512 { 496 513 $objQuery =& SC_Query_Ex::getSingletonInstance(); 497 514 $where = 'del_flg = 0'; … … 532 549 * @return array カテゴリツリーの配列 533 550 */ 534 function sfGetLevelCatList($parent_zero = true) { 551 function sfGetLevelCatList($parent_zero = true) 552 { 535 553 $objQuery =& SC_Query_Ex::getSingletonInstance(); 536 554 … … 581 599 * 582 600 */ 583 function sfGetCategoryId($product_id, $category_id = 0, $closed = false) { 601 function sfGetCategoryId($product_id, $category_id = 0, $closed = false) 602 { 584 603 if ($closed) { 585 604 $status = ''; … … 608 627 * @return void 609 628 */ 610 function addProductBeforCategories($category_id, $product_id) { 629 function addProductBeforCategories($category_id, $product_id) 630 { 611 631 $objQuery =& SC_Query_Ex::getSingletonInstance(); 612 632 … … 629 649 * @return void 630 650 */ 631 function addProductAfterCategories($category_id, $product_id) { 651 function addProductAfterCategories($category_id, $product_id) 652 { 632 653 $sqlval = array('category_id' => $category_id, 633 654 'product_id' => $product_id); … … 661 682 * @return void 662 683 */ 663 function removeProductByCategories($category_id, $product_id) { 684 function removeProductByCategories($category_id, $product_id) 685 { 664 686 $objQuery =& SC_Query_Ex::getSingletonInstance(); 665 687 $objQuery->delete('dtb_product_categories', … … 674 696 * @return void 675 697 */ 676 function updateProductCategories($arrCategory_id, $product_id) { 698 function updateProductCategories($arrCategory_id, $product_id) 699 { 677 700 $objQuery =& SC_Query_Ex::getSingletonInstance(); 678 701 … … 707 730 * @return void 708 731 */ 709 function sfCountCategory($objQuery = NULL, $is_force_all_count = false) { 732 function sfCountCategory($objQuery = NULL, $is_force_all_count = false) 733 { 710 734 $objProduct = new SC_Product_Ex(); 711 735 … … 884 908 * @param array 子ID の配列 885 909 */ 886 function sfGetChildsID($table, $pid_name, $id_name, $id) { 910 function sfGetChildsID($table, $pid_name, $id_name, $id) 911 { 887 912 $arrRet = $this->sfGetChildrenArray($table, $pid_name, $id_name, $id); 888 913 return $arrRet; … … 898 923 * @return array 子IDの配列 899 924 */ 900 function sfGetChildrenArray($table, $pid_name, $id_name, $id) { 925 function sfGetChildrenArray($table, $pid_name, $id_name, $id) 926 { 901 927 $arrChildren = array(); 902 928 $arrRet = array($id); … … 919 945 * @return array 子IDの配列 920 946 */ 921 function sfGetChildrenArraySub($table, $pid_name, $id_name, $arrPID) { 947 function sfGetChildrenArraySub($table, $pid_name, $id_name, $arrPID) 948 { 922 949 $objQuery =& SC_Query_Ex::getSingletonInstance(); 923 950 … … 939 966 * @return array 親IDの配列 940 967 */ 941 function sfGetParents($table, $pid_name, $id_name, $id) { 968 function sfGetParents($table, $pid_name, $id_name, $id) 969 { 942 970 $arrRet = SC_Helper_DB_Ex::sfGetParentsArray($table, $pid_name, $id_name, $id); 943 971 return $arrRet; … … 953 981 * @return array 親IDの配列 954 982 */ 955 function sfGetParentsArray($table, $pid_name, $id_name, $id) { 983 function sfGetParentsArray($table, $pid_name, $id_name, $id) 984 { 956 985 $arrParents = array(); 957 986 $ret = $id; … … 968 997 969 998 /* 子ID所属する親IDを取得する */ 970 function sfGetParentsArraySub($table, $pid_name, $id_name, $child) { 999 function sfGetParentsArraySub($table, $pid_name, $id_name, $child) 1000 { 971 1001 if (SC_Utils_Ex::isBlank($child)) { 972 1002 return false; … … 986 1016 * @return array 商品を検索する場合の配列 987 1017 */ 988 function sfGetCatWhere($category_id) { 1018 function sfGetCatWhere($category_id) 1019 { 989 1020 // 子カテゴリIDの取得 990 1021 $arrRet = SC_Helper_DB_Ex::sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $category_id); … … 1005 1036 * @return array SELECT ボックス用リストの配列 1006 1037 */ 1007 function sfGetIDValueList($table, $keyname, $valname, $where = '', $arrVal = array()) { 1038 function sfGetIDValueList($table, $keyname, $valname, $where = '', $arrVal = array()) 1039 { 1008 1040 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1009 1041 $col = "$keyname, $valname"; … … 1030 1062 * @return void 1031 1063 */ 1032 function sfRankUp($table, $colname, $id, $andwhere = '') { 1064 function sfRankUp($table, $colname, $id, $andwhere = '') 1065 { 1033 1066 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1034 1067 $objQuery->begin(); … … 1081 1114 * @return void 1082 1115 */ 1083 function sfRankDown($table, $colname, $id, $andwhere = '') { 1116 function sfRankDown($table, $colname, $id, $andwhere = '') 1117 { 1084 1118 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1085 1119 $objQuery->begin(); … … 1132 1166 * @return void 1133 1167 */ 1134 function sfMoveRank($tableName, $keyIdColumn, $keyId, $pos, $where = '') { 1168 function sfMoveRank($tableName, $keyIdColumn, $keyId, $pos, $where = '') 1169 { 1135 1170 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1136 1171 $objQuery->begin(); … … 1259 1294 * @return array 特定のカラムの配列 1260 1295 */ 1261 function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId) { 1296 function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId) 1297 { 1262 1298 $col = $col_name; 1263 1299 $len = count($arrId); … … 1291 1327 * @return void 1292 1328 */ 1293 function sfMoveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid, $new_catid, $id) { 1329 function sfMoveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid, $new_catid, $id) 1330 { 1294 1331 if ($old_catid == $new_catid) { 1295 1332 return; … … 1330 1367 * @return bool レコードが存在する場合 true 1331 1368 */ 1332 function sfIsRecord($table, $col, $arrVal, $addwhere = '') { 1369 function sfIsRecord($table, $col, $arrVal, $addwhere = '') 1370 { 1333 1371 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1334 1372 $arrCol = preg_split('/[, ]/', $col); … … 1363 1401 * @return void 1364 1402 */ 1365 function sfCountMaker($objQuery) { 1403 function sfCountMaker($objQuery) 1404 { 1366 1405 $sql = ''; 1367 1406 … … 1387 1426 * 1388 1427 */ 1389 function sfGetMakerId($product_id, $maker_id = 0, $closed = false) { 1428 function sfGetMakerId($product_id, $maker_id = 0, $closed = false) 1429 { 1390 1430 if ($closed) { 1391 1431 $status = ''; … … 1421 1461 * @return array カテゴリツリーの配列 1422 1462 */ 1423 function sfGetMakerList($addwhere = '', $products_check = false) { 1463 function sfGetMakerList($addwhere = '', $products_check = false) 1464 { 1424 1465 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1425 1466 $where = 'del_flg = 0'; … … 1458 1499 * @return integer 税金額 1459 1500 */ 1460 function sfTax($price) { 1501 function sfTax($price) 1502 { 1461 1503 // 店舗基本情報を取得 1462 1504 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); … … 1472 1514 * @return integer 税金付与した金額 1473 1515 */ 1474 function sfCalcIncTax($price, $tax = null, $tax_rule = null) { 1516 function sfCalcIncTax($price, $tax = null, $tax_rule = null) 1517 { 1475 1518 // 店舗基本情報を取得 1476 1519 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); … … 1488 1531 * @return integer 加算ポイント 1489 1532 */ 1490 function sfGetAddPoint($totalpoint, $use_point) { 1533 function sfGetAddPoint($totalpoint, $use_point) 1534 { 1491 1535 // 店舗基本情報を取得 1492 1536 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); … … 1503 1547 * @return void 1504 1548 */ 1505 function sfExecSqlByFile($sqlFilePath) { 1549 function sfExecSqlByFile($sqlFilePath) 1550 { 1506 1551 if (file_exists($sqlFilePath)) { 1507 1552 $objQuery =& SC_Query_Ex::getSingletonInstance(); … … 1524 1569 * @return bool 商品規格が存在する場合:true, それ以外:false 1525 1570 */ 1526 function sfHasProductClass($product_id) { 1571 function sfHasProductClass($product_id) 1572 { 1527 1573 if (!SC_Utils_Ex::sfIsInt($product_id)) return false; 1528 1574 … … 1540 1586 * @return void 1541 1587 */ 1542 static function registerBasisData($arrData) { 1588 static function registerBasisData($arrData) 1589 { 1543 1590 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1544 1591
Note: See TracChangeset
for help on using the changeset viewer.