User Tools

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

Site Tools


mantisbt:adodb_fixes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mantisbt:adodb_fixes [2007/11/03 12:46] – created vboctormantisbt:adodb_fixes [2008/10/29 04:25] (current) – external edit 127.0.0.1
Line 8: Line 8:
  
   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4715|4715]] - ADODB PGSQL DATA FIX   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4715|4715]] - ADODB PGSQL DATA FIX
-  * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4584|4584]] - More changes relating to #8384.+  * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4584|4584]] - More changes relating to [[http://www.mantisbt.org/bugs/view.php?id=8384|#8384]]: db_table_exists() doesn't work in case of DB2. 
 +    * Reported via email sent on 22nd of October 2007
   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4583|4583]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=8387|#8387]]: adodb2-db2.DBTimeStamp uses TO_DATE() which doesn't work on DB2.   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4583|4583]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=8387|#8387]]: adodb2-db2.DBTimeStamp uses TO_DATE() which doesn't work on DB2.
 +    * Reported via email sent on 22nd of October 2007
   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4582|4582]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=8386|#8386]]: ADODB_db2 uses an invalid time format which is not accepted by db2.   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4582|4582]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=8386|#8386]]: ADODB_db2 uses an invalid time format which is not accepted by db2.
 +    * Reported via email sent on 22nd of October 2007
   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4581|4581]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=8385|#8385]]: ADODB_db2._insert_id doesn't work.   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4581|4581]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=8385|#8385]]: ADODB_db2._insert_id doesn't work.
 +    * Reported via email sent on 22nd of October 2007
   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4364|4364]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=5333|#5333]]: Invalid zip file core/adodb/adodb-time.zip in CVS.   * [[http://mantisbt.svn.sourceforge.net/viewvc/mantisbt?view=rev&revision=4364|4364]] - Fixed [[http://www.mantisbt.org/bugs/view.php?id=5333|#5333]]: Invalid zip file core/adodb/adodb-time.zip in CVS.
 +    * Reported via email sent on 22nd of October 2007
 +
 +===== Emails to ADODB =====
 +
 +  * Email sent to John Lim on 22nd of October 2007
 +<code>
 +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 (adodb-db2.inc.php). I've also attached the modified version of adodb-db2.inc.php. 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()');
 +//
 +        return ADOConnection::GetOne('SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1');
 +    }
 +
 +
 +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;
 +        $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
 +// 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();
 +
 +        $rs->Close();
 +        $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 odbc_db2.inc.php
 +            $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,
 +Alan
 +</code>
  
mantisbt/adodb_fixes.1194108411.txt.gz · Last modified: 2008/10/29 04:31 (external edit)

Driven by DokuWiki