Changeset 21710 for branches/version-2_12-dev/data
- Timestamp:
- 2012/04/04 05:39:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_Query.php
r21677 r21710 150 150 * SELECT文を実行する. 151 151 * 152 * @param string $col カラム名. 複数カラムの場合はカンマ区切りで書く153 * @param string $ tableテーブル名152 * @param string $cols カラム名. 複数カラムの場合はカンマ区切りで書く 153 * @param string $from テーブル名 154 154 * @param string $where WHERE句 155 155 * @param array $arrWhereVal プレースホルダ … … 157 157 * @return array|null 158 158 */ 159 function select($col , $table, $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) {160 $sqlse = $this->getSql($col , $table, $where, $arrWhereVal);159 function select($cols, $from = '', $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) { 160 $sqlse = $this->getSql($cols, $from, $where, $arrWhereVal); 161 161 return $this->getAll($sqlse, $arrWhereVal, $fetchmode); 162 162 } … … 294 294 * 295 295 * クラス変数から WHERE 句を組み立てる場合、$arrWhereVal を経由してプレースホルダもクラス変数のもので上書きする。 296 * @param string $col SELECT 文に含めるカラム名297 * @param string $ tableSELECT 文に含めるテーブル名296 * @param string $cols SELECT 文に含めるカラム名 297 * @param string $from SELECT 文に含めるテーブル名 298 298 * @param string $where SELECT 文に含める WHERE 句 299 299 * @param mixed $arrWhereVal プレースホルダ(参照) 300 300 * @return string 構築済みの SELECT 文 301 301 */ 302 function getSql($col, $table, $where = '', &$arrWhereVal = null) { 303 $sqlse = "SELECT $col FROM $table"; 302 function getSql($cols, $from = '', $where = '', &$arrWhereVal = null) { 303 $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 304 305 $sqlse = "SELECT $cols"; 306 307 if (strlen($from) === 0) { 308 $sqlse .= ' ' . $dbFactory->getDummyFromClauseSql(); 309 } else { 310 $sqlse .= " FROM $from"; 311 } 304 312 305 313 // 引数の$whereを優先する。 … … 617 625 * @return mixed SQL の実行結果 618 626 */ 619 function get($col, $table , $where = '', $arrWhereVal = array()) {627 function get($col, $table = '', $where = '', $arrWhereVal = array()) { 620 628 $sqlse = $this->getSql($col, $table, $where, $arrWhereVal); 621 629 // SQL文の実行 … … 664 672 * @return array array('カラム名' => '値', ...)の連想配列 665 673 */ 666 function getRow($col, $table , $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) {674 function getRow($col, $table = '', $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) { 667 675 668 676 $sql = $this->getSql($col, $table, $where, $arrWhereVal); … … 697 705 * @return array SQL の実行結果の配列 698 706 */ 699 function getCol($col, $table , $where = '', $arrWhereVal = array()) {707 function getCol($col, $table = '', $where = '', $arrWhereVal = array()) { 700 708 $sql = $this->getSql($col, $table, $where, $arrWhereVal); 701 709 $sql = $this->dbFactory->sfChangeMySQL($sql);
Note: See TracChangeset
for help on using the changeset viewer.