Changeset 21441 for branches/version-2_12-dev/data/class/SC_Query.php
- Timestamp:
- 2012/02/06 11:05:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_Query.php
r21430 r21441 58 58 // 常時ONにするとメモリが解放されない。 59 59 // 連続クエリ実行時に問題が生じる。 60 if (DEBUG_MODE) {60 if (DEBUG_MODE) { 61 61 $options['debug'] = PEAR_DB_DEBUG; 62 62 } else { … … 112 112 */ 113 113 function isError() { 114 if (PEAR::isError($this->conn)) {114 if (PEAR::isError($this->conn)) { 115 115 return true; 116 116 } … … 247 247 } 248 248 249 while ($data = $affected->fetchRow($fetchmode)) {249 while ($data = $affected->fetchRow($fetchmode)) { 250 250 $result = call_user_func($cbFunc, $data); 251 if ($result === false) {251 if ($result === false) { 252 252 break; 253 253 } … … 342 342 */ 343 343 function setLimitOffset($limit, $offset = 0) { 344 if (is_numeric($limit) && is_numeric($offset)) {344 if (is_numeric($limit) && is_numeric($offset)) { 345 345 346 346 $option = " LIMIT " . $limit; … … 377 377 */ 378 378 function andWhere($str) { 379 if ($this->where != "") {379 if ($this->where != "") { 380 380 $this->where .= " AND " . $str; 381 381 } else { … … 394 394 */ 395 395 function orWhere($str) { 396 if ($this->where != "") {396 if ($this->where != "") { 397 397 $this->where .= " OR " . $str; 398 398 } else { … … 443 443 */ 444 444 function setLimit($limit){ 445 if ( is_numeric($limit)){445 if (is_numeric($limit)) { 446 446 $this->option = " LIMIT " .$limit; 447 447 } … … 458 458 */ 459 459 function setOffset($offset) { 460 if ( is_numeric($offset)){460 if (is_numeric($offset)) { 461 461 $this->offset = " OFFSET " .$offset; 462 462 } … … 482 482 foreach ($sqlval as $key => $val) { 483 483 $strcol .= $key . ','; 484 if (strcasecmp("Now()", $val) === 0) {484 if (strcasecmp("Now()", $val) === 0) { 485 485 $strval .= 'Now(),'; 486 } else if (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) {486 } else if (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) { 487 487 $strval .= 'CURRENT_TIMESTAMP,'; 488 488 } else { … … 493 493 } 494 494 495 foreach ($arrSql as $key => $val) {495 foreach ($arrSql as $key => $val) { 496 496 $strcol .= $key . ','; 497 497 $strval .= $val . ','; … … 500 500 $arrVal = array_merge($arrVal, $arrSqlVal); 501 501 502 if (!$find) {502 if (!$find) { 503 503 return false; 504 504 } … … 532 532 if (strcasecmp("Now()", $val) === 0) { 533 533 $arrCol[] = $key . '= Now()'; 534 } else if (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) {534 } else if (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) { 535 535 $arrCol[] = $key . '= CURRENT_TIMESTAMP'; 536 536 } else { … … 542 542 543 543 if ($arrRawSql != "") { 544 foreach ($arrRawSql as $key => $val) {544 foreach ($arrRawSql as $key => $val) { 545 545 $arrCol[] = "$key = $val"; 546 546 } … … 719 719 */ 720 720 function delete($table, $where = "", $arrval = array()) { 721 if (strlen($where) <= 0) {721 if (strlen($where) <= 0) { 722 722 $sqlde = "DELETE FROM $table"; 723 723 } else { … … 939 939 940 940 // 一定以上時間かかったSQLの場合、ログ出力する。 941 if (defined('SQL_QUERY_LOG_MODE') && SQL_QUERY_LOG_MODE == true) {941 if (defined('SQL_QUERY_LOG_MODE') && SQL_QUERY_LOG_MODE == true) { 942 942 $timeEnd = SC_Utils_Ex::sfMicrotimeFloat();; 943 943 $timeExecTime = $timeEnd - $timeStart; 944 if (defined('SQL_QUERY_LOG_MIN_EXEC_TIME') && $timeExecTime >= (float)SQL_QUERY_LOG_MIN_EXEC_TIME) {944 if (defined('SQL_QUERY_LOG_MIN_EXEC_TIME') && $timeExecTime >= (float)SQL_QUERY_LOG_MIN_EXEC_TIME) { 945 945 $logMsg = sprintf("SQL_LOG [%.2fsec]\n%s", $timeExecTime, $sth->query) . "\n"; 946 946 error_log($logMsg, 3, LOG_REALFILE);
Note: See TracChangeset
for help on using the changeset viewer.
