dbTalk Databases Forums  

Prepared statements

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Prepared statements in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Prepared statements - 08-10-2006 , 03:42 AM






Hello,

can anybody help me with mysql++ and prepared statements? Correspond the
example in the following code a prepared statement?

mysqlpp::Query query = con.query();

query << "create table stock (item char(20) not null, "
"num bigint, weight double, price double, sdate date)";
query.execute();


query << "insert into stock values (%0q, %1q, %2, %3, %4q)";
query.parse();


query.execute("Nürnberger Brats", 92, 1.5, 8.79, "2005-03-10");
query.execute("Pickle Relish", 87, 1.5, 1.75, "1998-09-04");
query.execute("Hot Mustard", 75, .95, .97, "1998-05-25");
query.execute("Hotdog Buns", 65, 1.1, 1.1, "1998-04-23");


Is the following insert faster than the previous one?

query << "insert into stock values "
<< "(Nürnberger Brats', 92, 1.5, 8.79, '2005-03-10'),"
<< "('Pickle Relish', 87, 1.5, 1.75, '1998-09-04'),"
<< "('Hot Mustard', 75, .95, .97, '1998-05-25'),"
<< "('Hotdog Buns', 65, 1.1, 1.1, '1998-04-23')";
query.execute();


Regards,
Rene

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Prepared statements - 08-10-2006 , 07:32 AM






Rene Brunner wrote:
Quote:
can anybody help me with mysql++ and prepared statements? Correspond the
example in the following code a prepared statement?
AFAIK, MySQL++ has no explicit support for prepared statements. If you
can think of a way to implement such a thing, I'd be happy to discuss a
proposal or a patch.

Quote:
Is the following insert faster than the previous one?
Probably. I can't think of a single feature in MySQL++ that's meant to
make the program work faster. Everything is there to allow the
_programmer_ to work faster, which is generally more important.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Prepared statements - 08-10-2006 , 12:32 PM



On Thu, Aug 10, 2006 at 10:40:18AM +0200, Rene Brunner wrote:
Quote:
Is the following insert faster than the previous one?
The only difference would be the (likely small) difference in building
the SQL statement. The actual communication with the server would be the
same, and slow, for multiple queries.

I recently almost had the need to write some prepared statements, but the
project requirements changed so I didn't have to. It would definitely
be a cool addition to mysql++.

- Chris


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



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.