adaptersqlsrv.php 697 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OC\DB;
  9. class AdapterSQLSrv extends Adapter {
  10. public function fixupStatement($statement) {
  11. $statement = preg_replace( "/\`(.*?)`/", "[$1]", $statement );
  12. $statement = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $statement );
  13. $statement = str_replace( 'LENGTH(', 'LEN(', $statement );
  14. $statement = str_replace( 'SUBSTR(', 'SUBSTRING(', $statement );
  15. $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'DATEDIFF(second,{d \'1970-01-01\'},GETDATE())', $statement );
  16. return $statement;
  17. }
  18. }