Problems with i5_prepare and i5_execute on UPDATE row

General discussion on Zend Core for IBM System i

Problems with i5_prepare and i5_execute on UPDATE row

Postby frapebehr on Thu May 19, 2011 4:44 pm

Hi, I have a problem with i5_prepare and i5_execute when update a row:

Code: Select all
$sql = "UPDATE EVENTNOTIFICATIONINFORMATION SET answer = ?, hasended = ? WHERE id = ?";
$stmt = i5_prepare($sql, $conn);


results: resource(2) of type (easycom result)

and the values must be strings, integer or nulls causes error 36 unable to set the value (out of range, ...)
Code: Select all
array(3) {
  ["answer"]=>
  string(7) "Confirm"
  ["hasended"]=>
  string(1) "1"
  ["idWhere"]=>
  string(1) "2"
}


When execute it:
Code: Select all
$result = i5_execute($stmt, array_values($ary))
$i5_err = i5_error($conn);         
echo($i5_err['cat'] . ' : ' . $i5_err['desc'] . ' (' . $i5_err['num'] . ') ' . $i5_err['msg']);


Results: 9 : (0) There is no error!

Has not errors, but the row is not updated!

If I execute this sentence:

Code: Select all
sql = "UPDATE EVENTNOTIFICATIONINFORMATION SET answer = 'JandlerClander', hasended = 1 WHERE id = 2";
$result = i5_query($sql);    


The row is updated!!!

The table has autoincrement primary key and constraint restrictions, but If i5_query runs fine, i5_prepare and i5_execute must runs fine too.

The environment is an i5/0S V6R1 and PHP Version 5.3.1

PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,NTS
PHP Extension Build API20090626,NTS

Easycom For PHP v3
Product Easycom For PHP For IBM i ( i5 PHP ToolKit )
Author AURA Equipements (c) - http://www.easycom-aura.com
PHP For IBM i enabled
Linux PHP Server disabled
Windows PHP Server disabled
Build Date Mar 29 2010
Version 3.0.0.29

Any sugestion or workarround?

Thanks in advanced :-)
frapebehr
 
Posts: 2
Joined: Thu May 19, 2011 4:35 pm

Re: Problems with i5_prepare and i5_execute on UPDATE row

Postby frapebehr on Thu May 19, 2011 5:56 pm

Note: db2_prepare and db2_execute runs as expected.
frapebehr
 
Posts: 2
Joined: Thu May 19, 2011 4:35 pm

Re: Problems with i5_prepare and i5_execute on UPDATE row

Postby erich_hieden on Fri May 20, 2011 8:11 am

Have you tried using a select statement with db2_prepare and db2_execute? I suppose there is a problem with the datatype and he doesn't find a row to update. So please check if you get rows returned when using 'SELECT * FROM EVENTNOTIFICATIONINFORMATION WHERE id = ?' and '$ary = array('idWhere' => '2');'

The other possibility I can think of: Maybe autocommit is turned of and since you don't do a commit the statement is rolled back.

I hope this was of any help.
erich_hieden
 
Posts: 393
Joined: Tue Jul 07, 2009 9:01 am

Re: Problems with i5_prepare and i5_execute on UPDATE row

Postby glee8045 on Fri Sep 13, 2013 1:59 pm

Have you tried using a select statement with db2_prepare and db2_execute? I suppose there is a problem with the datatype and he doesn't find a row to update. So please check if you get rows returned when using 'SELECT * FROM EVENTNOTIFICATIONINFORMATION WHERE id = ?' and '$ary = array('idWhere' => '2');'

The other possibility I can think of: Maybe autocommit is turned of and since you don't do a commit the statement is rolled back.

I hope this was of any help.


I think this suggestion is much better because when I tried it, it works well for me.
glee8045
 
Posts: 21
Joined: Wed Jul 31, 2013 5:34 am

Re: Problems with i5_prepare and i5_execute on UPDATE row

Postby pete3366 on Sat Sep 06, 2014 10:42 am

I think the functionality of Autocommit is turned off that the reason the commit statement is not call back the fuctionality.
pete3366
 
Posts: 3
Joined: Thu Sep 04, 2014 8:26 am


Return to Zend Core for i5/OS

Who is online

Users browsing this forum: No registered users and 1 guest