<?xml version="1.0"?>
<?xml-stylesheet
href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=MDB2</link>
    <description>Search Results</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bug/23736" />
      <rdf:li rdf:resource="http://pear.php.net/bug/21042" />
      <rdf:li rdf:resource="http://pear.php.net/bug/21030" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20982" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20467" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20344" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20312" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20302" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20038" />
      <rdf:li rdf:resource="http://pear.php.net/bug/19959" />
      <rdf:li rdf:resource="http://pear.php.net/bug/19918" />
      <rdf:li rdf:resource="http://pear.php.net/bug/19451" />
      <rdf:li rdf:resource="http://pear.php.net/bug/19387" />
      <rdf:li rdf:resource="http://pear.php.net/bug/19303" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18796" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18756" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18686" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18224" />
      <rdf:li rdf:resource="http://pear.php.net/bug/17286" />
      <rdf:li rdf:resource="http://pear.php.net/bug/17165" />
      <rdf:li rdf:resource="http://pear.php.net/bug/16739" />
      <rdf:li rdf:resource="http://pear.php.net/bug/16364" />
      <rdf:li rdf:resource="http://pear.php.net/bug/14500" />
      <rdf:li rdf:resource="http://pear.php.net/bug/13389" />
      <rdf:li rdf:resource="http://pear.php.net/bug/12157" />
      <rdf:li rdf:resource="http://pear.php.net/bug/12038" />
      <rdf:li rdf:resource="http://pear.php.net/bug/11108" />
      <rdf:li rdf:resource="http://pear.php.net/bug/9332" />
      <rdf:li rdf:resource="http://pear.php.net/bug/6907" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/23736">
      <title>MDB2: Bug 23736 [Open] MDB2::execute() fails to bind value types</title>
      <link>http://pear.php.net/bugs/23736</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by stanbery
2018-02-09T17:21:43+00:00
PHP: Irrelevant OS: irrelevant Package Version: 2.4.1

Description:
------------
MDB2.php - Line 4059 (v2.4.1) - Line 4406 (v2.5.0b5)

function execute() calls bindValueArray() to attempt to bind types to 
values in the array; unfortunately, bindValueArray() defaults $types to 
null, and execute() never hands over the array of types.  This results in 
blob fields being returned as string, unfortunately.

Solution:  change line to read:
$err = $this-&gt;bindValueArray($values, $this-&gt;types);
This provides the necessary types for binding, which allows prepared 
queries for blobs to work as desired.

Test script:
---------------
$db = MDB2::connect($connectStr);
$dh = $db-&gt;prepare(&quot;insert into foo values (:data)&quot;, array(&quot;blob&quot;), MDB2_PREPARE_MANIP);
$dh-&gt;execute(array(&quot;data&quot; =&gt; &quot;file:///tmp/testfile&quot;));
$fh = fopen(&quot;foo.txt&quot;, &quot;wb&quot;);
$dh2 = $db-&gt;prepare(&quot;select data from foo&quot;, null, array(&quot;blob&quot;));
$rs = $dh2-&gt;execute(null);
$row = $rs-&gt;fetchRow(MDB2_FETCHMODE_ASSOC);
while (!feof($row['data']))
{
  $x = fread($row['data'], 8192);
  fwrite($fh, $x);
}
fclose($fh);

Expected result:
----------------
$row['data'] should be a resource type, not a string

Actual result:
--------------
$row['data'] is returned as a string</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by stanbery
2018-02-09T17:21:43+00:00
PHP: Irrelevant OS: irrelevant Package Version: 2.4.1

Description:
------------
MDB2.php - Line 4059 (v2.4.1) - Line 4406 (v2.5.0b5)

function execute() calls bindValueArray() to attempt to bind types to 
values in the array; unfortunately, bindValueArray() defaults $types to 
null, and execute() never hands over the array of types.  This results in 
blob fields being returned as string, unfortunately.

Solution:  change line to read:
$err = $this-&gt;bindValueArray($values, $this-&gt;types);
This provides the necessary types for binding, which allows prepared 
queries for blobs to work as desired.

Test script:
---------------
$db = MDB2::connect($connectStr);
$dh = $db-&gt;prepare(&quot;insert into foo values (:data)&quot;, array(&quot;blob&quot;), MDB2_PREPARE_MANIP);
$dh-&gt;execute(array(&quot;data&quot; =&gt; &quot;file:///tmp/testfile&quot;));
$fh = fopen(&quot;foo.txt&quot;, &quot;wb&quot;);
$dh2 = $db-&gt;prepare(&quot;select data from foo&quot;, null, array(&quot;blob&quot;));
$rs = $dh2-&gt;execute(null);
$row = $rs-&gt;fetchRow(MDB2_FETCHMODE_ASSOC);
while (!feof($row['data']))
{
  $x = fread($row['data'], 8192);
  fwrite($fh, $x);
}
fclose($fh);

Expected result:
----------------
$row['data'] should be a resource type, not a string

Actual result:
--------------
$row['data'] is returned as a string</pre>]]></description>
      <dc:date>2018-02-09T17:21:43+00:00</dc:date>
      <dc:creator>lls-pear &amp;#x61;&amp;#116; larrware &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/21042">
      <title>MDB2: Feature/Change Request 21042 [Open] MDB2_PORTABILITY_FIX_CASE too binary</title>
      <link>http://pear.php.net/bugs/21042</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by mheitm
2016-03-21T21:14:55+00:00
PHP: 5.6.19 OS: FreeBSD 10.2 Package Version: 2.4.1

Description:
------------
MDB2_PORTABILITY_FIX_CASE only has two options, to lower case or to upper case. The option to 'leave case alone' should be added, and be made the default so as not to introduce unwanted behaviour. ANY change to data structures should be actively programmer driven and not software prescribed. This option is also important to allow use of the other portability options independently of whether case should be changed or not.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by mheitm
2016-03-21T21:14:55+00:00
PHP: 5.6.19 OS: FreeBSD 10.2 Package Version: 2.4.1

Description:
------------
MDB2_PORTABILITY_FIX_CASE only has two options, to lower case or to upper case. The option to 'leave case alone' should be added, and be made the default so as not to introduce unwanted behaviour. ANY change to data structures should be actively programmer driven and not software prescribed. This option is also important to allow use of the other portability options independently of whether case should be changed or not.</pre>]]></description>
      <dc:date>2016-03-21T21:14:55+00:00</dc:date>
      <dc:creator>mheitm &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/21030">
      <title>MDB2: Bug 21030 [Open] warning if base_dir limit is in action</title>
      <link>http://pear.php.net/bugs/21030</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by kisst
2016-02-16T19:03:56+00:00
PHP: 5.6.17 OS: Debian GNU/Linux 8 Package Version: 2.5.0b5

Description:
------------
php.ini changes

open_basedir /var/www/:/usr/share/php/:/usr/share/pear/:/var/cache/apache2/vhosts/',
include_path	.:/usr/share/php:/usr/share/pear

when the is_readable function walk trought the include_path on the first . it's error, and just then find the right location.

WARNING [2] is_readable(): open_basedir restriction in effect. File(./MDB2/Driver/Datatype/pgsql.php) is not within the allowed path(s): (/var/www/:/usr/share/php/:/usr/share/pear/:/var/cache/apache2/vhosts/) in file /usr/share/php/MDB2.php (line 933)



Test script:
---------------
include 

Expected result:
----------------
Do not error, if in any folder it's available.

Actual result:
--------------
/usr/share/php$ diff MDB2.php.backup MDB2.php
933c933
&lt;                  if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
---
&gt;                  if (@is_readable($dir . DIRECTORY_SEPARATOR . $file)) {</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by kisst
2016-02-16T19:03:56+00:00
PHP: 5.6.17 OS: Debian GNU/Linux 8 Package Version: 2.5.0b5

Description:
------------
php.ini changes

open_basedir /var/www/:/usr/share/php/:/usr/share/pear/:/var/cache/apache2/vhosts/',
include_path	.:/usr/share/php:/usr/share/pear

when the is_readable function walk trought the include_path on the first . it's error, and just then find the right location.

WARNING [2] is_readable(): open_basedir restriction in effect. File(./MDB2/Driver/Datatype/pgsql.php) is not within the allowed path(s): (/var/www/:/usr/share/php/:/usr/share/pear/:/var/cache/apache2/vhosts/) in file /usr/share/php/MDB2.php (line 933)



Test script:
---------------
include 

Expected result:
----------------
Do not error, if in any folder it's available.

Actual result:
--------------
/usr/share/php$ diff MDB2.php.backup MDB2.php
933c933
&lt;                  if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
---
&gt;                  if (@is_readable($dir . DIRECTORY_SEPARATOR . $file)) {</pre>]]></description>
      <dc:date>2016-02-16T19:03:56+00:00</dc:date>
      <dc:creator>kisst &amp;#x61;&amp;#116; bgk &amp;#x64;&amp;#111;&amp;#x74; bme &amp;#x64;&amp;#111;&amp;#x74; hu</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20982">
      <title>MDB2: Bug 20982 [Open] mdb2 postgresql driver cannot handle 'not null' constraint</title>
      <link>http://pear.php.net/bugs/20982</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by jonez
