Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  /*
   3   @version   v5.20.16  12-Jan-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  
  11    Postgres8 support.
  12  */
  13  
  14  // security - hide paths
  15  if (!defined('ADODB_DIR')) die();
  16  
  17  include_once(ADODB_DIR."/drivers/adodb-postgres7.inc.php");
  18  
  19  class ADODB_postgres8 extends ADODB_postgres7
  20  {
  21  	 var $databaseType = 'postgres8';
  22  
  23  	 // From PostgreSQL 8.0 onwards, the adsrc column used in earlier versions to
  24  	 // retrieve the default value is obsolete and should not be used (see #562).
  25  	 var $metaDefaultsSQL = "SELECT d.adnum as num, pg_get_expr(d.adbin, d.adrelid) as def
  26  	 	 FROM pg_attrdef d, pg_class c 
  27  	 	 WHERE d.adrelid=c.oid AND c.relname='%s' 
  28  	 	 ORDER BY d.adnum";
  29  
  30  	 /**
  31  	  * Retrieve last inserted ID
  32  	  * Don't use OIDs, since as per {@link http://php.net/function.pg-last-oid php manual }
  33  	  * they won't be there in Postgres 8.1
  34  	  * (and they're not what the application wants back, anyway).
  35  	  * @param string $table
  36  	  * @param string $column
  37  	  * @return int last inserted ID for given table/column, or the most recently
  38  	  *             returned one if $table or $column are empty
  39  	  */
  40  	function _insertid($table, $column)
  41  	 {
  42  	 	 return empty($table) || empty($column)
  43  	 	 	 ? $this->GetOne("SELECT lastval()")
  44  	 	 	 : $this->GetOne("SELECT currval(pg_get_serial_sequence('$table', '$column'))");
  45  	 }
  46  }
  47  
  48  class ADORecordSet_postgres8 extends ADORecordSet_postgres7
  49  {
  50  	 var $databaseType = "postgres8";
  51  }
  52  
  53  class ADORecordSet_assoc_postgres8 extends ADORecordSet_assoc_postgres7
  54  {
  55  	 var $databaseType = "postgres8";
  56  }