There are << >> overloads for the 'Query' object. You can do something like
Query query = con.query();
if (query) {
query << "INSERT INTO " << <table> "(" << <Field1> ","
<< <Field2> << "," ... ")" << "VALUES (" << <value1>
<< "," << <value2> << "," ... ");";
ResNSel result = query.execute();
if (result)
long rows_affected = result.rows;
}
Of course, it's all relative. The above SQL string created with 40+ field-value pairs
could also be hard to maintain.
HTH...steve---
Steven J Orton
Software Engineer
Northrop Grumman Mission Systems
Middletown, RI 02842
-----Original Message-----
From: Jim Langston [mailto:serpardum@stripped]
Sent: Wed 6/21/2006 2:51 AM
To: MySql++
Subject: Large class to table
I have a few large classes which I wish to save to a MySQL table. Currently
I am saving them to flat files using override>> and override<< with streams.
By large I mean 47+ variables/fields.
I'm trying to determine the best way to do this using MySQL++. I've been
looking at SSQLS but think it would be a real pain to maintain.
I really didn't see an override for >> or << in the documentation, but I may
have just missed is. Is there an override that will let me do something
like:
con.something() << Field1 << field2 << field3 << field4;
con.insert(); // or something
con.something() >> Field1 >> field2 >> field3 >> field;
etc?