dbTalk Databases Forums  

MySQL stored procedures (MySQL Connector)

comp.databases.mysql comp.databases.mysql


Discuss MySQL stored procedures (MySQL Connector) in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Przemek M. Zawada
 
Posts: n/a

Default MySQL stored procedures (MySQL Connector) - 09-17-2010 , 09:58 PM






Dear Friends,

I've received lately quite common (as I've researched) error, which
occurs as following:

Commands out of sync; you can't run this command now

The problem is, that I'm not able to determine whether I'm doing
something wrong, my database server is to old or anything else.

I've discovered, that when I'm sending queries to database,where I
request for database VIEW mode, I'm able to loop them lots of times but
when I request for stored procedure I receive an error.

My query function looks like so:

bool Database_Object::Query(sql::SQLString queryString, sql::ResultSet
**resultSet) {
if(this->mysqlConnection != NULL) {
try {
this->mysqlStatement = this->mysqlConnection->createStatement();
if(this->mysqlStatement != NULL) {
if((*(resultSet) = this->mysqlStatement->executeQuery(queryString))
!= NULL) {
delete this->mysqlStatement;
return true;
} else return false;
}
} catch( sql::SQLException &e ) {};
return false;
}

Of course in function where I work with ResultSet* after while(next())
loop I execute the resultSet->close().

The fact is, that while I'm not calling any stored procedures, my MYSQL
log shows that my application starts and ends and sql::Connection opens
and closes (while i "delete" the *Connection), ie:

Connect rally (AT) 192 (DOT) 168.0.66 on
Query set autocommit=1
Query SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ
Query SHOW SESSION VARIABLES LIKE 'lower_case_table_names'
Query USE `RR_virtual`
Query SET character_set_results = 'utf8', character_set_client =
'utf8', character_set_connection = 'utf8', character_set_database =
'utf8', character_set_server = 'utf8'
Query SELECT * FROM Team_Select_Teams T
Query SELECT * FROM Stage_Select_Active T
Quit [QQQ]

When I execute any stored procedure, my app ends but the "Quit" [QQQ]
line in log file does not appear. What am I doing wrong?

Fortunately all other things are working fine except the stored procedures.
Any suggestions would be appropriated.

All the best,
Przemek M. Zawada

Reply With Quote
  #2  
Old   
Axel Schwenke
 
Posts: n/a

Default Re: MySQL stored procedures (MySQL Connector) - 09-19-2010 , 01:16 PM






"Przemek M. Zawada" <przemek.zawada (AT) gmail (DOT) com> wrote:

Quote:
I've received lately quite common (as I've researched) error, which
occurs as following:
Commands out of sync; you can't run this command now

The problem is, that I'm not able to determine whether I'm doing
something wrong, my database server is to old or anything else.
....

Quote:
Fortunately all other things are working fine except the stored procedures.
Any suggestions would be appropriated.
I suggest to study the manual.

A stored procedure can return many result sets and you have to call
mysql_next_result() (or the equivalent) until it signals "no more
result sets". Only then you can execute the next SQL statement in
this connection.

http://dev.mysql.com/doc/refman/5.1/...xt-result.html

and also

http://dev.mysql.com/doc/refman/5.1/...ored-procedure


XL

Reply With Quote
Reply




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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.