diff -u -r adodb-new-tmp/drivers/adodb-postgres64.inc.php adodb/drivers/adodb-postgres64.inc.php --- adodb-new-tmp/drivers/adodb-postgres64.inc.php 2006-06-07 23:20:11.000000000 -0700 +++ adodb/drivers/adodb-postgres64.inc.php 2006-07-25 12:30:12.000000000 -0700 @@ -91,8 +91,8 @@ var $hasAffectedRows = true; var $hasLimit = false; // set to true for pgsql 7 only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 // below suggested by Freek Dijkstra - var $true = 'TRUE'; // string that represents TRUE for a database - var $false = 'FALSE'; // string that represents FALSE for a database + var $true = '1'; // string that represents TRUE for a database + var $false = '0'; // string that represents FALSE for a database var $fmtDate = "'Y-m-d'"; // used by DBDate() as the default date format used by the database var $fmtTimeStamp = "'Y-m-d H:i:s'"; // used by DBTimeStamp as the default timestamp fmt. var $hasMoveFirst = true; @@ -160,6 +160,22 @@ return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT $column FROM $table WHERE oid=".(int)$oid); } + // Added 2004-06-27 by Kevin Jamieson (http://pkp.sfu.ca/) + // Insert_ID function that returns the actual field value instead of the OID + function PO_Insert_ID($table="", $id="") { + if (!empty($table) && !empty($id)) { + $result = @pg_exec("SELECT CURRVAL('{$table}_{$id}_seq')"); + if ($result) { + $row = @pg_fetch_row($result, 0); + if (isset($row[0])) { + return $row[0]; + } + } + } + + return $this->_insertid($table, $id); + } + // I get this error with PHP before 4.0.6 - jlim // Warning: This compilation does not support pg_cmdtuples() in adodb-postgres.inc.php on line 44 function _affectedrows() @@ -532,6 +548,9 @@ $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; $fld->max_length = $rs->fields[2]; + $fld->primary_key = false; + $fld->auto_increment = false; + $fld->scale = null; $fld->attnum = $rs->fields[6]; if ($fld->max_length <= 0) $fld->max_length = $rs->fields[3]-4; @@ -657,7 +676,8 @@ if ($str) { $host = split(":", $str); if ($host[0]) $str = "host=".adodb_addslashes($host[0]); - else $str = 'host=localhost'; + else $str = 'host='; // Modified 2004-07-23 by Kevin Jamieson (http://pkp.sfu.ca/) + // Don't specify a host if none was entered (so will connect using sockets) if (isset($host[1])) $str .= " port=$host[1]"; else if (!empty($this->port)) $str .= " port=".$this->port; } @@ -1051,4 +1071,4 @@ } }