adapterpgsql.php 660 B

123456789101112131415161718192021222324
  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 AdapterPgSql extends Adapter {
  10. public function lastInsertId($table) {
  11. return $this->conn->fetchColumn('SELECT lastval()');
  12. }
  13. const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)';
  14. public function fixupStatement($statement) {
  15. $statement = str_replace( '`', '"', $statement );
  16. $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement );
  17. return $statement;
  18. }
  19. }