adaptersqlsrv.php 868 B

1234567891011121314151617181920212223242526272829
  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 lastInsertId($table) {
  11. if($table !== null) {
  12. $table = $this->conn->replaceTablePrefix( $table );
  13. }
  14. return $this->conn->lastInsertId($table);
  15. }
  16. public function fixupStatement($statement) {
  17. $statement = preg_replace( "/\`(.*?)`/", "[$1]", $statement );
  18. $statement = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $statement );
  19. $statement = str_replace( 'LENGTH(', 'LEN(', $statement );
  20. $statement = str_replace( 'SUBSTR(', 'SUBSTRING(', $statement );
  21. $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'DATEDIFF(second,{d \'1970-01-01\'},GETDATE())', $statement );
  22. return $statement;
  23. }
  24. }