List:MySQL++« Previous MessageNext Message »
From:Joel Fielder Date:December 20 2006 8:45am
Subject:RE: help... how do i use SSQLS within my own classes...
View as plain text  
Hi,

The SSQLS macros declare and define static variables for the structure,
including the table name, Target_Region::_table.  The compiler is
whining because you can only define a static variable once (because
there is only one instance of it).  

There is a #define called MYSQLPP_SSQLS_NO_STATICS which you can use to
tell the SSQLS macros to just declare the static variables.

So #define MYSQLPP_SSQLS_NO_STATICS somewhere, and then assign values to
the statics just once i.e. in your .cpp file.  The easiest way to do
this is to repeat the sql_create call in your .cpp file but with
MYSQLPP_SSQLS_NO_STATICS undefined.  I wouldn't recommend this though as
the preprocessor will then do double the work.

Instead, you can just directly assign values in the .cpp file as you
would normally when dealing with static variables.

Target_Region::_table = "target_region";
Target_Region::names[] = { "Target_ID", "Target_name", "root_path",
"etc" };


Regarding patches for extending the library, I can't comment on the need
or otherwise for this, but I can refer you to the HACKERS document
within the mysql++ distribution which recommends patching against the
SVN version.

Joel.

Thread
help... how do i use SSQLS within my own classes...joh3@lithophile.com20 Dec
  • RE: help... how do i use SSQLS within my own classes...Joel Fielder20 Dec
  • Re: help... how do i use SSQLS within my own classes...Warren Young20 Dec
    • Re: help... how do i use SSQLS within my own classes...joh3@lithophile.com20 Dec
      • Re: help... how do i use SSQLS within my own classes...Warren Young20 Dec