2015-11-13T05:27:49+00:00
PHP: Irrelevant OS: centos7 Package Version: 2.4.1

Description:
------------
MDB2 with a postgresql database does not properly handle a &quot;not null&quot; constraint. instead, it throws this error:

 PHP Fatal error:  Call to undefined function: MDB2_Driver_pgsql::raiseError(). in /usr/share/pear/MDB2.php on line 1936

this same error happens if permissions are wrong on a table or if a table does not exist, etc. 

postgresql 9.2.13


Expected result:
----------------
proper PEAR::Error instance

Actual result:
--------------
PHP Fatal Error</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by jonez
2015-11-13T05:27:49+00:00
PHP: Irrelevant OS: centos7 Package Version: 2.4.1

Description:
------------
MDB2 with a postgresql database does not properly handle a &quot;not null&quot; constraint. instead, it throws this error:

 PHP Fatal error:  Call to undefined function: MDB2_Driver_pgsql::raiseError(). in /usr/share/pear/MDB2.php on line 1936

this same error happens if permissions are wrong on a table or if a table does not exist, etc. 

postgresql 9.2.13


Expected result:
----------------
proper PEAR::Error instance

Actual result:
--------------
PHP Fatal Error</pre>]]></description>
      <dc:date>2015-11-13T05:27:49+00:00</dc:date>
      <dc:creator>jam &amp;#x61;&amp;#116; zoidtechnologies &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20467">
      <title>MDB2: Documentation Problem 20467 [Open] User note that is a documentation problem</title>
      <link>http://pear.php.net/bugs/20467</link>
      <content:encoded><![CDATA[<pre>MDB2 Documentation Problem
Reported by garrettw
2014-12-14T15:01:15+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 

Manual page: package.database.mdb2.intro.php
Note submitter:
fdwalkhome at hotmail dot com

Initially I used the download instructions (http://pear.php.net/package/MDB2/download) to install.  Then I got a stability failure when I tried to install the mysql driver (Failed to install \&quot;stable\&quot; driver...).  I decided to backtrack and follow the non-version specific path on the package intro page (http://pear.php.net/manual/en/package.database.mdb2.intro.php).  Install went okay, but my first test, in which all I did was include the package file, resulted in numerous reference errors (\&quot;Assigning the return value of new by reference is deprecated\&quot;).  This is easily resolved by updating to beta packages, but why isn\'t this in the documentation.  I found the resolution on a post from 2010 (!).  PHP is sorely in need of a unified DB abstraction layer.  I\'d like to think this is it (it\'s been developed and supported for a while), but up-to-date documentation is requirement to encourage community support.\r\n\r\nThanks.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Documentation Problem
Reported by garrettw
2014-12-14T15:01:15+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 

Manual page: package.database.mdb2.intro.php
Note submitter:
fdwalkhome at hotmail dot com

Initially I used the download instructions (http://pear.php.net/package/MDB2/download) to install.  Then I got a stability failure when I tried to install the mysql driver (Failed to install \&quot;stable\&quot; driver...).  I decided to backtrack and follow the non-version specific path on the package intro page (http://pear.php.net/manual/en/package.database.mdb2.intro.php).  Install went okay, but my first test, in which all I did was include the package file, resulted in numerous reference errors (\&quot;Assigning the return value of new by reference is deprecated\&quot;).  This is easily resolved by updating to beta packages, but why isn\'t this in the documentation.  I found the resolution on a post from 2010 (!).  PHP is sorely in need of a unified DB abstraction layer.  I\'d like to think this is it (it\'s been developed and supported for a while), but up-to-date documentation is requirement to encourage community support.\r\n\r\nThanks.</pre>]]></description>
      <dc:date>2014-12-14T15:01:15+00:00</dc:date>
      <dc:creator>garrettw87 &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Documentation Problem</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20344">
      <title>MDB2: Feature/Change Request 20344 [Open] Oracle Connection as SYSDBA</title>
      <link>http://pear.php.net/bugs/20344</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by vettorel
2014-07-10T20:05:45+00:00
PHP: Irrelevant OS: all Package Version: Unknown

Description:
------------
via OCI8 it's possible to connect as SYSDBA -&gt; session 
mode must be set to OCI_SYSDBA. How can i get a sysdba 
connection via MDB2?
This is absolutely necessary to connect to Oracle Standby 
database which run in mounted state.
 
Thanks &amp; Regards 
Marc</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by vettorel
2014-07-10T20:05:45+00:00
PHP: Irrelevant OS: all Package Version: Unknown

Description:
------------
via OCI8 it's possible to connect as SYSDBA -&gt; session 
mode must be set to OCI_SYSDBA. How can i get a sysdba 
connection via MDB2?
This is absolutely necessary to connect to Oracle Standby 
database which run in mounted state.
 
Thanks &amp; Regards 
Marc</pre>]]></description>
      <dc:date>2014-07-10T20:05:45+00:00</dc:date>
      <dc:creator>marc &amp;#x64;&amp;#111;&amp;#x74; vettorel &amp;#x61;&amp;#116; bertelsmann &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20312">
      <title>MDB2: Feature/Change Request 20312 [Open] Add Composer support</title>
      <link>http://pear.php.net/bugs/20312</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by samwilson
2014-06-24T11:23:14+00:00
PHP: Irrelevant OS: Irrelevant Package Version: SVN

Description:
------------
Would it be possible to add support for Composer for this package? Thanks!</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by samwilson
2014-06-24T11:23:14+00:00
PHP: Irrelevant OS: Irrelevant Package Version: SVN

Description:
------------
Would it be possible to add support for Composer for this package? Thanks!</pre>]]></description>
      <dc:date>2014-06-24T11:23:14+00:00</dc:date>
      <dc:creator>sam &amp;#x61;&amp;#116; archives &amp;#x64;&amp;#111;&amp;#x74; org &amp;#x64;&amp;#111;&amp;#x74; au</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20302">
      <title>MDB2: Documentation Problem 20302 [Open] Required PHP Version Incorrect</title>
      <link>http://pear.php.net/bugs/20302</link>
      <content:encoded><![CDATA[<pre>MDB2 Documentation Problem
Reported by kseymour
2014-06-21T00:19:23+00:00
PHP: Irrelevant OS: RHEL 5.2 Package Version: 2.5.0b5

Description:
------------
The required PHP version listed on the front page for the MDB2 
project lists PHP 5.2, however the usage of 
DEBUG_BACKTRACE_IGNORE_ARGS brings that requirement to 
at least PHP 5.3.6.

http://www.php.net//manual/en/function.debug-backtrace.php</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Documentation Problem
Reported by kseymour
2014-06-21T00:19:23+00:00
PHP: Irrelevant OS: RHEL 5.2 Package Version: 2.5.0b5

Description:
------------
The required PHP version listed on the front page for the MDB2 
project lists PHP 5.2, however the usage of 
DEBUG_BACKTRACE_IGNORE_ARGS brings that requirement to 
at least PHP 5.3.6.

http://www.php.net//manual/en/function.debug-backtrace.php</pre>]]></description>
      <dc:date>2014-06-21T00:19:23+00:00</dc:date>
      <dc:creator>kseymour &amp;#x61;&amp;#116; es3 &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Documentation Problem</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20038">
      <title>MDB2: Bug 20038 [Open] prepare statements fail w/data type array</title>
      <link>http://pear.php.net/bugs/20038</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by helices
2013-08-14T23:01:10+00:00
PHP: 5.4.0 OS: centos Package Version: 2.4.1

Description:
------------
We have several servers of this configuration, some of which successfully run this code and 3 fail

All else equal, this line succeeds:
$stm = $db-&gt;prepare($query,MDB2_PREPARE_MANIP);

This line fails:
$type = array('text');
$stm = $db-&gt;prepare($query,$type,MDB2_PREPARE_MANIP);

We need to get the value, like this:
$d[$column] = $str;
$updated = $stm-&gt;execute($d);

When it fails, we get this:
MDB2 Error: unknown error
_execute: [Error message: Unable to execute statement]
[Last executed query: UPDATE filetypes
    SET comments=?
    WHERE filetype_id=1
    ]
[Native code: 0]

Please, advise. Thank you.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by helices
2013-08-14T23:01:10+00:00
PHP: 5.4.0 OS: centos Package Version: 2.4.1

Description:
------------
We have several servers of this configuration, some of which successfully run this code and 3 fail

All else equal, this line succeeds:
$stm = $db-&gt;prepare($query,MDB2_PREPARE_MANIP);

This line fails:
$type = array('text');
$stm = $db-&gt;prepare($query,$type,MDB2_PREPARE_MANIP);

We need to get the value, like this:
$d[$column] = $str;
$updated = $stm-&gt;execute($d);

When it fails, we get this:
MDB2 Error: unknown error
_execute: [Error message: Unable to execute statement]
[Last executed query: UPDATE filetypes
    SET comments=?
    WHERE filetype_id=1
    ]
[Native code: 0]

Please, advise. Thank you.</pre>]]></description>
      <dc:date>2013-08-14T23:01:10+00:00</dc:date>
      <dc:creator>pear &amp;#x61;&amp;#116; mdsresource &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/19959">
      <title>MDB2: Bug 19959 [Open] MDB2 trigger problem on multiple table references on mysql</title>
      <link>http://pear.php.net/bugs/19959</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by gzuki
