Hello,
The issue has been raised a few times already on the list, IIRC.
Just a little reminder:
- Create dbHandling.h (class definition) and dbHandling.cpp (member function
implementations).
- If you are using sql_create_# macros, and you include dbHandling.h in
another file, you'll get linking conflicts (namely on ::_table and ::names).
To solve that issue, custom.pl needs a small modification so that it
generates a custom-macros.h which only defines ::_table and ::names once.
There is a small quick-n-dirty patch attached.
Apply with: patch -p0 < ssqls-link.patch
Then run: custom.pl
You'll now have a new custom-macros.h.
If you dont want the static members to be defined in a file, then just:
#define MYSQLPP_SSQLS_NO_STATICS
Don't forget that you need the static members to be defined at some point
(but only *once*).
Just a note: this has been tested only under Debian unstable/FC4. I have no
access to Windows development machines. Any feedback on different
architectures is welcome.
Hope some people will find this useful.
Viktor
--
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse f--- custom.pl.orig 2005-12-20 14:31:41.000000000 +0100
+++ custom.pl 2005-12-21 09:56:19.000000000 +0100
@@ -56,6 +56,12 @@
#include <string>
+#ifdef MYSQLPP_SSQLS_NO_STATICS
+#define MYSQLPP_SSQLS_EXPAND(a...)
+#else
+#define MYSQLPP_SSQLS_EXPAND(a...) a
+#endif
+
namespace mysqlpp {
enum sql_dummy_type {sql_dummy};
@@ -635,11 +641,11 @@
NAME##_cus_equal_list<Manip> equal_list(mysqlpp::cchar *d, mysqlpp::cchar *c, Manip m,
mysqlpp::sql_cmp_type sc) const;
};
-
+ MYSQLPP_SSQLS_EXPAND(
const char *NAME::names[] = {
$names
};
- const char *NAME::_table = #NAME ;
+ const char *NAME::_table = #NAME ;)
template <class Manip>
NAME##_cus_value_list<Manip>::NAME##_cus_value_list