tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

TDbCommand execute method fails with multiple param binds #312

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write code that calls bindParameter() more than once:
      $command = $db->createCommand($sqlStatement);
      $command->bindParameter(":sname",$newSchool,PDO::PARAM_STR);
      $command->bindParameter(":idchap",$idchap,PDO::PARAM_INT);
2. Call execute():
      $command->execute();

What is the expected output? What do you see instead?

You expect all the bound parameters to be written; only the first field in the 
table's field roster actually gets written.

This happens because execute() must be overloaded to properly wrap the 
functionality of PDO execute().  To wit:

http://anvilstudios.co.za/blog/mysql/pdoexception-hy000/#more-8

You need to pass an associative array to execute().  query() does not have this 
problem.

What version of the product are you using? On what operating system?

Prado 3.1.7 release -- Windows for development

Please provide any additional information below.

Original issue reported on code.google.com by cfroog2...@windstream.net on 26 Feb 2011 at 2:32

GoogleCodeExporter commented 9 years ago
I've just ported the "blog" demo to the use of PDO  but i've not encountered 
your problem.. could it be that you were using bindParam() when you wanted 
bindValue()?

Original comment by ctrlal...@gmail.com on 16 Nov 2011 at 10:17

GoogleCodeExporter commented 9 years ago

Original comment by ctrlal...@gmail.com on 22 Dec 2011 at 1:40