2013-05-27T16:44:56+00:00
PHP: Irrelevant OS: Ubuntu 12.04 LTS Package Version: 2.5.0b5

Description:
------------
Hi,
I have multiple tables which referes to one main tables &quot;id&quot;. So I use:
             'fk_fusioninventory_antivirus_hardware_id'=&gt;array(
                   'primary' =&gt; 0,
                   'unique'  =&gt; 0,
                   'foreign' =&gt; 1,
                   'check'   =&gt; 0,
                   'fields' =&gt; array (
                       'hardware_id' =&gt; array(
                             'position' =&gt; 1
                       )
                     ),
                   'references' =&gt; array(
                       'table' =&gt; 'fusioninventory_hardware',
                       'fields' =&gt; array(
                           'id' =&gt; array(
                             'position' =&gt; 1
                           )
                       )
                   ),
                   'deferrable' =&gt; 0,
                   'initiallydeferred' =&gt; 0,
                   'onupdate' =&gt; 'CASCADE',
                   'ondelete' =&gt; 'CASCADE'
                   )
on each table. For the first table which will be created and which
depends on the main table, there will be created an trigger which says
that if the fusioninventory_hardware.id is changed please update also
this first table. As mysql doesnt support more than one trigger for the
same action, the second table which has the same foreign key - there
will be no trigger created.

The (damn) effect is that only the first table is updated if I change
the id of the main table. If I delete the 2 triggers (update/delete) so
that there is no more trigger on the main table, all works fine. All
tables which has the foreign key will be updated.

I have seen that you catch the correct error in the driver:
$expected_errmsg = 'This MySQL version doesn\'t support multiple triggers with the same action time and event for one table';
So the trigger should not be created if this mysql version doesnt support multiple trigger, because of the first trigger is created and breaks the foreign key behaviour. 

If you want to reproduce that, the table definitions are located here:
http://uranos.svn.sourceforge.net/viewvc/uranos/www/modules/fusioninventory/tables.php

I use the latest version of MDB2:
MDB2                2.5.0b5 beta
MDB2_Driver_mysql   1.5.0b4 beta
MDB2_Driver_mysqli  1.5.0b4 beta

mysqld  Ver 5.5.29-0ubuntu0.12.04.2 for debian-linux-gnu on x86_64
((Ubuntu))

How can I prevent that the mgCreateConstraint creates this triggers?

Thank you 

Test script:
---------------
http://uranos.svn.sourceforge.net/viewvc/uranos/www/modules/fusioninventory/tables.php</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by gzuki
2013-05-27T16:44:56+00:00
PHP: Irrelevant OS: Ubuntu 12.04 LTS Package Version: 2.5.0b5

Description:
------------
Hi,
I have multiple tables which referes to one main tables &quot;id&quot;. So I use:
             'fk_fusioninventory_antivirus_hardware_id'=&gt;array(
                   'primary' =&gt; 0,
                   'unique'  =&gt; 0,
                   'foreign' =&gt; 1,
                   'check'   =&gt; 0,
                   'fields' =&gt; array (
                       'hardware_id' =&gt; array(
                             'position' =&gt; 1
                       )
                     ),
                   'references' =&gt; array(
                       'table' =&gt; 'fusioninventory_hardware',
                       'fields' =&gt; array(
                           'id' =&gt; array(
                             'position' =&gt; 1
                           )
                       )
                   ),
                   'deferrable' =&gt; 0,
                   'initiallydeferred' =&gt; 0,
                   'onupdate' =&gt; 'CASCADE',
                   'ondelete' =&gt; 'CASCADE'
                   )
on each table. For the first table which will be created and which
depends on the main table, there will be created an trigger which says
that if the fusioninventory_hardware.id is changed please update also
this first table. As mysql doesnt support more than one trigger for the
same action, the second table which has the same foreign key - there
will be no trigger created.

The (damn) effect is that only the first table is updated if I change
the id of the main table. If I delete the 2 triggers (update/delete) so
that there is no more trigger on the main table, all works fine. All
tables which has the foreign key will be updated.

I have seen that you catch the correct error in the driver:
$expected_errmsg = 'This MySQL version doesn\'t support multiple triggers with the same action time and event for one table';
So the trigger should not be created if this mysql version doesnt support multiple trigger, because of the first trigger is created and breaks the foreign key behaviour. 

If you want to reproduce that, the table definitions are located here:
http://uranos.svn.sourceforge.net/viewvc/uranos/www/modules/fusioninventory/tables.php

I use the latest version of MDB2:
MDB2                2.5.0b5 beta
MDB2_Driver_mysql   1.5.0b4 beta
MDB2_Driver_mysqli  1.5.0b4 beta

mysqld  Ver 5.5.29-0ubuntu0.12.04.2 for debian-linux-gnu on x86_64
((Ubuntu))

How can I prevent that the mgCreateConstraint creates this triggers?

Thank you 

Test script:
---------------
http://uranos.svn.sourceforge.net/viewvc/uranos/www/modules/fusioninventory/tables.php</pre>]]></description>
      <dc:date>2013-05-27T16:44:56+00:00</dc:date>
      <dc:creator>mariogzuk &amp;#x61;&amp;#116; technikz &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/19918">
      <title>MDB2: Bug 19918 [Open] lastInsertID(): Using lastval() breaks triggers in postgresql!</title>
      <link>http://pear.php.net/bugs/19918</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by mirkovogt
2013-04-29T18:39:45+00:00
PHP: irrelevant OS: irrelevant Package Version: 2.5.0b5

Description:
------------
The function 'lastInsertID' in /usr/share/php/MDB2/Driver/pgsql.php is supposed to return the ID of the previous change (mostly 'INSERT') by the application using this pgsql-connection. This however isn't always true.

lastInsertID() is either using currval($arg) for a given table/sequence or lastval() if no parameter got passed.

Using currval($arg) is totally fine, however using lastval() is highly discouraged and considered to be racy.

lastval() returns the ID of the very last change on this set/connection, not necessarily done by the application itself.

An example:

I'm having the table 'foo' and a trigger configured on it, which is causing an INSERT to table 'bar' on any change to 'foo'.
Now I'm doing sth. like:

INSERT INTO 'foo';
SELECT lastval();

However in this case 'lastval()' doesn't return the ID of the INSERT my application caused, but the INSERT the trigger caused.

This isn't just a theoretical issue: I'm using slony for replication of my postgres tables and the application using lastInsertID() reproducible get back the the ID of the INSERT caused by the trigger, not my application.

Since there is no way of using currval() without any argument, I don't have an ideal solution not changing the API.

So I propose to NOT allow using lastInsertID() anymore without any arguments!

Expected result:
----------------
lastInsertID() returning the ID of the last change _I_ made

Actual result:
--------------
lastInsertID() returning the ID of the last change on this set and connection (which might be caused by e.g. triggers)</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by mirkovogt
2013-04-29T18:39:45+00:00
PHP: irrelevant OS: irrelevant Package Version: 2.5.0b5

Description:
------------
The function 'lastInsertID' in /usr/share/php/MDB2/Driver/pgsql.php is supposed to return the ID of the previous change (mostly 'INSERT') by the application using this pgsql-connection. This however isn't always true.

lastInsertID() is either using currval($arg) for a given table/sequence or lastval() if no parameter got passed.

Using currval($arg) is totally fine, however using lastval() is highly discouraged and considered to be racy.

lastval() returns the ID of the very last change on this set/connection, not necessarily done by the application itself.

An example:

I'm having the table 'foo' and a trigger configured on it, which is causing an INSERT to table 'bar' on any change to 'foo'.
Now I'm doing sth. like:

INSERT INTO 'foo';
SELECT lastval();

However in this case 'lastval()' doesn't return the ID of the INSERT my application caused, but the INSERT the trigger caused.

