示例#1
0
 /**
  * @see DB_common::getRow
  */
 public function getRow($query, $params = array(), $fetchmode = DbInterface::DB_FETCHMODE_ASSOC)
 {
     $query = $this->quoteSql($query, $params);
     $res = $this->db->getRow($query, $params, $fetchmode);
     $this->assertError($res);
     return $res;
 }
示例#2
0
 /**
  * SQL文を実行し、最初の配列データを取得する(SELECT専用)
  * ※ループ処理などでは使用しない。
  * ※SQLの解析が繰り返し行なわれるため処理が遅い。
  * (SQLの結果セットを配列データで取得したい場合に使用する)
  * ※最初の配列データを取得した後、結果セットを開放する
  * <処理内容>
  * ・SQLの解析(prepare)を行なってからSQL文を実行する
  * ・SQL文の実行エラーが発生したら、トランザクションをロールバックする
  * @access public
  * @param string $sql SQL文
  * @param array $params SQL文にセットするパラメータ
  * @param string $fetchModeフェッチモード(デフォルト:DB_FETCHMODE_ORDERED)
  *  DB_FETCHMODE_ORDERED・・・配列データをインデックス配列([0][1]…)で取得する
  *  DB_FETCHMODE_ASSOC・・・配列データを連想配列([id][name]…)で取得する
  *  DB_FETCHMODE_OBJECT・・・配列データをオブジェクト($data->id…)で取得する
  * @return array SQL文の実行結果(1レコード)
  * 		(Selectが成功した場合、1次元配列オブジェクトをセットする)
  * @throws DatabaseException SQL文の実行エラーが発生した時
  */
 function execQuerySqlRow($sql, $params = array(), $fetchMode = DB_FETCHMODE_DEFAULT)
 {
     $rs =& $this->db->getRow($sql, $params, $fetchMode);
     if (DB::isError($rs)) {
         $this->db->rollback();
         throw new DatabaseException($rs->getMessage());
     }
     return $rs;
 }
示例#3
0
 /**
  * Fetch the first row of data returned from a query.  Takes care
  * of doing the query and freeing the results when finished.
  *
  * @param $query the SQL query
  * @param $fetchmode the fetch mode to use
  * @param $data array if supplied, prepare/execute will be used
  *        with this array as execute parameters
  * @param string $action type of request to perform, defaults to search (ldap_search())
  * @param array $params array of additional parameters to pass to the PHP ldap function requested
  * @access public
  * @return array the first row of results as an array indexed from
  * 0, or a DB error code.
  * @see DB_common::getRow()
  * @access public
  */
 function &getRow($query, $data = null, $fetchmode = DB_FETCHMODE_DEFAULT, $action = null, $params = array())
 {
     $this->q_action = $action ? $action : $this->action;
     $this->q_params = $params;
     return parent::getRow($query, $data, $fetchmode);
 }