3 messages in com.mysql.lists.plusplusRe: seperating query from connect
FromSent OnAttachments
Maier, Rainer21 Jan 2004 08:12 
Mark Scholtens21 Jan 2004 23:13 
Sinisa Milivojevic22 Jan 2004 03:43 
Subject:Re: seperating query from connect
From:Mark Scholtens (ma@iisg.nl)
Date:01/21/2004 11:13:53 PM
List:com.mysql.lists.plusplus

Hello Rainer,

The subject of the mail is confusing me a bit, as it seems to me the query
object will be constructed in advance the way the connection object is constructed in
advance. I think this actually is not separating the query from connect. But this doesn't
matter.

I also wonder if you're using a static class member for the connection object.
This way the one connection is shared among all objects instantiated. This may do
fine for your situation for performance reasons, but it will bite in multi-threading
situations.

The error message you get says there are 2 constructors for the query class:

MysqlQuery::MysqlQuery(MysqlConnection *, bool = false) : The one you need MysqlQuery::MysqlQuery(const MysqlQuery &) : The copy constructor

I cannot see how you try to instantiate your query object but I guess you have
some trivial typo in your code where you invoke the constructor. Maybe you don't
include parameters to the constructor at all (a fault I tend to make) where only one
parameter is optional.

If you cannot figure out the error causing the compiler errors you wrote, please include a snippet of code where you try to instantiate the query object.

On 21 Jan 2004 at 17:13, Maier, Rainer wrote:

Hi,

I'm writing a program which inserts about 1000000 records every 10 min. into mysql. I'm writing a wrapper-class.

In the class object I have one connection to hold the connection to the database. It's opened in the constructor and close in the destructor.

I'm using this connection in several procedures to fetch records from the database. Works fine.

Then I want to set up a template query with replaceable parameters to insert the values with query.execute(nCust, nDay, 0, nIn, nOut); that works fine, if I create the query in the procedure.

Now I wanted to create the query in the class constructor and NOT in the inserting procedure. The inserting procedure should only get the values to insert for speed reasons

When I compile I get the errors that there are two candidates: MysqlQuery::MysqlQuery(MysqlConnection *, bool = false) MysqlQuery::MysqlQuery(const MysqlQuery &)

How can I create the query in the class constructor and use it to insert values in a procedure ?

best regards Rainer Maier

Rainer Maier * IP-Management Mainova Telekommunikation GmbH Neue Börsenstr. 6 D-60487 Frankfurt am Main Tel: + 49 (0)69 21 789 324 Fax: + 49 (0)69 21 789 250 Mob: + 49 (0)173 8849 400 <mailto:r.ma@mainovatk.de> www.mainovatk.de