Source for file adodb-postgres7.inc.php
Documentation is available at adodb-postgres7.inc.php
V4.97 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
28 Feb 2001: Currently indicate that we support LIMIT
01 Dec 2001: dannym added support for default values
include_once(ADODB_DIR. "/drivers/adodb-postgres64.inc.php");
var $hasLimit = true; // set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10
var $charSet = true; //set to true for Postgres 7 and above - PG client supports encodings
if (ADODB_ASSOC_CASE !== 2) {
// the following should be compat with postgresql 7.2,
// which makes obsolete the LIMIT limit,offset syntax
function &SelectLimit($sql,$nrows=- 1,$offset=- 1,$inputarr= false,$secs2cache= 0)
$offsetStr = ($offset >= 0) ? " OFFSET ". ((integer) $offset) : '';
$limitStr = ($nrows >= 0) ? " LIMIT ". ((integer) $nrows) : '';
$rs = & $this->CacheExecute($secs2cache,$sql. "$limitStr$offsetStr",$inputarr);
$rs = & $this->Execute($sql. "$limitStr$offsetStr",$inputarr);
$info = $this->ServerInfo();
if ($info['version']>=7.3) {
return array($sql,false);
// from Edward Jaramilla, improved version - works on pg 7.4
$sql = 'SELECT t.tgargs as args
pg_trigger t,pg_class c,pg_proc p
p.proname = \'RI_FKey_check_ins\' AND
if (!$rs || $rs->EOF) return false;
$size = count($data)- 1; //-1 because the last node is empty
for($i = 4; $i < $size; $i++ ) {
$a[$data[2]][] = $data[$i]. '='. $data[++ $i];
function _query($sql,$inputarr)
// We don't have native support for parameterized queries, so let's emulate it at the parent
// -- added Cristiano da Cunha Duarte
if ($last < $i) $sql .= $v;
// check if no data returned, then no need to create real recordset
if ($rez && pg_numfields($rez) <= 0) {
// this is a set of functions for managing client encoding - very important if the encodings
// of your database and your output target (i.e. HTML) don't match
//for instance, you may have UNICODE database and server it on-site as WIN1251 etc.
// GetCharSet - get the name of the character set the client is using now
// the functions should work with Postgres 7.0 and above, the set of charsets supported
// depends on compile flags of postgres distribution - if no charsets were compiled into the server
// it will return 'SQL_ANSI' always
//we will use ADO's builtin property charSet
// SetCharSet - switch the client encoding
if ($this->charSet !== $charset_name) {
$if = pg_set_client_encoding($this->_connectionID, $charset_name);
if ($if == "0" & $this->GetCharSet() == $charset_name) {
/*--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------*/
// 10% speedup to move MoveNext to child class
// Create associative array
if (ADODB_ASSOC_CASE == 2) return; // native
$lowercase = (ADODB_ASSOC_CASE == 0);
foreach($this->fields as $k => $v) {
|