mantisbt:adodb_fixes
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
mantisbt:adodb_fixes [2007/11/03 12:46] – created vboctor | mantisbt:adodb_fixes [2008/10/29 04:25] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 8: | Line 8: | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[http:// |
+ | * Reported via email sent on 22nd of October 2007 | ||
* [[http:// | * [[http:// | ||
+ | * Reported via email sent on 22nd of October 2007 | ||
* [[http:// | * [[http:// | ||
+ | * Reported via email sent on 22nd of October 2007 | ||
* [[http:// | * [[http:// | ||
+ | * Reported via email sent on 22nd of October 2007 | ||
* [[http:// | * [[http:// | ||
+ | * 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 (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: | ||
+ | // 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 = "' | ||
+ | |||
+ | |||
+ | 2. _insertid() needs DB2-specific SQL. | ||
+ | |||
+ | | ||
+ | { | ||
+ | // | ||
+ | // | ||
+ | return ADOConnection:: | ||
+ | } | ||
+ | |||
+ | |||
+ | 3. DBTimeStamp: | ||
+ | |||
+ | // format and return date string in database timestamp format | ||
+ | function DBTimeStamp($ts) | ||
+ | { | ||
+ | if (empty($ts) && $ts !== 0) return ' | ||
+ | if (is_string($ts)) $ts = ADORecordSet:: | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | return adodb_date($this-> | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | 4. Metatables has several changes that allow table and schema to be specified, much as with ODBC and other drivers. | ||
+ | |||
+ | // original: | ||
+ | // DB2/400 Allow table and schema as optional parameters. Use $showSchema instead of $schema for consistency with other drivers. | ||
+ | function MetaTables($ttype=false, | ||
+ | |||
+ | { | ||
+ | global $ADODB_FETCH_MODE; | ||
+ | |||
+ | $savem = $ADODB_FETCH_MODE; | ||
+ | $ADODB_FETCH_MODE = ADODB_FETCH_NUM; | ||
+ | // DB2/400 original: | ||
+ | $qid = db2_tables($this-> | ||
+ | |||
+ | $rs = new ADORecordSet_db2($qid); | ||
+ | |||
+ | $ADODB_FETCH_MODE = $savem; | ||
+ | if (!$rs) { | ||
+ | $false = false; | ||
+ | return $false; | ||
+ | } | ||
+ | |||
+ | $arr = $rs-> | ||
+ | |||
+ | $rs-> | ||
+ | $arr2 = array(); | ||
+ | |||
+ | if ($ttype) { | ||
+ | $isview = strncmp($ttype,' | ||
+ | } | ||
+ | for ($i=0; $i < sizeof($arr); | ||
+ | if (!$arr[$i][2]) continue; | ||
+ | $type = $arr[$i][3]; | ||
+ | // original: | ||
+ | // use $showSchema instead of $schema, for consistency with odbc_db2.inc.php | ||
+ | $schemaval = ($showSchema) ? $arr[$i][1].' | ||
+ | if ($ttype) { | ||
+ | if ($isview) { | ||
+ | if (strncmp($type,' | ||
+ | } else if (strncmp($type,' | ||
+ | } else if (strncmp($type,' | ||
+ | } | ||
+ | return $arr2; | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Best regards, | ||
+ | Alan | ||
+ | </ | ||
mantisbt/adodb_fixes.1194108411.txt.gz · Last modified: 2008/10/29 04:31 (external edit)