summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-07-17 13:18:46 +0200
committerThomas Mueller <thomas.mueller@tmit.eu>2013-07-17 13:18:46 +0200
commit24283425a6681a074ee72a61ad31b2ee45f1be7c (patch)
tree67fd1ef63e64f3c878c6bb6e9353e174086dd85f /lib/db.php
parenta3ff77156789a4eaf0e205aa93b168d399e011ac (diff)
downloadnextcloud-server-24283425a6681a074ee72a61ad31b2ee45f1be7c.tar.gz
nextcloud-server-24283425a6681a074ee72a61ad31b2ee45f1be7c.zip
fixing UNIX_TIMESTAMP() for mssql
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/db.php b/lib/db.php
index 6fec60e53ce..66627856461 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -775,10 +775,10 @@ class OC_DB {
$query = str_ireplace( 'UNIX_TIMESTAMP()', '((CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE))-TO_DATE(\'1970101000000\',\'YYYYMMDDHH24MiSS\'))*24*3600', $query );
}elseif( $type == 'mssql' ) {
$query = preg_replace( "/\`(.*?)`/", "[$1]", $query );
- $query = str_replace( 'NOW()', 'CURRENT_TIMESTAMP', $query );
- $query = str_replace( 'now()', 'CURRENT_TIMESTAMP', $query );
+ $query = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $query );
$query = str_replace( 'LENGTH(', 'LEN(', $query );
$query = str_replace( 'SUBSTR(', 'SUBSTRING(', $query );
+ $query = str_ireplace( 'UNIX_TIMESTAMP()', 'DATEDIFF(second,{d \'1970-01-01\'},GETDATE())', $query );
$query = self::fixLimitClauseForMSSQL($query);
}