albankora / db2php

Automatically exported from code.google.com/p/db2php
GNU General Public License v3.0
0 stars 0 forks source link

Undefined index when executing findById #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. generate model for test table (2 fields - id, description)
2. execute $record =OrmtestModel::findById($db, 1);

I expect to get the record where id=1

but instead get the following error

Code: 8
Message: Undefined index: SELECT * FROM `ormtest` WHERE `id`=?
File: OrmtestModel.class.php
Line: 235

I am using version 1.105 in Netbeans 7.1.2

However, if I execute 

Ormtest::findBySql($db, "select * from ormtest where id = 1")

The correct record is returned.

Original issue reported on code.google.com by cvpeter...@gmail.com on 3 Jul 2012 at 8:39

GoogleCodeExporter commented 8 years ago
I can confirm this bug on a PHP 5.3. enabled server. It seems like the null 
check within the prepareStatment class doesn't work. Faulty line:

if (null===self::$stmts[$statement][$dbInstanceId]) {

Original comment by xte...@xtermi.at on 22 Jul 2012 at 8:35

GoogleCodeExporter commented 8 years ago
What database are you using? Maybe change the quote style when generating.

Original comment by rc.poi...@gmail.com on 13 Aug 2012 at 12:22

GoogleCodeExporter commented 8 years ago
Oh, right :/ The reason for that was that array_key_exists() is unbelievably 
slow. 
What surprises me is that it should only emit a E_NOTICE instead of an error.
Since php-5.3 breaks that code, I pushed a new version.
Since this was built on my mobile phone and I don't have netbeans there, please 
tell me if the plugin works :)

Original comment by rc.poi...@gmail.com on 13 Aug 2012 at 1:10

GoogleCodeExporter commented 8 years ago
Work fine THX!

Original comment by molnar.m...@gmail.com on 13 Aug 2012 at 3:00