mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
add getCurrentDatetime() and getCurrentTimestamp()
getCurrentTimestamp() used return the sql statement for a datetime
This commit is contained in:
parent
94dbfdfd15
commit
4ffa4399a2
|
@ -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
|
||||
*/
|
||||
function getCurrentTimestamp() { /* {{{ */
|
||||
function getCurrentDatetime() { /* {{{ */
|
||||
switch($this->_driver) {
|
||||
case 'mysql':
|
||||
return "CURRENT_TIMESTAMP";
|
||||
|
@ -471,6 +472,22 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
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 '';
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user