Zend Framework

Zend_Db_Adapter_Db2 does not work with iSeries (AS/400)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.7.1
  • Fix Version/s: 1.7.3
  • Component/s: Zend_Db_Adapter_Db2
  • Labels:
    None
  • Fix Version Priority:
    Should Have

Description

The reason is the sql statement in the describeTable() method. If you change it to our version, it works. We have created a modified version of Zend_Db_Adapter_Db2 called Zend_Db_Adapter_Db2iseries, that overloads this method, but I think, that some kind of option in Zend_Db_Adapter_Db2 will be better.
We are using ZF 1.5.3 now, so it is possible, that it will be necessary to adapt the code for 1.7.x

It seems, that this will not work for z/OS version of DB2, only for AS400

This is our sql code:

$sql = "SELECT DISTINCT c.table_schema, c.table_name, c.column_name, c.ordinal_position,
c.data_type, c.column_default, c.is_nullable, c.length, c.numeric_scale,
c.is_identity, tc.type AS tabconsttype, k.colseq
FROM qsys2.syscolumns c
LEFT JOIN (qsys2.syskeys k JOIN qsys2.syscst tc
ON (k.index_schema = tc.table_schema
AND k.index_name = tc.table_name
AND tc.type = 'PRIMARY KEY'))
ON (c.table_schema = k.index_schema
AND c.table_name = k.index_name
AND c.column_name = k.column_name)
WHERE "
. $this->quoteInto('UPPER(c.table_name) = UPPER', $tableName);
if ($schemaName) { $sql .= $this->quoteInto(' AND UPPER(c.table_schema) = UPPER(?)', $schemaName); }
$sql .= " ORDER BY c.ordinal_position";

Activity

Hide
Wil Sinclair added a comment -

Can't you close this with fix for 1.7.0, Ralph?

Show
Wil Sinclair added a comment - Can't you close this with fix for 1.7.0, Ralph?
Hide
Satoru Yoshida added a comment -

Solved in SVN r13093

Show
Satoru Yoshida added a comment - Solved in SVN r13093
Hide
Ralph Schindler added a comment -

Satoru, the changes you applied broke unit tests on i5 for OS400 on my v5r4. I am gonna update, then can you test on your i5?

Will keep you posted.

-ralph

Show
Ralph Schindler added a comment - Satoru, the changes you applied broke unit tests on i5 for OS400 on my v5r4. I am gonna update, then can you test on your i5? Will keep you posted. -ralph
Hide
Satoru Yoshida added a comment -

Hi, Ralph. Ok , I will test on my i5 after your commits.

Show
Satoru Yoshida added a comment - Hi, Ralph. Ok , I will test on my i5 after your commits.
Hide
Satoru Yoshida added a comment -

I schedule to work on this in May/2009.

Show
Satoru Yoshida added a comment - I schedule to work on this in May/2009.
Hide
Satoru Yoshida added a comment -

I confirm this issue would not be shown in following test code.
This seems to be resolved in 1.7.3 .

class Db2Controller extends Zend_Controller_Action {
    protected $_db;
    public function init() {
        $this->_db = Zend_Db::factory('Db2',
            array(
            'host' => '127.0.0.1',
            'username' => 'YOUR USER',
            'password' => 'YOUR PASS',
            'dbname'   => 'DSPRDBDIRE VALUE')
        );
        $this->_helper->viewRenderer->setNoRender(TRUE);
    }

    public function indexAction() {
        $this->_db->getConnection();
        $sql = 'SELECT * FROM ZTESTL.ZTESTF WHERE COLA = ?';
        $result = $this->_db->fetchAll($sql, 'T001');
        var_dump($result);
        $this->_db->closeConnection();
    }
}
Show
Satoru Yoshida added a comment - I confirm this issue would not be shown in following test code. This seems to be resolved in 1.7.3 .
class Db2Controller extends Zend_Controller_Action {
    protected $_db;
    public function init() {
        $this->_db = Zend_Db::factory('Db2',
            array(
            'host' => '127.0.0.1',
            'username' => 'YOUR USER',
            'password' => 'YOUR PASS',
            'dbname'   => 'DSPRDBDIRE VALUE')
        );
        $this->_helper->viewRenderer->setNoRender(TRUE);
    }

    public function indexAction() {
        $this->_db->getConnection();
        $sql = 'SELECT * FROM ZTESTL.ZTESTF WHERE COLA = ?';
        $result = $this->_db->fetchAll($sql, 'T001');
        var_dump($result);
        $this->_db->closeConnection();
    }
}

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
1h 40m
Time Spent - 1 hour, 40 minutes