From 8a60bb461913c59cd65bfaa28c3d40af32a59304 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Thu, 18 Jan 2018 23:46:49 +0100 Subject: Change dsn port handling in dba_pdo. --- include/dba/dba_pdo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/dba') diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index f119d8926..7b58561a7 100755 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -15,7 +15,7 @@ class dba_pdo extends dba_driver { $dsn = $server; } else { - $dsn = $this->driver_dbtype . ':host=' . $server . (intval($port) ? '' : ';port=' . $port); + $dsn = $this->driver_dbtype . ':host=' . $server . (intval($port) ? ';port=' . $port : ''); } $dsn .= ';dbname=' . $db; @@ -154,4 +154,4 @@ class dba_pdo extends dba_driver { return 'pdo'; } -} \ No newline at end of file +} -- cgit v1.2.3 From a86b260f736cd7298d5d160c658bb9405ad3f69f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 28 Jan 2018 12:09:47 +0100 Subject: query optimisations for notifications - use a specific index only --- include/dba/dba_driver.php | 4 ++++ include/dba/dba_pdo.php | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'include/dba') diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 7e925a106..deec9adfd 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -321,6 +321,10 @@ function db_concat($fld, $sep) { return \DBA::$dba->concat($fld, $sep); } +function db_use_index($str) { + return \DBA::$dba->use_index($str); +} + /** * @brief Execute a SQL query with printf style args. * diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 7b58561a7..a9d824a50 100755 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -111,6 +111,15 @@ class dba_pdo extends dba_driver { } } + function use_index($str) { + if($this->driver_dbtype === 'pgsql') { + return ''; + } + else { + return 'USE INDEX( ' . $str . ')'; + } + } + function quote_interval($txt) { if($this->driver_dbtype === 'pgsql') { return "'$txt'"; -- cgit v1.2.3