add getCurrentDatetime() and getCurrentTimestamp()

getCurrentTimestamp() used return the sql statement for a datetime
This commit is contained in:
Uwe Steinmann 2015-09-22 07:48:49 +02:00
parent 94dbfdfd15
commit 4ffa4399a2

View File

@ -455,11 +455,12 @@ class SeedDMS_Core_DatabaseAccess {
} /* }}} */ } /* }}} */
/** /**
* Return sql statement for returning the current timestamp * Return sql statement for returning the current date and time
* in format Y-m-d H:i:s
* *
* @return string sql code * @return string sql code
*/ */
function getCurrentTimestamp() { /* {{{ */ function getCurrentDatetime() { /* {{{ */
switch($this->_driver) { switch($this->_driver) {
case 'mysql': case 'mysql':
return "CURRENT_TIMESTAMP"; return "CURRENT_TIMESTAMP";
@ -471,6 +472,22 @@ class SeedDMS_Core_DatabaseAccess {
return ''; return '';
} /* }}} */ } /* }}} */
/**
* Return sql statement for returning the current timestamp
*
* @return string sql code
*/
function getCurrentTimestamp() { /* {{{ */
switch($this->_driver) {
case 'mysql':
return "UNIX_TIMESTAMP()";
break;
case 'sqlite':
return "strftime('%s', 'now', 'localtime')";
break;
}
return '';
} /* }}} */
} }
?> ?>