List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:December 20 2006 6:20pm
Subject:Re: help... how do i use SSQLS within my own classes...
View as plain text  
joh3@stripped wrote:
> 
> /tmp/ccc67q0l.o:/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/iostream:78:
> multiple definition of `Target_Region::_table'

Every SSQLS type includes two static member variables; _table is one. 
If you don't do anything to avoid it, they're assigned default values 
within the sql_create_* macro, so if the compiler sees that macro call 
twice, it sees two separate assignments to a static member variable, 
which annoys it.

To fix this, I would put the sql_create_* macro in a separate .h file, 
and #define MYSQLPP_SSQLS_NO_STATICS above all #includes for that file 
except for one.  This ensures that the static members are assigned to 
only once.  You can see this pattern in action in the examples: the 
'stock' SSQLS type is defined in stock.h, and it is included in both 
util.cpp and in custom*.cpp.

Your situation is slightly more complex because you are #including the 
SSQLS definition within a .h file.  You'll probably need a little C 
preprocessor work to avoid problems here.

> also i need to extend the mysql++ library to use the geospatial mysql
> extensions, i am slowly working out how mysql++ all fits together, would you
> like patches to make them work if i can get it working? 

Simple patches like this usually get accepted pretty quickly.  I suggest 
looking at lib/sql_types.h.

> should they be against the svn code or the base mysql++ 2.1.1 code?

Against svn, if at all possible.  That makes it easier for you to 
generate diffs, and for me to apply them.
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