This isn't just a theoretical issue: I'm using slony for replication of my postgres tables and the application using lastInsertID() reproducible get back the the ID of the INSERT caused by the trigger, not my application.

Since there is no way of using currval() without any argument, I don't have an ideal solution not changing the API.

So I propose to NOT allow using lastInsertID() anymore without any arguments!

Expected result:
----------------
lastInsertID() returning the ID of the last change _I_ made

Actual result:
--------------
lastInsertID() returning the ID of the last change on this set and connection (which might be caused by e.g. triggers)</pre>]]></description>
      <dc:date>2013-04-29T19:01:03+00:00</dc:date>
      <dc:creator>pear &amp;#x61;&amp;#116; nanl &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/19451">
      <title>MDB2: Bug 19451 [Open] Automatic column result type detection is broken</title>
      <link>http://pear.php.net/bugs/19451</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by lmartelli
2012-06-02T17:37:21+00:00
PHP: 5.4.0 OS:  Package Version: 2.5.0b3

Description:
------------
Some drivers, such as postgresql, support auto detection of result types using &lt;driver&gt;_field_type function if MDB2_Result_&lt;driver&gt;::setResultTypes(NULL) is called. But if you use MDB2_PREPARE_RESULT (ie NULL) when calling MDB2_Driver::prepare(), setResultTypes() is not called, and as a result, all result columns are considered to be text.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by lmartelli
2012-06-02T17:37:21+00:00
PHP: 5.4.0 OS:  Package Version: 2.5.0b3

Description:
------------
Some drivers, such as postgresql, support auto detection of result types using &lt;driver&gt;_field_type function if MDB2_Result_&lt;driver&gt;::setResultTypes(NULL) is called. But if you use MDB2_PREPARE_RESULT (ie NULL) when calling MDB2_Driver::prepare(), setResultTypes() is not called, and as a result, all result columns are considered to be text.</pre>]]></description>
      <dc:date>2012-06-02T17:37:21+00:00</dc:date>
      <dc:creator>martellilaurent &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/19387">
      <title>MDB2: Feature/Change Request 19387 [Open] Add features to MDB2 Manager</title>
      <link>http://pear.php.net/bugs/19387</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by gerry
2012-04-18T21:53:14+00:00
PHP: Irrelevant OS:  Package Version: 2.5.0b3

Description:
------------
I have added some methods to the MDB2 Manager class. If they are useful, perhaps they can be added to the project?

These are the methods, the diff is attached:

function createUser($name, $host = '%', $password = null, $password_format_mysql = false)
function updateUserPassword($name, $host = '%', $password = null, $password_format_mysql = false)
function dropUser($user, $host = '%')
function grantAllPrivileges($database, $user, $host = '%')
function revokeAllPrivileges($database, $user, $host = '%')</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by gerry
2012-04-18T21:53:14+00:00
PHP: Irrelevant OS:  Package Version: 2.5.0b3

Description:
------------
I have added some methods to the MDB2 Manager class. If they are useful, perhaps they can be added to the project?

These are the methods, the diff is attached:

function createUser($name, $host = '%', $password = null, $password_format_mysql = false)
function updateUserPassword($name, $host = '%', $password = null, $password_format_mysql = false)
function dropUser($user, $host = '%')
function grantAllPrivileges($database, $user, $host = '%')
function revokeAllPrivileges($database, $user, $host = '%')</pre>]]></description>
      <dc:date>2012-04-18T21:53:14+00:00</dc:date>
      <dc:creator>oss &amp;#x61;&amp;#116; x-net &amp;#x64;&amp;#111;&amp;#x74; be</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/19303">
      <title>MDB2: Documentation Problem 19303 [Open] Using an indexed type array with assoc or object fetch doesn't set types</title>
      <link>http://pear.php.net/bugs/19303</link>
      <content:encoded><![CDATA[<pre>MDB2 Documentation Problem
Reported by gauthierm
2012-02-23T23:35:55+00:00
PHP: Irrelevant OS: Irrelevant Package Version: SVN

Description:
------------
Using an indexed type array with assoc or object fetch doesn't set types. The 
returned results are all strings rather than the specified types.

Using an associative types array works correctly.

The attached patch fixes the issue in SVN trunk</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Documentation Problem
Reported by gauthierm
2012-02-23T23:35:55+00:00
PHP: Irrelevant OS: Irrelevant Package Version: SVN

Description:
------------
Using an indexed type array with assoc or object fetch doesn't set types. The 
returned results are all strings rather than the specified types.

Using an associative types array works correctly.

The attached patch fixes the issue in SVN trunk</pre>]]></description>
      <dc:date>2012-11-09T19:34:57+00:00</dc:date>
      <dc:creator>mike &amp;#x61;&amp;#116; silverorange &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Documentation Problem</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18796">
      <title>MDB2: Feature/Change Request 18796 [Open] Add &quot;order by&quot; support for autoPrepare/autoExecute select statements</title>
      <link>http://pear.php.net/bugs/18796</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by lsloan
2011-09-06T23:13:26+00:00
PHP: Irrelevant OS: any Package Version: SVN

Description:
------------
Please add support to the autoPrepare and autoExecute methods for &quot;order by&quot; clauses in generated select statements. 

Support for &quot;group by&quot;, &quot;limit&quot;, etc. would also be very, very helpful.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by lsloan
2011-09-06T23:13:26+00:00
PHP: Irrelevant OS: any Package Version: SVN

Description:
------------
Please add support to the autoPrepare and autoExecute methods for &quot;order by&quot; clauses in generated select statements. 

Support for &quot;group by&quot;, &quot;limit&quot;, etc. would also be very, very helpful.</pre>]]></description>
      <dc:date>2011-09-06T23:13:26+00:00</dc:date>
      <dc:creator>lsloan-php &amp;#x64;&amp;#111;&amp;#x74; net &amp;#x61;&amp;#116; umich &amp;#x64;&amp;#111;&amp;#x74; edu</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18756">
      <title>MDB2: Bug 18756 [Open] MDB2::singleton does not return an error if the connection is lost</title>
      <link>http://pear.php.net/bugs/18756</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by iamnos
2011-08-25T01:33:16+00:00
PHP: 5.2.10 OS: Linux (2.6.18-238.12.1.el5) Package Version: 2.4.1

Description:
------------
If a script loses connection after the initial MDB2::Connect call, a 
call to MDB2::singleton does not produce an error.

Test script:
---------------
&lt;?php
require_once('config.php');
require_once('MDB2.php');

$dsn = array(
        'phptype'  =&gt; 'mysql', 'username' =&gt; BASH_USER, 'password' =&gt; BASH_PASS, 'hostspec' =&gt; BASH_HOST, 'database' =&gt; BASH_NAME,
        );
$mdb2 =&amp; MDB2::factory($dsn);
if (PEAR::isError($mdb2)) {
        echo &quot;Connection failed\n&quot;;
        exit();
}
echo &quot;Connected\n&quot;;
sleep(20);  // Stop mysqld
$mdb2 =&amp;  MDB2::singleton($dsn);
if (MDB2::isError($mdb2)) {
        echo &quot;Failed db connection\n&quot;;
   exit();
}
echo &quot;Still Connected\n&quot;;


Expected result:
----------------
php -q test.php
Connected
Failed db connection

Actual result:
--------------
php -q test.php
Connected
Still Connected</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by iamnos
2011-08-25T01:33:16+00:00
PHP: 5.2.10 OS: Linux (2.6.18-238.12.1.el5) Package Version: 2.4.1

Description:
------------
If a script loses connection after the initial MDB2::Connect call, a 
call to MDB2::singleton does not produce an error.

Test script:
---------------
&lt;?php
require_once('config.php');
require_once('MDB2.php');

$dsn = array(
        'phptype'  =&gt; 'mysql', 'username' =&gt; BASH_USER, 'password' =&gt; BASH_PASS, 'hostspec' =&gt; BASH_HOST, 'database' =&gt; BASH_NAME,
        );
$mdb2 =&amp; MDB2::factory($dsn);
if (PEAR::isError($mdb2)) {
        echo &quot;Connection failed\n&quot;;
        exit();
}
echo &quot;Connected\n&quot;;
sleep(20);  // Stop mysqld
$mdb2 =&amp;  MDB2::singleton($dsn);
if (MDB2::isError($mdb2)) {
        echo &quot;Failed db connection\n&quot;;
   exit();
}
echo &quot;Still Connected\n&quot;;


Expected result:
----------------
php -q test.php
Connected
Failed db connection

Actual result:
--------------
php -q test.php
Connected
Still Connected</pre>]]></description>
      <dc:date>2011-08-25T01:33:16+00:00</dc:date>
      <dc:creator>andrew &amp;#x61;&amp;#116; thekerrs &amp;#x64;&amp;#111;&amp;#x74; ca</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18686">
      <title>MDB2: Bug 18686 [Open] bindname_format option regex changed</title>
      <link>http://pear.php.net/bugs/18686</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by felixl
