mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 13:42:04 +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
|
* @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 '';
|
||||||
|
} /* }}} */
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user