| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcube_db_sqlite.php | |
| | | | | |
| | |
| | | * |
| | | * This is a wrapper for the PHP PDO |
| | | * |
| | | * @package Database |
| | | * @version 1.0 |
| | | * @package Database |
| | | * @version 1.0 |
| | | */ |
| | | class rcube_db_sqlite extends rcube_db |
| | | { |
| | |
| | | { |
| | | // Create database file, required by PDO to exist on connection |
| | | if (!empty($dsn['database']) && !file_exists($dsn['database'])) { |
| | | touch($dsn['database']); |
| | | $created = touch($dsn['database']); |
| | | |
| | | // File mode setting, for compat. with MDB2 |
| | | if (!empty($dsn['mode']) && $created) { |
| | | chmod($dsn['database'], octdec($dsn['mode'])); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | $data = file_get_contents(INSTALL_PATH . 'SQL/sqlite.initial.sql'); |
| | | |
| | | if (strlen($data)) { |
| | | if ($this->options['debug_mode']) { |
| | | $this::debug('INITIALIZE DATABASE'); |
| | | } |
| | | $this->debug('INITIALIZE DATABASE'); |
| | | |
| | | $q = $dbh->exec($data); |
| | | |
| | | if ($q === false) { |
| | | $error = $this->dbh->errorInfo(); |
| | | $error = $dbh->errorInfo(); |
| | | $this->db_error = true; |
| | | $this->db_error_msg = sprintf('[%s] %s', $error[1], $error[2]); |
| | | |
| | |
| | | /** |
| | | * Returns list of columns in database table |
| | | * |
| | | * @param string Table name |
| | | * @param string $table Table name |
| | | * |
| | | * @return array List of table cols |
| | | */ |