mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Some SQLite cleanups.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@262 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
34a4490f74
commit
5f0e5a1c59
1 changed files with 102 additions and 96 deletions
|
@ -45,7 +45,7 @@ class DBO_SQLite extends DBO
|
|||
{
|
||||
|
||||
/**
|
||||
* Connects to the database using config['host'] as a filename.
|
||||
* Connects to the database using config['file'] as a filename.
|
||||
*
|
||||
* @param array $config Configuration array for connecting
|
||||
* @return mixed
|
||||
|
@ -55,15 +55,19 @@ class DBO_SQLite extends DBO
|
|||
if ($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->_conn = sqlite_open($config['host']);
|
||||
$this->_conn = sqlite_open($config['file']);
|
||||
}
|
||||
$this->connected = $this->_conn? true: false;
|
||||
|
||||
if($this->connected)
|
||||
{
|
||||
return $this->_conn;
|
||||
}
|
||||
else
|
||||
{
|
||||
die('Could not connect to DB.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects from database.
|
||||
|
@ -133,7 +137,9 @@ class DBO_SQLite extends DBO
|
|||
$cols = sqlite_fetch_column_types($table_name, $this->_conn, SQLITE_ASSOC);
|
||||
|
||||
foreach ($cols as $column => $type)
|
||||
{
|
||||
$fields[] = array('name'=>$column, 'type'=>$type);
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue