Changeset 22012 for branches/version-2_12-dev/data
- Timestamp:
- 2012/08/30 14:15:56 (12 years ago)
- Location:
- branches/version-2_12-dev/data/class
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php
r21927 r22012 985 985 $uprank = $rank + 1; 986 986 $up_id = $objQuery->get($colname, $table, $where, array($uprank)); 987 987 988 // ランク入れ替えの実行 988 $ sqlup = "UPDATE $table SET rank = ? WHERE$colname = ?";989 $where = "$colname = ?"; 989 990 if ($andwhere != '') { 990 $sqlup.= " AND $andwhere"; 991 } 992 $objQuery->exec($sqlup, array($rank + 1, $id)); 993 $objQuery->exec($sqlup, array($rank, $up_id)); 991 $where .= " AND $andwhere"; 992 } 993 994 $sqlval = array( 995 'rank' => $rank + 1, 996 ); 997 $arrWhereVal = array($id); 998 $objQuery->update($table, $sqlval, $where, $arrWhereVal); 999 1000 $sqlval = array( 1001 'rank' => $rank, 1002 ); 1003 $arrWhereVal = array($up_id); 1004 $objQuery->update($table, $sqlval, $where, $arrWhereVal); 994 1005 } 995 1006 $objQuery->commit(); … … 1024 1035 $downrank = $rank - 1; 1025 1036 $down_id = $objQuery->get($colname, $table, $where, array($downrank)); 1037 1026 1038 // ランク入れ替えの実行 1027 $ sqlup = "UPDATE $table SET rank = ? WHERE$colname = ?";1039 $where = "$colname = ?"; 1028 1040 if ($andwhere != '') { 1029 $sqlup.= " AND $andwhere"; 1030 } 1031 $objQuery->exec($sqlup, array($rank - 1, $id)); 1032 $objQuery->exec($sqlup, array($rank, $down_id)); 1041 $where .= " AND $andwhere"; 1042 } 1043 1044 $sqlval = array( 1045 'rank' => $rank - 1, 1046 ); 1047 $arrWhereVal = array($id); 1048 $objQuery->update($table, $sqlval, $where, $arrWhereVal); 1049 1050 $sqlval = array( 1051 'rank' => $rank, 1052 ); 1053 $arrWhereVal = array($down_id); 1054 $objQuery->update($table, $sqlval, $where, $arrWhereVal); 1033 1055 } 1034 1056 $objQuery->commit(); … … 1078 1100 1079 1101 // 指定した順位の商品から移動させる商品までのrankを1つずらす 1080 $sql = "UPDATE $tableName SET rank = $term WHERE rank BETWEEN ? AND ?"; 1102 $sqlval = array(); 1103 $arrRawSql = array( 1104 'rank' => $term, 1105 ); 1106 $str_where = 'rank BETWEEN ? AND ?'; 1081 1107 if ($where != '') { 1082 $sql.= " AND $where"; 1083 } 1084 1085 if ($position > $rank) $objQuery->exec($sql, array($rank + 1, $position)); 1086 if ($position < $rank) $objQuery->exec($sql, array($position, $rank - 1)); 1108 $str_where .= " AND $where"; 1109 } 1110 1111 if ($position > $rank) { 1112 $arrWhereVal = array($rank + 1, $position); 1113 $objQuery->update($tableName, $sqlval, $str_where, $arrWhereVal, $arrRawSql); 1114 } 1115 if ($position < $rank) { 1116 $arrWhereVal = array($position, $rank - 1); 1117 $objQuery->update($tableName, $sqlval, $str_where, $arrWhereVal, $arrRawSql); 1118 } 1087 1119 1088 1120 // 指定した順位へrankを書き換える。 1089 $sql = "UPDATE $tableName SET rank = ? WHERE $keyIdColumn = ? "; 1121 $sqlval = array( 1122 'rank' => $position, 1123 ); 1124 $str_where = "$keyIdColumn = ?"; 1090 1125 if ($where != '') { 1091 $sql.= " AND $where"; 1092 } 1093 1094 $objQuery->exec($sql, array($position, $keyId)); 1126 $str_where .= " AND $where"; 1127 } 1128 $arrWhereVal = array($keyId); 1129 $objQuery->update($tableName, $sqlval, $str_where, $arrWhereVal); 1130 1095 1131 $objQuery->commit(); 1096 1132 } … … 1122 1158 if (!$delete) { 1123 1159 // ランクを最下位にする、DELフラグON 1124 $sqlup = "UPDATE $table SET rank = 0, del_flg = 1 "; 1125 $sqlup.= "WHERE $colname = ?"; 1126 // UPDATEの実行 1127 $objQuery->exec($sqlup, array($id)); 1160 $sqlval = array( 1161 'rank' => 0, 1162 'del_flg' => 1, 1163 ); 1164 $where = "$colname = ?"; 1165 $arrWhereVal = array($id); 1166 $objQuery->update($table, $sqlval, $where, $arrWhereVal); 1128 1167 } else { 1129 1168 $objQuery->delete($table, "$colname = ?", array($id)); … … 1131 1170 1132 1171 // 追加レコードのランクより上のレコードを一つずらす。 1172 $sqlval = array(); 1133 1173 $where = 'rank > ?'; 1134 1174 if ($andwhere != '') { 1135 $where.= " AND $andwhere"; 1136 } 1137 $sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where"; 1138 $objQuery->exec($sqlup, array($rank)); 1175 $where .= " AND $andwhere"; 1176 } 1177 $arrWhereVal = array($rank); 1178 $arrRawSql = array( 1179 'rank' => '(rank - 1)', 1180 ); 1181 $objQuery->update($table, $sqlval, $where, $arrWhereVal, $arrRawSql); 1182 1139 1183 $objQuery->commit(); 1140 1184 } … … 1170 1214 /** 1171 1215 * カテゴリ変更時の移動処理を行う. 1216 * 1217 * ※この関数って、どこからも呼ばれていないのでは?? 1172 1218 * 1173 1219 * @param SC_Query $objQuery SC_Query インスタンス … … 1186 1232 // 旧カテゴリでのランク削除処理 1187 1233 // 移動レコードのランクを取得する。 1234 $sqlval = array(); 1188 1235 $where = "$id_name = ?"; 1189 1236 $rank = $objQuery->get('rank', $table, $where, array($id)); 1190 1237 // 削除レコードのランクより上のレコードを一つ下にずらす。 1191 1238 $where = "rank > ? AND $cat_name = ?"; 1192 $sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where"; 1193 $objQuery->exec($sqlup, array($rank, $old_catid)); 1239 $arrWhereVal = array($rank, $old_catid); 1240 $arrRawSql = array( 1241 'rank' => '(rank - 1)', 1242 ); 1243 $objQuery->update($table, $sqlval, $where, $arrWhereVal, $arrRawSql); 1244 1194 1245 // 新カテゴリでの登録処理 1195 1246 // 新カテゴリの最大ランクを取得する。 1196 1247 $max_rank = $objQuery->max('rank', $table, "$cat_name = ?", array($new_catid)) + 1; 1248 $sqlval = array( 1249 'rank' => $max_rank, 1250 ); 1197 1251 $where = "$id_name = ?"; 1198 $ sqlup = "UPDATE $table SET rank = ? WHERE $where";1199 $objQuery-> exec($sqlup, array($max_rank, $id));1252 $arrWhereVal = array($id); 1253 $objQuery->update($table, $sqlval, $where, $arrWhereVal); 1200 1254 } 1201 1255 -
branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Seo.php
r21867 r22012 144 144 function lfUpdPageData($arrUpdData = array()) { 145 145 $objQuery =& SC_Query_Ex::getSingletonInstance(); 146 $sql = ''; 147 148 // SQL生成 149 $sql .= ' UPDATE '; 150 $sql .= ' dtb_pagelayout '; 151 $sql .= ' SET '; 152 $sql .= ' author = ? , '; 153 $sql .= ' description = ? , '; 154 $sql .= ' keyword = ? '; 155 $sql .= ' WHERE '; 156 $sql .= ' device_type_id = ? '; 157 $sql .= ' AND page_id = ? '; 158 $sql .= ' '; 159 160 // SQL実行 161 $ret = $objQuery->query($sql, $arrUpdData); 162 163 return $ret; 146 147 $table = 'dtb_pagelayout'; 148 $sqlval = array( 149 'author' => $arrUpdData[0], 150 'description' => $arrUpdData[1], 151 'keyword' => $arrUpdData[2], 152 ); 153 $where = 'device_type_id = ? AND page_id = ?'; 154 $arrWhereVal = array( 155 $arrUpdData[3], 156 $arrUpdData[4], 157 ); 158 159 return $objQuery->update($table, $sqlval, $where, $arrWhereVal); 164 160 } 165 161 -
branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
r21867 r22012 469 469 $rank = $objQuery->get('rank', 'dtb_category', $where, array($parent_category_id)); 470 470 // 追加レコードのランク以上のレコードを一つあげる。 471 $sqlup = 'UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?'; 472 $objQuery->exec($sqlup, array($rank)); 471 $where = 'rank >= ?'; 472 $arrRawSql = array( 473 'rank' => '(rank + 1)', 474 ); 475 $objQuery->update('dtb_category', array(), $where, array($rank), $arrRawSql); 473 476 } 474 477 … … 564 567 $arrRet = $objDb->sfGetChildrenArray($table, $pid_name, $id_name, $id); 565 568 $line = SC_Utils_Ex::sfGetCommaList($arrRet); 566 $sql = "UPDATE $table SET rank = (rank + $count) WHERE $id_name IN ($line) "; 567 $sql.= 'AND del_flg = 0'; 568 $ret = $objQuery->exec($sql); 569 return $ret; 569 $where = "$id_name IN ($line) AND del_flg = 0"; 570 $arrRawVal = array( 571 'rank' => "(rank + $count)", 572 ); 573 return $objQuery->update($table, array(), $where, array(), $arrRawVal); 570 574 } 571 575 … … 575 579 $arrRet = $objDb->sfGetChildrenArray($table, $pid_name, $id_name, $id); 576 580 $line = SC_Utils_Ex::sfGetCommaList($arrRet); 577 $sql = "UPDATE $table SET rank = (rank - $count) WHERE $id_name IN ($line) "; 578 $sql.= 'AND del_flg = 0'; 579 $ret = $objQuery->exec($sql); 580 return $ret; 581 $where = "$id_name IN ($line) AND del_flg = 0"; 582 $arrRawVal = array( 583 'rank' => "(rank - $count)", 584 ); 585 return $objQuery->update($table, array(), $where, array(), $arrRawVal); 581 586 } 582 587 } -
branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php
r21867 r22012 528 528 $rank = $objQuery->get('rank', 'dtb_category', $where, array($parent_category_id)); 529 529 // 追加レコードのランク以上のレコードを一つあげる。 530 $sqlup = 'UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?'; 531 $objQuery->exec($sqlup, array($rank)); 530 $where = 'rank >= ?'; 531 $arrRawSql = array( 532 'rank' => '(rank + 1)', 533 ); 534 $objQuery->update('dtb_category', array(), $where, array($rank), $arrRawSql); 532 535 } 533 536
Note: See TracChangeset
for help on using the changeset viewer.