Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From ad1fe624b631bbdee6fbcd46f1e140010d49d79d Mon Sep 17 00:00:00 2001
- From: Andrew Fyfe <andrew@neptune-one.net>
- Date: Thu, 22 Dec 2011 22:44:44 +0000
- Subject: [PATCH 5/5] Add support for pdoSqlite to roundcube.
- Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
- ---
- program/include/rcube_mdb2.php | 32 ++++++++++++++++++++++----------
- 1 files changed, 22 insertions(+), 10 deletions(-)
- diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
- index f25acef..fb5e082 100644
- --- a/program/include/rcube_mdb2.php
- +++ b/program/include/rcube_mdb2.php
- @@ -104,7 +104,7 @@ class rcube_mdb2
- 'line' => __LINE__, 'file' => __FILE__,
- 'message' => $dbh->getUserInfo()), true, false);
- }
- - else if ($this->db_provider == 'sqlite') {
- + else if ($this->db_provider == 'sqlite' || $this->db_provider == 'pdoSqlite') {
- $dsn_array = MDB2::parseDSN($dsn);
- if (!filesize($dsn_array['database']) && !empty($this->sqlite_initials))
- $this->_sqlite_create_database($dbh, $this->sqlite_initials);
- @@ -274,7 +274,7 @@ class rcube_mdb2
- if (!$this->is_connected())
- return null;
- - if ($this->db_provider == 'sqlite')
- + if ($this->db_provider == 'sqlite' || $this->db_provider == 'pdoSqlite')
- $this->_sqlite_prepare();
- if ($numrows || $offset)
- @@ -781,14 +781,26 @@ class rcube_mdb2
- include_once(INSTALL_PATH . 'program/include/rcube_sqlite.inc');
- // we emulate via callback some missing MySQL function
- - sqlite_create_function($this->db_handle->connection,
- - 'from_unixtime', 'rcube_sqlite_from_unixtime');
- - sqlite_create_function($this->db_handle->connection,
- - 'unix_timestamp', 'rcube_sqlite_unix_timestamp');
- - sqlite_create_function($this->db_handle->connection,
- - 'now', 'rcube_sqlite_now');
- - sqlite_create_function($this->db_handle->connection,
- - 'md5', 'rcube_sqlite_md5');
- + if ($this->db_provider == 'pdoSqlite') {
- + $this->db_handle->connection->sqliteCreateFunction(
- + 'from_unixtime', 'rcube_sqlite_from_unixtime');
- + $this->db_handle->connection->sqliteCreateFunction(
- + 'unix_timestamp', 'rcube_sqlite_unix_timestamp');
- + $this->db_handle->connection->sqliteCreateFunction(
- + 'now', 'rcube_sqlite_now');
- + $this->db_handle->connection->sqliteCreateFunction(
- + 'md5', 'rcube_sqlite_md5');
- + }
- + else {
- + sqlite_create_function($this->db_handle->connection,
- + 'from_unixtime', 'rcube_sqlite_from_unixtime');
- + sqlite_create_function($this->db_handle->connection,
- + 'unix_timestamp', 'rcube_sqlite_unix_timestamp');
- + sqlite_create_function($this->db_handle->connection,
- + 'now', 'rcube_sqlite_now');
- + sqlite_create_function($this->db_handle->connection,
- + 'md5', 'rcube_sqlite_md5');
- + }
- }
- --
- 1.7.5.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement