List:MySQL++« Previous MessageNext Message »
From:Roger (COM Chantry CA) Urscheler Date:March 6 2007 9:05pm
Subject:RE: Mysqlpp 2.2.1 template problem
View as plain text  
Yes, your works. Thanks Jim. 

Basically it comes down to this: When calling a query or stored procedure
with EXACT ONE parameter, then the template modifier (q) in required as part
of the template query, even when the parameter is an interger.

This seems to be a bug, especially since this was working fine in 2.1.7.

See 1 parameter examples below that work and don't work.


Works:
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0q:xxx)";
            query2.parse();
            query2.def["xxx"] = "1111111111111111";
            TRACE_SQL(query2.preview());
            query2.execute();

Does not work:
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0:xxx)";
            query2.parse();
            query2.def["xxx"] = "1111111111111111";
            TRACE_SQL(query2.preview());
            query2.execute();

Does not work:
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0:xxx)";
            query2.parse();
            query2.def["xxx"] = "'1111111111111111'";
            TRACE_SQL(query2.preview());
            query2.execute();

Changing the parameter to an integer:

Works:
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0q)";
            query2.parse();
            query2.def[0U] = "55";
            TRACE_SQL(query2.preview());
            query2.execute();

Does not work:
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0)";
            query2.parse();
            query2.def[0U] = "55";
            TRACE_SQL(query2.preview());
            query2.execute();



-----Original Message-----
From: Jim Wallace [mailto:jwallace@stripped] 
Sent: Tuesday, March 06, 2007 3:08 PM
To: Urscheler, Roger (COM Chantry CA); MySQL++ Mailing List
Subject: RE: Mysqlpp 2.2.1 template problem

Nothing jumps out.  All my SPs have > 1 param.  Does this work?

            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0q)";
            query2.parse();
            query2.def[0U] = "1111111111111111";
            TRACE_SQL(query2.preview());
            query2.execute();

-----Original Message-----
From: Urscheler, Roger (COM Chantry CA)
[mailto:roger.urscheler@stripped]
Sent: Tuesday, March 06, 2007 1:37 PM
To: MySQL++ Mailing List
Subject: Mysqlpp 2.2.1 template problem

Can anybody tell me why I cannot call a SP with a single parameter with
index 0?
I have a stored procedure that takes a single IN parameter of type
VARCHAR(255).

It seems that when havng only a single parameter the index cannot be 0.
Btw: The same code worked with 2.1.7.

This works:
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%1:ap_serial)";
            query2.parse();
            query2.def["ap_serial"] = "'1111111111111111'";
            TRACE_SQL(query2.preview());
            query2.execute();

This too (if changing the SP to accept a second IN parameter:
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0:ap_serial,%1:second_par)";
            query2.parse();
            query2.def["ap_serial"] = "'1111111111111111'";
            query2.def["second_par"] = "55";
            TRACE_SQL(query2.preview());
            query2.execute();

But this causes error:
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'CALL
sp_test('1111111111111111')'
            mysqlpp::Query query2 = con->query();
            query2 << "CALL sp_test(%0:ap_serial)";
            query2.parse();
            query2.def["ap_serial"] = "'1111111111111111'";
            TRACE_SQL(query2.preview());
            query2.execute();



__________________________________________________
roger.urscheler@stripped <mailto:roger.urscheler@stripped>  ::
(905) 363-6400 x 6446 Chantry Networks, Siemens AG ::
www.chantrynetworks.com <http://www.chantrynetworks.com>  
Thread
Mysqlpp 2.2.1 template problemCOM Chantry CA)6 Mar
RE: Mysqlpp 2.2.1 template problemJim Wallace6 Mar
RE: Mysqlpp 2.2.1 template problemCOM Chantry CA)6 Mar
  • Re: Mysqlpp 2.2.1 template problemWarren Young6 Mar
RE: Mysqlpp 2.2.1 template problemCOM Chantry CA)7 Mar
  • Re: Mysqlpp 2.2.1 template problemWarren Young7 Mar
RE: Mysqlpp 2.2.1 template problemCOM Chantry CA)9 Mar
  • Re: Mysqlpp 2.2.1 template problemWarren Young16 Mar
Re: Mysqlpp 2.2.1 template problemWarren Young17 Mar