This is my first attempt to create an PHP adodb driver for ingres. There is a matching zip file located here:
http://www.inspiriti.com.au/files/ex...c.firstcut.zip
Which contains the samples list below and readme similar to this post:
I have had two attempts. My first attempt was to take an existing MySQL driver and start modifying it to fit the syntax of the php_ingress extension.(see adodb-ingres.inc.v1.php)
This kind of worked, with two major problems
1) There was no "query id", so it was impossible to have two recordsets at a time
2) There was a weird bug going on whereby doing a call to "ingres_num_rows" was causing "ingres_fetch_array" to not return any more results.
This let me to create another version ( see adodb-ingres.inc.v2.php ) here rather than stepping through each row in turn, it pre-populates the recordset with a full set of results. It is obviously going to be a bit memory hungry, but it does work.
Note that it is far from finished
1) The connecting to different servers and ports and the use of username password has not been done
2) The metatype stuff needs reviewing
3) It has only been tried out against some fairly basic select statements
I am new to the whole ingres thing ( as I supsect Grant can testify ) but from I have seen mention of the fact that the PHP extension is changing to allow multiple recordsets, at which point I suspect the driver can be much more efficiently written in a way that it is more like my first attempt.
My suggestion for this driver would be to have a driver which defined two sets of ADORecordset classes and then picked which one to use based on available functionality. Things like the mysql driver have a precedence for this already when dealing with "ADODB_EXTENSION":
Code:
class ADOConnection {
function &_Execute($sql,$inputarr=false)
{
...
$rsclass = $this->rsPrefix.$this->databaseType;
$rs = new $rsclass($this->_queryID,$this->fetchMode);
...
}
}
class ADODB_xxx extends ADOConnection {
...
function ADODB_ingres()
{
// About ADODB_EXTENSION, From: http://adodb.sourceforge.net/:
// Adodb-ext-504.zip provides up to 100% speedup by replacing parts of ADOdb with C code.
// ADOdb will auto-detect if this extension is installed and use it automatically. This
// extension is compatible with ADOdb 3.32 or later, and PHP 4.3.*, 4.4.*, 5.0.*
//
// This was not available on installation where initial cut was done....
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
}
}
This would have the advantage of consistency, and incentives to upgrade!