27 #require_once 'Zend/Db/Adapter/Pdo/Abstract.php'; 87 $this->_pdoType =
'sqlite2';
91 $this->_config[
'username'] =
null;
92 $this->_config[
'password'] =
null;
94 return parent::__construct(
$config);
107 if (! array_key_exists(
'dbname',
$config)) {
109 #require_once 'Zend/Db/Adapter/Exception.php'; 110 throw new Zend_Db_Adapter_Exception(
"Configuration array must have a key for 'dbname' that names the database instance");
119 return $this->_pdoType .
':'. $this->_config[
'dbname'];
133 if ($this->_connection) {
139 $retval = $this->_connection->exec(
'PRAGMA full_column_names=0');
140 if ($retval ===
false) {
141 $error = $this->_connection->errorInfo();
143 #require_once 'Zend/Db/Adapter/Exception.php'; 147 $retval = $this->_connection->exec(
'PRAGMA short_column_names=1');
148 if ($retval ===
false) {
149 $error = $this->_connection->errorInfo();
151 #require_once 'Zend/Db/Adapter/Exception.php'; 163 $sql =
"SELECT name FROM sqlite_master WHERE type='table' " 164 .
"UNION ALL SELECT name FROM sqlite_temp_master " 165 .
"WHERE type='table' ORDER BY name";
206 $sql .=
'table_info('.$this->quoteIdentifier(
$tableName).
')';
208 $stmt = $this->
query($sql);
226 list($length, $scale, $precision, $primary, $primaryPosition, $identity) =
227 array(
null,
null,
null,
false,
null,
false);
228 if (preg_match(
'/^((?:var)?char)\((\d+)\)/i',
$row[
$type], $matches)) {
230 $length = $matches[2];
231 }
else if (preg_match(
'/^decimal\((\d+),(\d+)\)/i',
$row[
$type], $matches)) {
233 $precision = $matches[1];
234 $scale = $matches[2];
236 if ((
bool)
$row[$pk]) {
238 $primaryPosition = $p;
242 $identity = (bool) (
$row[
$type] ==
'INTEGER');
246 'SCHEMA_NAME' => $this->
foldCase($schemaName),
249 'COLUMN_POSITION' =>
$row[$cid]+1,
251 'DEFAULT' =>
$row[$dflt_value],
252 'NULLABLE' => ! (
bool)
$row[$notnull],
255 'PRECISION' => $precision,
257 'PRIMARY' => $primary,
258 'PRIMARY_POSITION' => $primaryPosition,
259 'IDENTITY' => $identity
278 #require_once 'Zend/Db/Adapter/Exception.php'; 282 $offset = intval($offset);
285 #require_once 'Zend/Db/Adapter/Exception.php'; 289 $sql .=
" LIMIT $count";
291 $sql .=
" OFFSET $offset";
309 return parent::_quote(
$value);
__construct(array $config=array())
fetchCol($sql, $bind=array())
describeTable($tableName, $schemaName=null)
_checkRequiredOptions(array $config)
limit($sql, $count, $offset=0)
quoteIdentifier($ident, $auto=false)
query($sql, $bind=array())
if(!isset($_GET['name'])) $name