/** * Execute insert sentence. * It fails, when conditions are not specified. * * @return boolean */ public function execute() { $res = parent::execute(); if ($res === false) { return false; } $res = $this->_adapter->lastInsertId(); return $res; }
/** * Execute query and return all result rows * * @return array Rows as query result */ public function fetchAll() { parent::execute(); $rows = $this->_statement->fetchAll(PDO::FETCH_ASSOC); if ($rows === false) { return false; } $ret = array(); if ($this->_resultKeyField == null) { $ret = $rows; } else { foreach ($rows as $row) { $key = $row[$this->_resultKeyField]; $ret[$key] = $row; } } return $ret; }
/** * Set whether to create prepared statement or not, when you run sql repeatedly * * @param boolean $enabled * @return void */ public static function enablePreparing($enabled) { self::$_preparing = $enabled; }