2011-07-26T00:28:24+00:00
PHP: 5.3.0 OS: linux x64 (ubuntu 10.10) Package Version: 2.5.0b3

Description:
------------
between version 2.5.0a1 and 2.5.0a2, the following info was added to the release notes:

- added bindname_format option (this is the regexp used to recognize named
placeholders in prepared statements)

cool but the default regex changed, and now, the named placeholders that I had won't work.

previously, a named placeholder beginning with an underscore was working, now it does not.

The problem is:
file MDB2.php - line 1171
 'bindname_format' =&gt; '(?:\d+)|(?:[a-zA-Z][a-zA-Z0-9_]*)',


previously, the regex was in the prepare function: (line 2950 of MDB2.php)
 $regexp = '/^.{'.($position+1).'}('.$this-&gt;options['bindname_format'].').*$/s';



here is the same line, but in version 2.4.1
$parameter = preg_replace('/^.{'.($position+1).'}([a-z0-9_]+).*$/si', '\\1', $query);


The regex was changed from:
^.{xxxx}([a-z0-9_]+).*$  with the case insensitive flag to:


^.{xxx}((?:\d+)|(?:[a-zA-Z][a-zA-Z0-9_]*)).*$ without the case insensitive flag


I see now that you make exception when the named placeholder is starting with a digit but I do not understand why the underscore is no longer supported as the first character.

Where is the definition of what is the valid format of a named placeholder ?

can :123_123_asasdaASDA be a placeholder ?

Anyway, here is the fix for line  1171
 'bindname_format' =&gt; '(?:\d+)|(?:[a-zA-Z_][a-zA-Z0-9_]*)',


ou 'bindname_format' =&gt; '([a-zA-Z0-9_]+',








Test script:
---------------
named placeholder starting with an underscore

Expected result:
----------------
result from the query

Actual result:
--------------
getRow will return an MDB2_Error with mysql, mysqli or mssql</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by felixl
2011-07-26T00:28:24+00:00
PHP: 5.3.0 OS: linux x64 (ubuntu 10.10) Package Version: 2.5.0b3

Description:
------------
between version 2.5.0a1 and 2.5.0a2, the following info was added to the release notes:

- added bindname_format option (this is the regexp used to recognize named
placeholders in prepared statements)

cool but the default regex changed, and now, the named placeholders that I had won't work.

previously, a named placeholder beginning with an underscore was working, now it does not.

The problem is:
file MDB2.php - line 1171
 'bindname_format' =&gt; '(?:\d+)|(?:[a-zA-Z][a-zA-Z0-9_]*)',


previously, the regex was in the prepare function: (line 2950 of MDB2.php)
 $regexp = '/^.{'.($position+1).'}('.$this-&gt;options['bindname_format'].').*$/s';



here is the same line, but in version 2.4.1
$parameter = preg_replace('/^.{'.($position+1).'}([a-z0-9_]+).*$/si', '\\1', $query);


The regex was changed from:
^.{xxxx}([a-z0-9_]+).*$  with the case insensitive flag to:


^.{xxx}((?:\d+)|(?:[a-zA-Z][a-zA-Z0-9_]*)).*$ without the case insensitive flag


I see now that you make exception when the named placeholder is starting with a digit but I do not understand why the underscore is no longer supported as the first character.

Where is the definition of what is the valid format of a named placeholder ?

can :123_123_asasdaASDA be a placeholder ?

Anyway, here is the fix for line  1171
 'bindname_format' =&gt; '(?:\d+)|(?:[a-zA-Z_][a-zA-Z0-9_]*)',


ou 'bindname_format' =&gt; '([a-zA-Z0-9_]+',








Test script:
---------------
named placeholder starting with an underscore

Expected result:
----------------
result from the query

Actual result:
--------------
getRow will return an MDB2_Error with mysql, mysqli or mssql</pre>]]></description>
      <dc:date>2011-07-26T00:28:24+00:00</dc:date>
      <dc:creator>felixl &amp;#x61;&amp;#116; densi &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18224">
      <title>MDB2: Bug 18224 [Open] escapePatter for charset Shift_JIS</title>
      <link>http://pear.php.net/bugs/18224</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by sakai
2011-01-27T16:59:16+00:00
PHP: 5.3.5 OS: Linux Package Version: 2.4.1

Description:
------------
Almost always, MDB2's prepare/execute work with the charset 
(internal_encoding) of Shift_JIS.  But it doesn't work properly 
with escapePattern.

Simple str_replace on line 1656 of MDB2.php does NOT work 
with certain charset like SJIS.

Below is a sample of '?' in UTF-8

Test script:
---------------
http://example.com/?like=%95%5C

&lt;?php
mb_internal_encoding('SJIS');
require_once('MDB2.php');
$mdb2 = MDB2::connect('pgsql:///testdb?charset=sjis');

$sth = $mdb2-&gt;prepare(
  'SELECT * FROM tbl WHERE profile LIKE :profile',
  array('profile' =&gt; 'text')
);
$res = $sth-&gt;execute(array('profile' =&gt; '%' . $mdb2-&gt;escapePattern($_GET['like']) . '%'));

header('Content-Type: text/html; charset=Shift_JIS');
var_dump($mdb2-&gt;last_query);
?&gt;

Expected result:
----------------
string(70) &quot;EXECUTE 
mdb2_statement_pgsql_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
('%?%')&quot;

Actual result:
--------------
string(72) &quot;EXECUTE 
mdb2_statement_pgsql_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
('%?\\%')&quot;</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by sakai
2011-01-27T16:59:16+00:00
PHP: 5.3.5 OS: Linux Package Version: 2.4.1

Description:
------------
Almost always, MDB2's prepare/execute work with the charset 
(internal_encoding) of Shift_JIS.  But it doesn't work properly 
with escapePattern.

Simple str_replace on line 1656 of MDB2.php does NOT work 
with certain charset like SJIS.

Below is a sample of '?' in UTF-8

Test script:
---------------
http://example.com/?like=%95%5C

&lt;?php
mb_internal_encoding('SJIS');
require_once('MDB2.php');
$mdb2 = MDB2::connect('pgsql:///testdb?charset=sjis');

$sth = $mdb2-&gt;prepare(
  'SELECT * FROM tbl WHERE profile LIKE :profile',
  array('profile' =&gt; 'text')
);
$res = $sth-&gt;execute(array('profile' =&gt; '%' . $mdb2-&gt;escapePattern($_GET['like']) . '%'));

header('Content-Type: text/html; charset=Shift_JIS');
var_dump($mdb2-&gt;last_query);
?&gt;

Expected result:
----------------
string(70) &quot;EXECUTE 
mdb2_statement_pgsql_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
('%?%')&quot;

Actual result:
--------------
string(72) &quot;EXECUTE 
mdb2_statement_pgsql_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
('%?\\%')&quot;</pre>]]></description>
      <dc:date>2011-01-27T17:04:28+00:00</dc:date>
      <dc:creator>sakai &amp;#x61;&amp;#116; d4k &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/17286">
      <title>MDB2: Feature/Change Request 17286 [Open] Change of bindValue/Array and bindParam/Array</title>
      <link>http://pear.php.net/bugs/17286</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by edlman
2010-04-01T22:25:06+00:00
PHP: 5.3.2 OS: All Package Version: 2.5.0b2

Description:
------------
Binding array of values in bindValueArray() throwed error (originated in bindValue()) when there was an element in the value array which was not found in the this-&gt;positions array. This is fixed in 2.5.0 by checking errorCode after return from bindValue.
I offer even more elegant ways to solve this. One way is to walk the values array itself and lookup its key in the this-&gt;positions array to find a position for the types array. If the key is not found in the this-&gt;positions then it's not going to database.
Other (even shorter) way is to walk the this-&gt;positions array so we know the position for the types array and the parameter name for the values array.
This way we don't need to test result of the bindValue() as this must always succeed. So we can remove tests from bindValue() and we can remove test for returned value from bindValue() in bindValueArray() which will speed it up (a little bit).
Please see attached patch (for version 2.5.0b2)</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by edlman
2010-04-01T22:25:06+00:00
PHP: 5.3.2 OS: All Package Version: 2.5.0b2

