Ingres Community Forums Login Register Ingres.com  

Ingres Community Forum


Go Back   Ingres Community Forums > Ingres Forums > Database Drivers and APIs > PHP
 

Reply
 
LinkBack Thread Tools Display Modes
Old 2008-06-16   #1 (permalink)
Junior Member
 
Join Date: Jun 2008
Posts: 8
Default First draft PHP adodb driver ( v0.0.0.1 )

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!
brianpw is offline   Reply With Quote
Old 2009-01-12   #2 (permalink)
Junior Member
 
Join Date: May 2007
Location: Ingres Germany GmbH
Posts: 9
Default A new driver is now available

The developers from 'inspiriti' provided me a new version of the driver. I will post it to our Subversion as soon as possible.
David.Maier@Thinking-Instruments.com is offline   Reply With Quote

Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© 2009 Ingres Corporation. All Rights Reserved