SHARE
TWEET

0005-Add-support-for-pdoSqlite-to-roundcube.patch

fyfe Dec 22nd, 2011 141 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From ad1fe624b631bbdee6fbcd46f1e140010d49d79d Mon Sep 17 00:00:00 2001
  2. From: Andrew Fyfe <andrew@neptune-one.net>
  3. Date: Thu, 22 Dec 2011 22:44:44 +0000
  4. Subject: [PATCH 5/5] Add support for pdoSqlite to roundcube.
  5.  
  6. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
  7. ---
  8. program/include/rcube_mdb2.php |   32 ++++++++++++++++++++++----------
  9.  1 files changed, 22 insertions(+), 10 deletions(-)
  10.  
  11. diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
  12. index f25acef..fb5e082 100644
  13. --- a/program/include/rcube_mdb2.php
  14. +++ b/program/include/rcube_mdb2.php
  15. @@ -104,7 +104,7 @@ class rcube_mdb2
  16.                  'line' => __LINE__, 'file' => __FILE__,
  17.                  'message' => $dbh->getUserInfo()), true, false);
  18.          }
  19. -        else if ($this->db_provider == 'sqlite') {
  20. +        else if ($this->db_provider == 'sqlite' || $this->db_provider == 'pdoSqlite') {
  21.              $dsn_array = MDB2::parseDSN($dsn);
  22.              if (!filesize($dsn_array['database']) && !empty($this->sqlite_initials))
  23.                  $this->_sqlite_create_database($dbh, $this->sqlite_initials);
  24. @@ -274,7 +274,7 @@ class rcube_mdb2
  25.          if (!$this->is_connected())
  26.              return null;
  27.  
  28. -        if ($this->db_provider == 'sqlite')
  29. +        if ($this->db_provider == 'sqlite' || $this->db_provider == 'pdoSqlite')
  30.              $this->_sqlite_prepare();
  31.  
  32.          if ($numrows || $offset)
  33. @@ -781,14 +781,26 @@ class rcube_mdb2
  34.          include_once(INSTALL_PATH . 'program/include/rcube_sqlite.inc');
  35.  
  36.          // we emulate via callback some missing MySQL function
  37. -        sqlite_create_function($this->db_handle->connection,
  38. -            'from_unixtime', 'rcube_sqlite_from_unixtime');
  39. -        sqlite_create_function($this->db_handle->connection,
  40. -            'unix_timestamp', 'rcube_sqlite_unix_timestamp');
  41. -        sqlite_create_function($this->db_handle->connection,
  42. -            'now', 'rcube_sqlite_now');
  43. -        sqlite_create_function($this->db_handle->connection,
  44. -            'md5', 'rcube_sqlite_md5');
  45. +        if ($this->db_provider == 'pdoSqlite') {
  46. +            $this->db_handle->connection->sqliteCreateFunction(
  47. +                'from_unixtime', 'rcube_sqlite_from_unixtime');
  48. +            $this->db_handle->connection->sqliteCreateFunction(
  49. +                'unix_timestamp', 'rcube_sqlite_unix_timestamp');
  50. +            $this->db_handle->connection->sqliteCreateFunction(
  51. +                'now', 'rcube_sqlite_now');
  52. +            $this->db_handle->connection->sqliteCreateFunction(
  53. +                'md5', 'rcube_sqlite_md5');
  54. +        }
  55. +        else {
  56. +            sqlite_create_function($this->db_handle->connection,
  57. +                'from_unixtime', 'rcube_sqlite_from_unixtime');
  58. +            sqlite_create_function($this->db_handle->connection,
  59. +                'unix_timestamp', 'rcube_sqlite_unix_timestamp');
  60. +            sqlite_create_function($this->db_handle->connection,
  61. +                'now', 'rcube_sqlite_now');
  62. +            sqlite_create_function($this->db_handle->connection,
  63. +                'md5', 'rcube_sqlite_md5');
  64. +        }
  65.      }
  66.  
  67.  
  68. --
  69. 1.7.5.4
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top