Description:
------------
Binding array of values in bindValueArray() throwed error (originated in bindValue()) when there was an element in the value array which was not found in the this-&gt;positions array. This is fixed in 2.5.0 by checking errorCode after return from bindValue.
I offer even more elegant ways to solve this. One way is to walk the values array itself and lookup its key in the this-&gt;positions array to find a position for the types array. If the key is not found in the this-&gt;positions then it's not going to database.
Other (even shorter) way is to walk the this-&gt;positions array so we know the position for the types array and the parameter name for the values array.
This way we don't need to test result of the bindValue() as this must always succeed. So we can remove tests from bindValue() and we can remove test for returned value from bindValue() in bindValueArray() which will speed it up (a little bit).
Please see attached patch (for version 2.5.0b2)</pre>]]></description>
      <dc:date>2012-10-24T20:30:43+00:00</dc:date>
      <dc:creator>martin &amp;#x64;&amp;#111;&amp;#x74; edlman &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/17165">
      <title>MDB2: Feature/Change Request 17165 [Open] Move/Explain a function</title>
      <link>http://pear.php.net/bugs/17165</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by rprandini
2010-02-26T03:00:59+00:00
PHP: 5.3.0 OS: win 2000 sp4 Package Version: 2.5.0b2

Description:
------------
I'd like to fetch my row as object as.

.....

class VOAuthor {
     public var $id_aut;
     public var $fname_aut;
     public var $lname_aut;
     public var $birth_Date;

}

.....
.....

//MYSQL OLD STYLE

 $result = mysql_query($query);
 $ret = array();
 while ($row = mysql_fetch_object($result, &quot;VOAuthor&quot;)) {
            $ret[] = $row;
 }
 mysql_free_result($result);
......

Test script:
---------------
No script i don't understand how to do it.

on mdb2 manual there is page dedicated at connection settings
http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php

in option array  reported in many example there is interesting fetch_class  	string  	 class to use when fetch mode object is used 

So i set 

$options = array(
    'debug' =&gt; 2,
    'result_buffering' =&gt; false,
    'fetch_class' =&gt;&quot;VOAuthor&quot;
);

Now the problem
i'd like to obtain a  the birthDate as datetime, http://www.php.net/manual/en/class.datetime.php so i think  
another option must be used:
datatype_map  	array map user defined datatypes to other primitive datatypes, but how to????

The second thing is:
 if i do multiple query select1, selct2 , select3, obtaining each time different row schema (depending on selected fields) that i wont to convert in a VOAuthor Object, MYCustom Object, how to change the option before each select.  


Expected result:
----------------
I expect an array of VOAuthor i explain because i wont those thing so complicate, because i use MDB2, in combination with SABREAmf, 2 Pear Tools, But Sabre need Complex Dataype to convert info from PHP to Flex for example Date. 
I think that if you could explain how to use two optional param that i indicated to obtain a a custom Object it's a gratintegration between sabre and mdb2. Another motivation is a performantÃ¬ce tip i explain better thi point in Actual Result
I think also that if fech object coud recive class as argument thi can be a usability enhancement; anyway this is not primary requirement and nee a new interface (i dislike function intrface changing withiut adding new functionality so i think this is not so important) 

Actual result:
--------------
Actually i use MDB2_FETCHMODE_ASSOC renemaing duplicate field in join than for each row i convert it in a new VOAuthor object. For 1000 record this is an huge effort (not for me but for php) an it's not so simple to manage high amount of record 20000 or 200000.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by rprandini
2010-02-26T03:00:59+00:00
PHP: 5.3.0 OS: win 2000 sp4 Package Version: 2.5.0b2

Description:
------------
I'd like to fetch my row as object as.

.....

class VOAuthor {
     public var $id_aut;
     public var $fname_aut;
     public var $lname_aut;
     public var $birth_Date;

}

.....
.....

//MYSQL OLD STYLE

 $result = mysql_query($query);
 $ret = array();
 while ($row = mysql_fetch_object($result, &quot;VOAuthor&quot;)) {
            $ret[] = $row;
 }
 mysql_free_result($result);
......

Test script:
---------------
No script i don't understand how to do it.

on mdb2 manual there is page dedicated at connection settings
http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php

in option array  reported in many example there is interesting fetch_class  	string  	 class to use when fetch mode object is used 

So i set 

$options = array(
    'debug' =&gt; 2,
    'result_buffering' =&gt; false,
    'fetch_class' =&gt;&quot;VOAuthor&quot;
);

Now the problem
i'd like to obtain a  the birthDate as datetime, http://www.php.net/manual/en/class.datetime.php so i think  
another option must be used:
datatype_map  	array map user defined datatypes to other primitive datatypes, but how to????

The second thing is:
 if i do multiple query select1, selct2 , select3, obtaining each time different row schema (depending on selected fields) that i wont to convert in a VOAuthor Object, MYCustom Object, how to change the option before each select.  


Expected result:
----------------
I expect an array of VOAuthor i explain because i wont those thing so complicate, because i use MDB2, in combination with SABREAmf, 2 Pear Tools, But Sabre need Complex Dataype to convert info from PHP to Flex for example Date. 
I think that if you could explain how to use two optional param that i indicated to obtain a a custom Object it's a gratintegration between sabre and mdb2. Another motivation is a performantÃ¬ce tip i explain better thi point in Actual Result
I think also that if fech object coud recive class as argument thi can be a usability enhancement; anyway this is not primary requirement and nee a new interface (i dislike function intrface changing withiut adding new functionality so i think this is not so important) 

Actual result:
--------------
Actually i use MDB2_FETCHMODE_ASSOC renemaing duplicate field in join than for each row i convert it in a new VOAuthor object. For 1000 record this is an huge effort (not for me but for php) an it's not so simple to manage high amount of record 20000 or 200000.</pre>]]></description>
      <dc:date>2010-02-26T03:00:59+00:00</dc:date>
      <dc:creator>riccardoprandini01 &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/16739">
      <title>MDB2: Feature/Change Request 16739 [Open] Transaction rolledback with persistant connection</title>
      <link>http://pear.php.net/bugs/16739</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by vivien
2009-10-25T02:38:12+00:00
PHP: 5.2.5 OS: Linux Package Version: 2.5.0b2

Description:
------------
Started transaction are automatically rolled back when the PHP script terminates which may be inconvenient for persistant connections (this behaviour has been tested for PostgreSQL, MySQL and SQLite at least), as visible in the disconnect() method.

I really need a way to disable that automatic rolling back.

I know that when the connection is opened again at least the @in_transaction and @nested_transaction_counter attributes of the connection _will_ be wrong because the connection is persistant, but maybe a solution can be found using $_SESSION to save all that extra information about the connection's transaction status.

I really need that bug corrected,
thanks a lot</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by vivien
2009-10-25T02:38:12+00:00
PHP: 5.2.5 OS: Linux Package Version: 2.5.0b2

Description:
------------
Started transaction are automatically rolled back when the PHP script terminates which may be inconvenient for persistant connections (this behaviour has been tested for PostgreSQL, MySQL and SQLite at least), as visible in the disconnect() method.

I really need a way to disable that automatic rolling back.

I know that when the connection is opened again at least the @in_transaction and @nested_transaction_counter attributes of the connection _will_ be wrong because the connection is persistant, but maybe a solution can be found using $_SESSION to save all that extra information about the connection's transaction status.

I really need that bug corrected,
thanks a lot</pre>]]></description>
      <dc:date>2010-03-02T15:39:04+00:00</dc:date>
      <dc:creator>malerba &amp;#x61;&amp;#116; gnome-db &amp;#x64;&amp;#111;&amp;#x74; org</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/16364">
      <title>MDB2: Feature/Change Request 16364 [Open] Add database user creation support</title>
      <link>http://pear.php.net/bugs/16364</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by richsage
2009-06-22T21:38:41+00:00
PHP: 5.2.9 OS: Fedora Linux Package Version: 2.4.1

Description:
------------
Implement in the Manager module a method eg createUser(string $username, string $password, string $database, object $permissions) which would allow the creation of a database user with the supplied password and perhaps an object with relevant permissions (eg ALTER, GRANT etc), assigning the user to a database.

Associated methods would allow the subsequent changing of passwords for users, and assignment of users to individual database.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by richsage
2009-06-22T21:38:41+00:00
PHP: 5.2.9 OS: Fedora Linux Package Version: 2.4.1

Description:
------------
Implement in the Manager module a method eg createUser(string $username, string $password, string $database, object $permissions) which would allow the creation of a database user with the supplied password and perhaps an object with relevant permissions (eg ALTER, GRANT etc), assigning the user to a database.

Associated methods would allow the subsequent changing of passwords for users, and assignment of users to individual database.</pre>]]></description>
      <dc:date>2009-06-22T21:38:41+00:00</dc:date>
      <dc:creator>rich &amp;#x64;&amp;#111;&amp;#x74; sage &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/14500">
      <title>MDB2: Feature/Change Request 14500 [Open] Support MySQL extended insert with ExecuteMultiple</title>
      <link>http://pear.php.net/bugs/14500</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by nicotine
2008-08-13T22:01:44+00:00
PHP: Irrelevant OS:  Package Version: 2.5.0b1

Description:
------------
If ExecuteMultiple could construct an extended insert on drivers that support it, it would increase performance when doing bulk inserts.

