Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:


Go Back   Caucho Forums > Quercus

Reply
 
Thread Tools Display Modes
  #1  
Old 12-27-2013, 09:14 PM
remaus remaus is offline
Junior Member
 
Join Date: Dec 2013
Posts: 1
Default multiple prepared statements using PDO in php

I have a lot of php code that runs against a MySQL MyISAM database using the old (deprecated) mysql driver. I am trying to get the applications to run under Resin/quercus (4.0.37) with the desire to use multiple prepared statements against a single database connection. However, we keep running into the following error.

C:\resin-4.0.37\webapps\ROOT\testPdoStatements.php:21: Fatal Error: Uncaught exception of type 'PDOException' with message 'SQLSTATE[S1000]: No operations allowed after statement closed'

The code is fairly simple. I get a connection, prepare 2 statements but when I execute the first, the error is thrown. If I only prepare the one statement and execute, it works fine. This is show stopper for us. We need to prepare multiple statements. Does anyone have an example?

<?php

$pdo = new PDO("java:comp/env/jdbc/mysql&quot;

// grumble
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// preparations
$s = "select * from ItemCtlg where Str = :catalog";
$stmt1 = $pdo->prepare($s, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt1->bindParam(':catalog', $Catalog, PDO::PARAM_STR);

$c = "select * from PartsOeStore where Str = :store";
$stmt2 = $pdo->prepare($c, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt2->bindParam(':store', $Store, PDO::PARAM_STR);

// executions
$Catalog = 'myCatalog';
$Store = 'myStore';

$stmt1->execute();

==> produces error.
Reply With Quote
  #2  
Old 01-02-2014, 04:40 PM
nam nam is offline
Administrator
 
Join Date: Aug 2009
Posts: 337
Default

Hi remaus,

I just fixed this for the upcoming 4.0.39 release. Let me know if you would like a snapshot release.
Reply With Quote
Reply

Tags
pdo, pdo_statements

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:57 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.