Changeset 22856 for branches/version-2_13-dev/data/class/SC_Query.php
- Timestamp:
- 2013/06/08 16:35:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/SC_Query.php
r22795 r22856 32 32 class SC_Query 33 33 { 34 35 34 var $option = ''; 36 35 var $where = ''; … … 52 51 function __construct($dsn = '', $force_run = false, $new = false) 53 52 { 54 55 53 if ($dsn == '') { 56 54 $dsn = array('phptype' => DB_TYPE, … … 127 125 return true; 128 126 } 127 129 128 return false; 130 129 } … … 156 155 $sql = "SELECT CASE WHEN EXISTS($sql_inner) THEN 1 ELSE 0 END"; 157 156 $res = $this->getOne($sql, $arrWhereVal); 157 158 158 return (bool)$res; 159 159 } … … 172 172 { 173 173 $sqlse = $this->getSql($cols, $from, $where, $arrWhereVal); 174 174 175 return $this->getAll($sqlse, $arrWhereVal, $fetchmode); 175 176 } … … 187 188 echo $sql . ";<br />\n"; 188 189 } 190 189 191 return $sql; 190 192 } … … 256 258 function doCallbackAll($cbFunc, $sql, $arrVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) 257 259 { 258 259 260 $sql = $this->dbFactory->sfChangeMySQL($sql); 260 261 … … 276 277 } 277 278 $sth->free(); 279 278 280 return $result; 279 281 } … … 289 291 function getAll($sql, $arrVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) 290 292 { 291 292 293 $sql = $this->dbFactory->sfChangeMySQL($sql); 293 294 … … 361 362 { 362 363 $this->option = $str; 364 363 365 return $this; 364 366 } … … 378 380 $this->conn->setLimit($limit, $offset); 379 381 } 382 380 383 return $this; 381 384 } … … 396 399 $this->groupby = 'GROUP BY ' . $str; 397 400 } 401 398 402 return $this; 399 403 } … … 414 418 $this->where = $str; 415 419 } 420 416 421 return $this; 417 422 } … … 432 437 $this->where = $str; 433 438 } 439 434 440 return $this; 435 441 } … … 448 454 $this->where = $where; 449 455 $this->arrWhereVal = $arrWhereVal; 456 450 457 return $this; 451 458 } … … 466 473 $this->order = 'ORDER BY ' . $str; 467 474 } 475 468 476 return $this; 469 477 } … … 482 490 $this->conn->setLimit($limit); 483 491 } 492 484 493 return $this; 485 494 } … … 498 507 $this->conn->setLimit($this->conn->limit, $offset); 499 508 } 509 500 510 return $this; 501 511 } … … 629 639 { 630 640 $ret = $this->get("MAX($col)", $table, $where, $arrWhereVal); 641 631 642 return $ret; 632 643 } … … 644 655 { 645 656 $ret = $this->get("MIN($col)", $table, $where, $arrWhereVal); 657 646 658 return $ret; 647 659 } … … 661 673 // SQL文の実行 662 674 $ret = $this->getOne($sqlse, $arrWhereVal); 675 663 676 return $ret; 664 677 } … … 673 686 function getOne($sql, $arrVal = array()) 674 687 { 675 676 688 $sql = $this->dbFactory->sfChangeMySQL($sql); 677 689 … … 707 719 function getRow($col, $table = '', $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) 708 720 { 709 710 721 $sql = $this->getSql($col, $table, $where, $arrWhereVal); 711 722 $sql = $this->dbFactory->sfChangeMySQL($sql); … … 779 790 } 780 791 $ret = $this->query($sqlde, $arrWhereVal, false, null, MDB2_PREPARE_MANIP); 792 781 793 return $ret; 782 794 } … … 825 837 $this->error("setVal -> createSequence [$seq_name] [$start]"); 826 838 } 839 827 840 return $ret; 828 841 } … … 842 855 function query($n ,$arr = array(), $ignore_err = false, $types = null, $result_types = MDB2_PREPARE_RESULT) 843 856 { 844 845 857 $n = $this->dbFactory->sfChangeMySQL($n); 846 858 … … 869 881 { 870 882 $objManager =& $this->conn->loadModule('Manager'); 883 871 884 return $objManager->listSequences(); 872 885 } … … 891 904 { 892 905 $objManager =& $this->conn->loadModule('Manager'); 906 893 907 return $objManager->listTableFields($table); 894 908 } … … 903 917 { 904 918 $objManager =& $this->conn->loadModule('Manager'); 919 905 920 return $objManager->listTableIndexes($table); 906 921 } … … 918 933 $definition = $this->dbFactory->sfGetCreateIndexDefinition($table, $name, $definition); 919 934 $objManager =& $this->conn->loadModule('Manager'); 935 920 936 return $objManager->createIndex($table, $name, $definition); 921 937 } … … 930 946 { 931 947 $objManager =& $this->conn->loadModule('Manager'); 948 932 949 return $objManager->dropIndex($table, $name); 933 950 } … … 942 959 { 943 960 $objManager =& $this->conn->loadModule('Reverse'); 961 944 962 return $objManager->tableInfo($table, NULL); 945 963 } … … 977 995 } 978 996 } 997 979 998 return $arrResults; 980 999 } … … 996 1015 $this->error($msg); 997 1016 } 1017 998 1018 return $sth; 999 1019 } … … 1009 1029 function execute(&$sth, $arrVal = array()) 1010 1030 { 1011 1012 1031 $arrStartInfo =& $this->lfStartDbTraceLog($sth, $arrVal); 1013 1032 $affected =& $sth->execute((array)$arrVal); … … 1020 1039 } 1021 1040 $this->conn->last_query = stripslashes($sth->query); 1041 1022 1042 return $affected; 1023 1043 } … … 1074 1094 function getQueryDefsFields($n ,$arr = array(), $ignore_err = false, $types = null, $result_types = MDB2_PREPARE_RESULT) 1075 1095 { 1076 1077 1096 $n = $this->dbFactory->sfChangeMySQL($n); 1078 1097 … … 1171 1190 { 1172 1191 $key_str = serialize($dsn); 1192 1173 1193 return SC_Query_Ex::$arrPoolInstance[$key_str] = $objThis; 1174 1194 }
Note: See TracChangeset
for help on using the changeset viewer.
