adodb-postgres8.inc.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. @version v5.20.17 31-Mar-2020
  4. @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
  5. @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
  6. Released under both BSD license and Lesser GPL library license.
  7. Whenever there is any discrepancy between the two licenses,
  8. the BSD license will take precedence.
  9. Set tabs to 4.
  10. Postgres8 support.
  11. */
  12. // security - hide paths
  13. if (!defined('ADODB_DIR')) die();
  14. include_once(ADODB_DIR."/drivers/adodb-postgres7.inc.php");
  15. class ADODB_postgres8 extends ADODB_postgres7
  16. {
  17. var $databaseType = 'postgres8';
  18. // From PostgreSQL 8.0 onwards, the adsrc column used in earlier versions to
  19. // retrieve the default value is obsolete and should not be used (see #562).
  20. var $metaDefaultsSQL = "SELECT d.adnum as num, pg_get_expr(d.adbin, d.adrelid) as def
  21. FROM pg_attrdef d, pg_class c
  22. WHERE d.adrelid=c.oid AND c.relname='%s'
  23. ORDER BY d.adnum";
  24. /**
  25. * Retrieve last inserted ID
  26. * Don't use OIDs, since as per {@link http://php.net/function.pg-last-oid php manual }
  27. * they won't be there in Postgres 8.1
  28. * (and they're not what the application wants back, anyway).
  29. * @param string $table
  30. * @param string $column
  31. * @return int last inserted ID for given table/column, or the most recently
  32. * returned one if $table or $column are empty
  33. */
  34. function _insertid($table, $column)
  35. {
  36. return empty($table) || empty($column)
  37. ? $this->GetOne("SELECT lastval()")
  38. : $this->GetOne("SELECT currval(pg_get_serial_sequence('$table', '$column'))");
  39. }
  40. }
  41. class ADORecordSet_postgres8 extends ADORecordSet_postgres7
  42. {
  43. var $databaseType = "postgres8";
  44. }
  45. class ADORecordSet_assoc_postgres8 extends ADORecordSet_assoc_postgres7
  46. {
  47. var $databaseType = "postgres8";
  48. }