Test script:
---------------
&lt;?
$data = array(array(1,2,3),array(4,5,6),array(7,8,9));
$db-&gt;loadModule(&quot;Extended&quot;, null, false);
$sth = $db-&gt;prepare(&quot;INSERT INTO table (a,b,c) VALUES (?, ?, ?)&quot;);
$db-&gt;extended-&gt;executeMultiple($sth, $data);

Expected result:
----------------
1 SQL insert statement:
INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);

Actual result:
--------------
3 SQL insert statements
INSERT INTO table (a,b,c) VALUES (1,2,3);
INSERT INTO table (a,b,c) VALUES (4,5,6);
INSERT INTO table (a,b,c) VALUES (7,8,9)</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by nicotine
2008-08-13T22:01:44+00:00
PHP: Irrelevant OS:  Package Version: 2.5.0b1

Description:
------------
If ExecuteMultiple could construct an extended insert on drivers that support it, it would increase performance when doing bulk inserts.

Test script:
---------------
&lt;?
$data = array(array(1,2,3),array(4,5,6),array(7,8,9));
$db-&gt;loadModule(&quot;Extended&quot;, null, false);
$sth = $db-&gt;prepare(&quot;INSERT INTO table (a,b,c) VALUES (?, ?, ?)&quot;);
$db-&gt;extended-&gt;executeMultiple($sth, $data);

Expected result:
----------------
1 SQL insert statement:
INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);

Actual result:
--------------
3 SQL insert statements
INSERT INTO table (a,b,c) VALUES (1,2,3);
INSERT INTO table (a,b,c) VALUES (4,5,6);
INSERT INTO table (a,b,c) VALUES (7,8,9)</pre>]]></description>
      <dc:date>2008-08-31T17:01:21+00:00</dc:date>
      <dc:creator>nicotine &amp;#x61;&amp;#116; warningg &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/13389">
      <title>MDB2: Feature/Change Request 13389 [Open] LDAP Support</title>
      <link>http://pear.php.net/bugs/13389</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by emgillis
2008-03-13T22:47:54+00:00
PHP: 5.2.1 OS: OS X Package Version: 2.4.1

Description:
------------
First of all, I think this package is awesome!

I would, however, like to see LDAP support included. If there is 
already, 
I apologize, but I could not find it in any documentation anywhere.
Ideally, it should have (at the very least) TLS, Bind, Compare, 
Abandon, 
and Unbind  -- basically the commands for doing search / select 
queries. 

If there was support for Create, Update, Delete options, that'd be 
spectacular.

Thanks!!!</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by emgillis
2008-03-13T22:47:54+00:00
PHP: 5.2.1 OS: OS X Package Version: 2.4.1

Description:
------------
First of all, I think this package is awesome!

I would, however, like to see LDAP support included. If there is 
already, 
I apologize, but I could not find it in any documentation anywhere.
Ideally, it should have (at the very least) TLS, Bind, Compare, 
Abandon, 
and Unbind  -- basically the commands for doing search / select 
queries. 

If there was support for Create, Update, Delete options, that'd be 
spectacular.

Thanks!!!</pre>]]></description>
      <dc:date>2008-04-07T22:06:43+00:00</dc:date>
      <dc:creator>emgillis &amp;#x61;&amp;#116; yahoo &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/12157">
      <title>MDB2: Feature/Change Request 12157 [Open] Manager changeConstraint()</title>
      <link>http://pear.php.net/bugs/12157</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by ifeghali
2007-10-01T04:09:55+00:00
PHP: Irrelevant OS:  Package Version: CVS

Description:
------------
Currently MDB2_Schema doesn't handle schemas with multiple keys defined as a primary key (one being an auto increment field) because MDB2 lack the necessary tool to change a primary key. Please take a look at Bug #12154. Instead of a new method changeConstraint() another approach would be to detect inside createConstraint() when we are trying to create a PRIMARY KEY when one already exists, in this case MDB could assume that we want to replace this key.

Expected result:
----------------
Ability to perform such query:

ALTER TABLE `wp_options` DROP PRIMARY KEY , ADD PRIMARY KEY (
`option_id` , `blog_id` , `option_name` )</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by ifeghali
2007-10-01T04:09:55+00:00
PHP: Irrelevant OS:  Package Version: CVS

Description:
------------
Currently MDB2_Schema doesn't handle schemas with multiple keys defined as a primary key (one being an auto increment field) because MDB2 lack the necessary tool to change a primary key. Please take a look at Bug #12154. Instead of a new method changeConstraint() another approach would be to detect inside createConstraint() when we are trying to create a PRIMARY KEY when one already exists, in this case MDB could assume that we want to replace this key.

Expected result:
----------------
Ability to perform such query:

ALTER TABLE `wp_options` DROP PRIMARY KEY , ADD PRIMARY KEY (
`option_id` , `blog_id` , `option_name` )</pre>]]></description>
      <dc:date>2007-10-01T04:09:55+00:00</dc:date>
      <dc:creator>ifeghali &amp;#x61;&amp;#116; php &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/12038">
      <title>MDB2: Bug 12038 [Verified] Memory Leak when an error occures on an insert</title>
      <link>http://pear.php.net/bugs/12038</link>
      <content:encoded><![CDATA[<pre>MDB2 Bug
Reported by henningh
2007-09-12T21:16:47+00:00
PHP: 5.2.3 OS: Linux &amp; Windows Package Version: 

Description:
------------
Hi,
I think there's a bug in the error handling when an error occures on an insert. The error is in my case an failure on the insert because the value I try to insert is an unique one.
The error handling works fine, the problem is, that an memory leak occures. In the test script below, everything is fine, as long as there is no data in the database. The memory usage is fine.
But when i try to add a duplicate, an error is raised, as well as the memory and I get fatal error after about 855 tries. I tells me that the memory is exhausted (8MB Limit).

Tried the same thin with an own native implemtation of mysqli and everything was fine.

A friend of mine tried the script below on his Windows machine with the same effects. The only difference between the linux and the windows test is, that the memory leek does not end in an exhausted memory error.

I'm not quite sure, if this is not a generell MDB2 problem, i had no time to check this with other database types.

Test script:
---------------
&lt;?php
error_reporting(E_ALL);
ini_set('display_errors','1');
require_once('MDB2.php');
$dsn = 'mysqli://testuser:DrPig!@127.0.0.1/testdb';
$mdb2 = MDB2::connect($dsn,array('debug' =&gt; 0,'result_buffering' =&gt;false));
if(PEAR::isError($mdb2)){
	die($mdb2-&gt;getUserInfo());
}
$a=0;
for($i=1;$i&lt;=1000;$i++){
	echo 'TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES('.$a.') &lt;br&gt;';
	echo 'TESTINSERT - DEBUG - Iteration: '. $i . ' Memory useage at start: '.memory_get_usage().'&lt;br/&gt;';
	$result = $mdb2-&gt;query('Insert INTO testtable(test_id) VALUES('.$a.')');
	if(PEAR::isError($result)){
		echo $result-&gt;getUserInfo() . '&lt;br&gt;';
	}
	$a = $a +1;
}
?&gt;

Expected result:
----------------
In this version of the script you should see error messages and at the end on the second run of the script an &quot;memory exhausted&quot; error, when runnning with 8 mb.

Tried to track down this bug, but could not get far with it. As far as i have seen, the memory raises only, if an error occures and is handled in the MDB2.php


Actual result:
--------------
Linux:

TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(0)
TESTINSERT - DEBUG - Iteration: 1 Memory useage at start: 1075564
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(0)] [Native code: 1062] [Native message: Duplicate entry '0' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(1)
TESTINSERT - DEBUG - Iteration: 2 Memory useage at start: 1092244
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(1)] [Native code: 1062] [Native message: Duplicate entry '1' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(2)
TESTINSERT - DEBUG - Iteration: 3 Memory useage at start: 1100856
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(2)] [Native code: 1062] [Native message: Duplicate entry '2' for key 2] 

...

_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(852)] [Native code: 1062] [Native message: Duplicate entry '852' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(853)
TESTINSERT - DEBUG - Iteration: 854 Memory useage at start: 8378792
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(853)] [Native code: 1062] [Native message: Duplicate entry '853' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(854)
TESTINSERT - DEBUG - Iteration: 855 Memory useage at start: 8387344

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 207 bytes) in /opt/lampp/lib/php/MDB2.php on line 972



Windows:

TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(0)
TESTINSERT - DEBUG - Iteration: 1 Memory useage at start: 24690688
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(0)] [Native code: 1062] [Native message: Duplicate entry '0' for key 1]

...

TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(999)
TESTINSERT - DEBUG - Iteration: 1000 Memory useage at start: 33779712
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(999)] [Native code: 1062] [Native message: Duplicate entry '999' for key 1]</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Bug
Reported by henningh
2007-09-12T21:16:47+00:00
PHP: 5.2.3 OS: Linux &amp; Windows Package Version: 

