aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba/dba_driver.php
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-09-26 18:17:38 -0700
committerredmatrix <mike@macgirvin.com>2016-09-26 18:17:38 -0700
commit4663278f52fd11c1014d13151af2bc6ef1392c7d (patch)
tree5ea36ed7db723a1d0abfd99c5e7d21f9e72cf12a /include/dba/dba_driver.php
parent5716556766eb4e329f0c6c1bc899a7621cbcd5a5 (diff)
parentcacdac16aa104eb1308f69f24fef31f682934fca (diff)
downloadvolse-hubzilla-4663278f52fd11c1014d13151af2bc6ef1392c7d.tar.gz
volse-hubzilla-4663278f52fd11c1014d13151af2bc6ef1392c7d.tar.bz2
volse-hubzilla-4663278f52fd11c1014d13151af2bc6ef1392c7d.zip
Merge branch 'nulldate' into dev
Diffstat (limited to 'include/dba/dba_driver.php')
-rwxr-xr-xinclude/dba/dba_driver.php18
1 files changed, 6 insertions, 12 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 7225a9be2..2cbdd529d 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -86,7 +86,7 @@ class DBA {
abstract class dba_driver {
// legacy behavior
const INSTALL_SCRIPT='install/schema_mysql.sql';
- const NULL_DATE = '0000-00-00 00:00:00';
+ const NULL_DATE = '0001-01-01 00:00:00';
const UTC_NOW = 'UTC_TIMESTAMP()';
protected $db;
@@ -276,12 +276,9 @@ function dbunescbin($str) {
}
function dbescdate($date) {
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES && $date == '0000-00-00 00:00:00') {
- $date = NULL_DATE;
- } else if(ACTIVE_DBTYPE != DBTYPE_POSTGRES && $date == '0001-01-01 00:00:00') {
- $date = NULL_DATE;
- }
- return $date;
+ if(is_null_date($date))
+ return $dba->escape(NULL_DATE);
+ return $dba->escape($date);
}
function db_quoteinterval($txt) {
@@ -376,11 +373,8 @@ function dbq($sql) {
function dbesc_array_cb(&$item, $key) {
if(is_string($item)) {
- if($item == '0000-00-00 00:00:00' && ACTIVE_DBTYPE == DBTYPE_POSTGRES)
- $item = '0001-01-01 00:00:00';
- else if($item == '0001-01-01 00:00:00' && ACTIVE_DBTYPE == DBTYPE_MYSQL)
- $item = '0000-00-00 00:00:00';
-
+ if(is_null_date($item))
+ $item = NULL_DATE;
$item = dbesc($item);
}
}