Changeset 17878
- Timestamp:
- 2009/03/06 20:35:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/SC_Query.php
r17641 r17878 253 253 } else { 254 254 $strval .= '?,'; 255 if($val != ""){ 256 $arrval[] = $val; 257 } else { 258 $arrval[] = NULL; 259 } 255 $arrval[] = $val; 260 256 } 261 257 $find = true; … … 271 267 // INSERT文の実行 272 268 $ret = $this->conn->query($sqlin, $arrval); 273 274 return $ret;275 }276 277 // INSERT文の生成・実行278 // $table :テーブル名279 // $sqlval :列名 => 値の格納されたハッシュ配列280 function fast_insert($table, $sqlval) {281 $strcol = '';282 $strval = '';283 $find = false;284 285 foreach ($sqlval as $key => $val) {286 $strcol .= $key . ',';287 if($val != ""){288 $eval = pg_escape_string($val);289 $strval .= "'$eval',";290 } else {291 $strval .= "NULL,";292 }293 $find = true;294 }295 if(!$find) {296 return false;297 }298 // 文末の","を削除299 $strcol = ereg_replace(",$","",$strcol);300 // 文末の","を削除301 $strval = ereg_replace(",$","",$strval);302 $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")";303 304 // INSERT文の実行305 $ret = $this->conn->query($sqlin);306 269 307 270 return $ret; … … 327 290 } else { 328 291 $strcol .= $key . '= ?,'; 329 if($val != ""){ 330 $arrval[] = $val; 331 } else { 332 $arrval[] = NULL; 333 } 292 $arrval[] = $val; 334 293 } 335 294 $find = true; … … 363 322 } 364 323 365 // INSERT文の実行324 // UPDATE文の実行 366 325 $ret = $this->conn->query($sqlup, $arrval); 367 326 return $ret;
Note: See TracChangeset
for help on using the changeset viewer.