Re: [Cppcms-users] How to call MySQL store procedure
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2011-07-28 19:32:58
|
To: cpp...@li... >Sent: Thursday, July 28, 2011 5:21 PM >Subject: Re: [Cppcms-users] How to call MySQL store procedure > > >It seems that CPPDB doesn't support store procedure for now. Any plan for this? >I have to use MySQL++ now. >陈抒 >Best regards >http://blog.csdn.net/sheismylife > > Do you have any specific problems calling stored procedures? See: http://dev.mysql.com/doc/refman/5.5/en/call.html I don't see something specific that would prevent from executing "CALL " statement or query. This example from the site: mysql_query(mysql, "SET @increment = 10"); mysql_query(mysql, "CALL p(@version, @increment)"); mysql_query(mysql, "SELECT @version, @increment"); result = mysql_store_result(mysql); row = mysql_fetch_row(result); mysql_free_result(result); Can be executed as; sql << "SET @increment = 10" << cppdb::exec; sql << "CALL p(@version, @increment)" << cppdb::exec; cppdb::result r = sql << "SELECT @version, @increment"; By default CppDB uses prepared statements, if you want unprepared onces (I don't know if mysql requires unprepared statements for such things) you may call sql.create_statement("SET @increment = 10").exec(); sql.create_statement("CALL p(@version, @increment)").exec(); cppdb::result r = sql.create_statement("SELECT @version, @increment"); If you have any specific problems using CALL syntax tell exactly what you are doing and probably provide a simple use case that shows the problem. Artyom |