ADOdb – Posgres 8.1 and Insert_ID

I have been having problems with the insert_id() function. I am using the postgres64 driver, adodb 4.68. The documentation suggests the function has no parameters to be passed (http://phplens.com/lens/adodb/docs-adodb.htm#inserted_id). But the function itself in adodb.inc.php, does accept 2 parameters, although they are optional.

function Insert_ID($table=”,$column=”)

I have found that using this function without parameters returns an oid value. But the value is always 0, so it will be oid=0. I have looked into this and on the php postgres manual page (http://www.php.net/manual/function.pg-getlastoid.php) the _insertid function used in the postgres64 driver uses a function which doesnt work with postgres 8.

The work around I am using is to remove the existing _insertid function from the postgres64 driver (adodb-postgres64.inc.php) and then rename the pg_insert_id function to _insertid. This appears to have solved my problem, but is probably not ideal.

 

Originally posted to : http://phplens.com/lens/lensforum/msgs.php?id=14277&x=1

XRMS – DB Change from offset to gmt_offset

A quick patch contains the changes to migrate from offset to gmt_offset. This patch will need reviewing before application and then testing. This has not been tested on mysql or another other database, these are changes on the way to providing support to postgres. This patch will not enable postgres support currently. This patch makes minor changes to several files, including the xrms-schema and updateto2 files.

It was generated using diff -Naur.

It can be applied by entering your xrms.devel directory and using the command;
patch -p1 < offset-gmt_offset.diff

 

http://www.codez.co.uk/patches/xrms/offset-gmt_offset.diff

XRMS – Opportunities bug fix

I have found the single speach marks (‘) around company in the opportunities files some.php and sidebar.php create sql errors. Removing the marks around this field name allows the query to execute and in-fact makes this field consistent with the rest in the query.

A patch is attached. Patch created using diff -Naur

Fix;
– c.company_name AS ‘company’, u.username AS
owner ” . “,
+ c.company_name AS company, u.username AS
owner ” . “,

 

http://www.codez.co.uk/patches/xrms/opportunity_sql_patch.diff

XRMS – ADOdb Integer bug-fix

This fixes an issue with adodb not stripping the size tag when creating tables with integer fields (from the schema).

The attached patch file was created on last nights cvs (2005-12-14). Using diff -Naur.

Thanks, Kenny

Detail;
http://phplens.com/lens/lensforum/msgs.php?
phplens_forummsg=filterview&amp;num=3&amp;lens_F0=&amp;
lens_F1=&amp;lens_F2=postgres&amp;_match_forummsg=2&amp
;PHPLENS_Filter=Search&amp;_urlParams_=

And the fix is;

/include/adodb/datadict-postgres.inc.php
Line 594

replace the function _GetSize which was;

function _GetSize($ftype, $ty, $fsize, $fprec)
{
if (strlen($fsize) &amp;&amp; $ty != ‘X’ &amp;&amp;
$ty != ‘B’ &amp;&amp; strpos($ftype,'(‘) === false) {
$ftype .= &quot;(&quot;.$fsize;
if (strlen($fprec)) $ftype .= &quot;,&quot;.$fprec;
$ftype .= ‘)’;
}
return $ftype;
}

with the new function _GetSize as;
function _GetSize($ftype, $ty, $fsize, $fprec)
{
if (strlen($fsize) &amp;&amp; $ty != ‘X’ &amp;&amp;
$ty != ‘B’ &amp;&amp; $ty != ‘I’ &amp;&amp; strpos
($ftype,'(‘) === false) {
$ftype .= &quot;(&quot;.$fsize;
if (strlen($fprec)) $ftype .= &quot;,&quot;.$fprec;
$ftype .= ‘)’;
}
return $ftype;
}

 

http://www.codez.co.uk/patches/xrms/adodbpatch.diff