aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
committerMario <mario@mariovavti.com>2020-11-05 08:46:42 +0000
commitbafbf0416462c6f18c3fb6c8c06a063c8d6fdae6 (patch)
tree8929845be585b09d0f420621281c5531e1efad3e /include/dba
parent6f93d9848c43019d43ea76c27d42d657ba031cd7 (diff)
parentfdefa101d84dc2a9424eaedbdb003a4c30ec5d01 (diff)
downloadvolse-hubzilla-5.0.tar.gz
volse-hubzilla-5.0.tar.bz2
volse-hubzilla-5.0.zip
Merge branch '5.0RC'5.0
Diffstat (limited to 'include/dba')
-rwxr-xr-xinclude/dba/dba_driver.php4
-rwxr-xr-xinclude/dba/dba_pdo.php9
2 files changed, 13 insertions, 0 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index cfb208e2d..b96601fec 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -307,6 +307,10 @@ function db_use_index($str) {
return \DBA::$dba->use_index($str);
}
+function db_str_to_date($str) {
+ return \DBA::$dba->str_to_date($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 0279342ec..49f741601 100755
--- a/include/dba/dba_pdo.php
+++ b/include/dba/dba_pdo.php
@@ -139,6 +139,15 @@ class dba_pdo extends dba_driver {
}
}
+ function str_to_date($str) {
+ if($this->driver_dbtype === 'pgsql') {
+ return "TO_TIMESTAMP($str, 'YYYY-MM-DD HH24:MI:SS')";
+ }
+ else {
+ return "STR_TO_DATE($str, '%Y-%m-%d %H:%i:%s')";
+ }
+ }
+
function quote_interval($txt) {
if($this->driver_dbtype === 'pgsql') {
return "'$txt'";