- // Use persistent connections if available
- $db_options = array(
- 'persistent' => $this->db_pconn,
- 'emulate_prepared' => $this->debug_mode,
- 'debug' => $this->debug_mode,
- 'debug_handler' => 'mdb2_debug_handler',
- 'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
-
- if ($this->db_provider == 'pgsql') {
- $db_options['disable_smart_seqname'] = true;
- $db_options['seqname_format'] = '%s';
- }
-
- $dbh = MDB2::connect($dsn, $db_options);
-
- if (MDB2::isError($dbh))
- {
- $this->db_error = TRUE;
- $this->db_error_msg = $dbh->getMessage();
-
- raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__,
- 'file' => __FILE__, 'message' => $dbh->getUserInfo()), TRUE, FALSE);
- }
- else if ($this->db_provider=='sqlite')
- {
- $dsn_array = MDB2::parseDSN($dsn);
- if (!filesize($dsn_array['database']) && !empty($this->sqlite_initials))
- $this->_sqlite_create_database($dbh, $this->sqlite_initials);
- }
- else
- $dbh->setCharset('utf8');
-
- return $dbh;
- }
-
-
- /**
- * Connect to appropiate databse
- * depending on the operation
- *
- * @param string Connection mode (r|w)
- * @access public
- */
- function db_connect($mode)
+ // Use persistent connections if available
+ $db_options = array(
+ 'persistent' => $this->db_pconn,
+ 'emulate_prepared' => $this->debug_mode,
+ 'debug' => $this->debug_mode,
+ 'debug_handler' => 'mdb2_debug_handler',
+ 'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
+
+ if ($this->db_provider == 'pgsql') {
+ $db_options['disable_smart_seqname'] = true;
+ $db_options['seqname_format'] = '%s';
+ }
+
+ $dbh = MDB2::connect($dsn, $db_options);
+
+ if (MDB2::isError($dbh)) {
+ $this->db_error = true;
+ $this->db_error_msg = $dbh->getMessage();
+
+ raise_error(array('code' => 500, 'type' => 'db',
+ 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => $dbh->getUserInfo()), true, false);
+ }
+ else if ($this->db_provider == 'sqlite') {
+ $dsn_array = MDB2::parseDSN($dsn);
+ if (!filesize($dsn_array['database']) && !empty($this->sqlite_initials))
+ $this->_sqlite_create_database($dbh, $this->sqlite_initials);
+ }
+ else if ($this->db_provider!='mssql' && $this->db_provider!='sqlsrv')
+ $dbh->setCharset('utf8');
+
+ return $dbh;
+ }
+
+
+ /**
+ * Connect to appropiate database depending on the operation
+ *
+ * @param string $mode Connection mode (r|w)
+ * @access public
+ */
+ function db_connect($mode)