List:MySQL++« Previous MessageNext Message »
From:don thompson Date:April 8 2005 12:59pm
Subject:Re: sql_create in header
View as plain text  
Hi,  Below describes what I'm trying to do.   I'm not trying to write an 
object to the database, but
I simply want the SSQLS tshares definition (tshares shr) moved to the 
header file of the class,
and therefore need to move the tshares definition.  I'm trying to 
develop some demonstration classes
which utilize various features of mysql++.
Thanks, Don

The SSQLS usage as shown is taken directly from examples/custom3

....  SSQLS declared in class.cp 
sql_create_20(tshares....            <===SSQLS
.... in member function...
    res =, sfx);
    if (res.empty()) {
    throw Acct_error(acct, sfx);
    //because only one row can be returned
    //shr = res[0];          <====would like tshares shr delcared as 
class member,
    tshares shr = res[0]; // using local <===rather than this local def.

.... and later to perform update ...  <===this update would be in 
another member function,
    tshares shr2 = shr;         <===thus the need for shr to be a class 
member as well
    // Test simple update
    shr.balance += tranamt;  <==== simple, rather than row numeric ref 
or name lookup
    query.update(shr2, shr);

Warren Young wrote:

> don thompson wrote:
>> like to define 'tshares row' as a member of this class.
> If I understand you correctly, you are trying to store instances of a 
> C++ class into columns of the MySQL database.  This will not work; 
> MySQL is not an object-oriented database.  You can only use primitive 
> types (int, float, char*...), or types like std::string which can be 
> readily converted to primitives.
> Also, please don't reply to an existing thread in order to post to the 
> list.  It messes up mail readers that can do threaded reading.  Make a 
> fresh post instead.

auto_incrementJoachim Person14 Mar
  • Re: auto_incrementChris Frey14 Mar
    • Re: auto_incrementEarl Miles14 Mar
      • Re: auto_incrementChris Frey15 Mar
        • sql_create in headerdon thompson7 Apr
          • Re: sql_create in headerWarren Young8 Apr
            • Re: sql_create in headerdon thompson8 Apr
          • Re: sql_create in headerWarren Young9 Apr
  • Re: auto_incrementWarren Young15 Mar
    • Re: auto_incrementWarren Young15 Mar