User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools




This page is to track fixes that we have applied to the ADODB version distributed with Mantis. The aim of the page is to be able to reapply these fixes when we upgrade and to keep track of whether these fixes are applied to the official ADODB version (noting the version number with the fix).

Commits with Fixes

  • 4584 - More changes relating to #8384: db_table_exists() doesn't work in case of DB2.
    • Reported via email sent on 22nd of October 2007
  • 4583 - Fixed #8387: adodb2-db2.DBTimeStamp uses TO_DATE() which doesn't work on DB2.
    • Reported via email sent on 22nd of October 2007
  • 4582 - Fixed #8386: ADODB_db2 uses an invalid time format which is not accepted by db2.
    • Reported via email sent on 22nd of October 2007
  • 4581 - Fixed #8385: ADODB_db2._insert_id doesn't work.
    • Reported via email sent on 22nd of October 2007
  • 4364 - Fixed #5333: Invalid zip file core/adodb/ in CVS.
    • Reported via email sent on 22nd of October 2007

Emails to ADODB

  • Email sent to John Lim on 22nd of October 2007
Hi, John,

I'm working with a team from IBM and Zend, and Victor Boctor of the Mantis Bug Tracker, to port Mantis to DB2/400 (IBM System i).

Mantis uses ADODB, so we're interested in fixing any DB2 bugs we find in ADODB.

Here are 4 bugs we found in ADODB 5's DB2 driver ( I've also attached the modified version of Please let me know what else I can do to help.

1. $fmtTimeStamp needed a DB2-compatible format.

class ADODB_db2 extends ADOConnection {
    // original:  var $fmtTimeStamp = "'Y-m-d-H:i:s'";
    // DB2 valid formats: Y-m-d-H.i.s (IBM SQL format, center dash and dots) or Y-m-d H:i:s (ISO format, center space and colons). We'll use ISO: Y-m-d H:i:s 
    var $fmtTimeStamp = "'Y-m-d H:i:s'";

2. _insertid() needs DB2-specific SQL.

     function _insertid()
//   original:     return ADOConnection::GetOne('VALUES IDENTITY_VAL_LOCAL()');

3. DBTimeStamp: remove the unsupported TO_DATE function.

// format and return date string in database timestamp format
    function DBTimeStamp($ts)
        if (empty($ts) && $ts !== 0) return 'null';
        if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
//   original: return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'YYYY-MM-DD HH24:MI:SS')";
//   remove TO_DATE, which is not supported on DB2/400.
        return adodb_date($this->fmtTimeStamp,$ts);


4. Metatables has several changes that allow table and schema to be specified, much as with ODBC and other drivers.

// original:    function MetaTables($ttype=false,$schema=false)
// DB2/400 Allow table and schema as optional parameters. Use $showSchema instead of $schema for consistency with other drivers.
    function MetaTables($ttype=false,$showSchema=false, $qtable="%", $qschema="%")

    global $ADODB_FETCH_MODE;
        $savem = $ADODB_FETCH_MODE;
// DB2/400 original:    $qid = db2_tables($this->_connectionID);
        $qid = db2_tables($this->_connectionID, null, $qschema, $qtable);       
        $rs = new ADORecordSet_db2($qid);
        $ADODB_FETCH_MODE = $savem;
        if (!$rs) {
            $false = false;
            return $false;
        $arr = $rs->GetArray();

        $arr2 = array();
        if ($ttype) {
            $isview = strncmp($ttype,'V',1) === 0;
        for ($i=0; $i < sizeof($arr); $i++) {
            if (!$arr[$i][2]) continue;
            $type = $arr[$i][3];
// original:      $schemaval = ($schema) ? $arr[$i][1].'.' : '';
// use $showSchema instead of $schema, for consistency with
            $schemaval = ($showSchema) ? $arr[$i][1].'.' : '';
            if ($ttype) {
                if ($isview) {
                    if (strncmp($type,'V',1) === 0) $arr2[] = $schemaval.$arr[$i][2];
                } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2];
            } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2];
        return $arr2;

Best regards,
mantisbt/adodb_fixes.txt · Last modified: 2008/10/29 04:25 by

Driven by DokuWiki