adapteroci8.php 828 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 AdapterOCI8 extends Adapter {
  10. public function lastInsertId($table) {
  11. if($table !== null) {
  12. $suffix = '_SEQ';
  13. $table = '"'.$table.$suffix.'"';
  14. }
  15. return $this->conn->realLastInsertId($table);
  16. }
  17. const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400";
  18. public function fixupStatement($statement) {
  19. $statement = str_replace( '`', '"', $statement );
  20. $statement = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $statement );
  21. $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement );
  22. return $statement;
  23. }
  24. }