Description:
------------
Hi,
I think there's a bug in the error handling when an error occures on an insert. The error is in my case an failure on the insert because the value I try to insert is an unique one.
The error handling works fine, the problem is, that an memory leak occures. In the test script below, everything is fine, as long as there is no data in the database. The memory usage is fine.
But when i try to add a duplicate, an error is raised, as well as the memory and I get fatal error after about 855 tries. I tells me that the memory is exhausted (8MB Limit).

Tried the same thin with an own native implemtation of mysqli and everything was fine.

A friend of mine tried the script below on his Windows machine with the same effects. The only difference between the linux and the windows test is, that the memory leek does not end in an exhausted memory error.

I'm not quite sure, if this is not a generell MDB2 problem, i had no time to check this with other database types.

Test script:
---------------
&lt;?php
error_reporting(E_ALL);
ini_set('display_errors','1');
require_once('MDB2.php');
$dsn = 'mysqli://testuser:DrPig!@127.0.0.1/testdb';
$mdb2 = MDB2::connect($dsn,array('debug' =&gt; 0,'result_buffering' =&gt;false));
if(PEAR::isError($mdb2)){
	die($mdb2-&gt;getUserInfo());
}
$a=0;
for($i=1;$i&lt;=1000;$i++){
	echo 'TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES('.$a.') &lt;br&gt;';
	echo 'TESTINSERT - DEBUG - Iteration: '. $i . ' Memory useage at start: '.memory_get_usage().'&lt;br/&gt;';
	$result = $mdb2-&gt;query('Insert INTO testtable(test_id) VALUES('.$a.')');
	if(PEAR::isError($result)){
		echo $result-&gt;getUserInfo() . '&lt;br&gt;';
	}
	$a = $a +1;
}
?&gt;

Expected result:
----------------
In this version of the script you should see error messages and at the end on the second run of the script an &quot;memory exhausted&quot; error, when runnning with 8 mb.

Tried to track down this bug, but could not get far with it. As far as i have seen, the memory raises only, if an error occures and is handled in the MDB2.php


Actual result:
--------------
Linux:

TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(0)
TESTINSERT - DEBUG - Iteration: 1 Memory useage at start: 1075564
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(0)] [Native code: 1062] [Native message: Duplicate entry '0' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(1)
TESTINSERT - DEBUG - Iteration: 2 Memory useage at start: 1092244
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(1)] [Native code: 1062] [Native message: Duplicate entry '1' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(2)
TESTINSERT - DEBUG - Iteration: 3 Memory useage at start: 1100856
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(2)] [Native code: 1062] [Native message: Duplicate entry '2' for key 2] 

...

_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(852)] [Native code: 1062] [Native message: Duplicate entry '852' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(853)
TESTINSERT - DEBUG - Iteration: 854 Memory useage at start: 8378792
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(853)] [Native code: 1062] [Native message: Duplicate entry '853' for key 2]
TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(854)
TESTINSERT - DEBUG - Iteration: 855 Memory useage at start: 8387344

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 207 bytes) in /opt/lampp/lib/php/MDB2.php on line 972



Windows:

TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(0)
TESTINSERT - DEBUG - Iteration: 1 Memory useage at start: 24690688
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(0)] [Native code: 1062] [Native message: Duplicate entry '0' for key 1]

...

TESTINSERT - DEBUG - Insert INTO testtable(test_id) VALUES(999)
TESTINSERT - DEBUG - Iteration: 1000 Memory useage at start: 33779712
_doQuery: [Error message: Could not execute statement] [Last executed query: Insert INTO testtable(test_id) VALUES(999)] [Native code: 1062] [Native message: Duplicate entry '999' for key 1]</pre>]]></description>
      <dc:date>2012-10-26T05:29:19+00:00</dc:date>
      <dc:creator>henning &amp;#x64;&amp;#111;&amp;#x74; henkel &amp;#x61;&amp;#116; dpsg-freiburg &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>MDB2 Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/11108">
      <title>MDB2: Feature/Change Request 11108 [Open] Consider a 'mock' driver for use in unit tests</title>
      <link>http://pear.php.net/bugs/11108</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by doconnor
2007-05-23T13:55:03+00:00
PHP: 5.2.1 OS:  Package Version: 2.4.1

Description:
------------
Provide an mdb2 driver for mock database handling.

The best use case for this is in unit test frameworks like phpunit, or similar.

See http://pear.php.net/bugs/bug.php?id=11107 for the original RFE, aimed at PEAR::DB</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by doconnor
2007-05-23T13:55:03+00:00
PHP: 5.2.1 OS:  Package Version: 2.4.1

Description:
------------
Provide an mdb2 driver for mock database handling.

The best use case for this is in unit test frameworks like phpunit, or similar.

See http://pear.php.net/bugs/bug.php?id=11107 for the original RFE, aimed at PEAR::DB</pre>]]></description>
      <dc:date>2013-04-09T02:18:50+00:00</dc:date>
      <dc:creator>daniel &amp;#x64;&amp;#111;&amp;#x74; oconnor &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/9332">
      <title>MDB2: Feature/Change Request 9332 [Open] Customize prepared statement name</title>
      <link>http://pear.php.net/bugs/9332</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by kailoran@...
2006-11-14T17:16:17+00:00
PHP: Irrelevant OS:  Package Version: 2.3.0

Description:
------------
It would be useful if prepare() took another argument that would be used to name the prepared statement instead of using $this-&gt;options['statement_format']. This would allow easy naming of individual statements without having to change the option every time and restoring it back afterwards.


Test script:
---------------
// One way of doing it:

/* in MDB2.php, change default options['statement_format'] to have a placeholder for a string, eg. */
'statement_format' =&gt; 'MDB2_STATEMENT%3$s_%1$s_%2$s'

/* change the definition of prepare() */
function &amp;prepare($query, $types = null, $result_types = null, $lobs = array(), $statement_name = '')


/* in the prepare() functions, use the new parameter */
...
    $statement_name = sprintf($this-&gt;options['statement_format'], $statement_name, $this-&gt;phptype, md5(time() + rand()), $statement_name);</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by kailoran@...
2006-11-14T17:16:17+00:00
PHP: Irrelevant OS:  Package Version: 2.3.0

Description:
------------
It would be useful if prepare() took another argument that would be used to name the prepared statement instead of using $this-&gt;options['statement_format']. This would allow easy naming of individual statements without having to change the option every time and restoring it back afterwards.


Test script:
---------------
// One way of doing it:

/* in MDB2.php, change default options['statement_format'] to have a placeholder for a string, eg. */
'statement_format' =&gt; 'MDB2_STATEMENT%3$s_%1$s_%2$s'

/* change the definition of prepare() */
function &amp;prepare($query, $types = null, $result_types = null, $lobs = array(), $statement_name = '')


/* in the prepare() functions, use the new parameter */
...
    $statement_name = sprintf($this-&gt;options['statement_format'], $statement_name, $this-&gt;phptype, md5(time() + rand()), $statement_name);</pre>]]></description>
      <dc:date>2006-11-14T17:16:17+00:00</dc:date>
      <dc:creator>kailoran &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/6907">
      <title>MDB2: Feature/Change Request 6907 [Open] PDO based drivers (was: SQLite Version 3 Support)</title>
      <link>http://pear.php.net/bugs/6907</link>
      <content:encoded><![CDATA[<pre>MDB2 Feature/Change Request
Reported by priplatv@...
2006-02-23T15:24:06+00:00
PHP: 5.1.2 OS: Irrelevant Package Version: 

Description:
------------
Could you please let us know, whether it is the intention to support version 3 of SQLite within the DB package, together with version 2 obviously, and by when? With the bundled availability of SQLite Version 3 within PHP 5.x it would be a big advantage to have this support within PEAR, allowing developers to move to the latest (and better) version of SQLite easily.
Many thanks.</pre>]]></content:encoded>
      <description><![CDATA[<pre>MDB2 Feature/Change Request
Reported by priplatv@...
2006-02-23T15:24:06+00:00
PHP: 5.1.2 OS: Irrelevant Package Version: 

Description:
------------
Could you please let us know, whether it is the intention to support version 3 of SQLite within the DB package, together with version 2 obviously, and by when? With the bundled availability of SQLite Version 3 within PHP 5.x it would be a big advantage to have this support within PEAR, allowing developers to move to the latest (and better) version of SQLite easily.
Many thanks.</pre>]]></description>
      <dc:date>2008-04-12T23:59:07+00:00</dc:date>
      <dc:creator>priplatv &amp;#x61;&amp;#116; netscape &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>MDB2 Feature/Change Request</dc:subject>
    </item>
</rdf:RDF>
