Author: wyoung
Date: Mon Mar 6 18:29:59 2006
New Revision: 1226
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1226&view=rev
Log:
Moved definition of stock SSQLS out into its own header file, stock.h,
and #including it from all of the custom* examples that use it. Also
#including that header in the util module to test the new
MYSQLPP_SSQLS_NO_STATICS feature.
Added:
branches/v2.1-bakefile/examples/stock.h
Modified:
branches/v2.1-bakefile/examples/custom1.cpp
branches/v2.1-bakefile/examples/custom2.cpp
branches/v2.1-bakefile/examples/custom3.cpp
branches/v2.1-bakefile/examples/custom4.cpp
branches/v2.1-bakefile/examples/custom5.cpp
branches/v2.1-bakefile/examples/util.cpp
Modified: branches/v2.1-bakefile/examples/custom1.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/custom1.cpp?rev=1226&r1=1225&r2=1226&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/custom1.cpp (original)
+++ branches/v2.1-bakefile/examples/custom1.cpp Mon Mar 6 18:29:59 2006
@@ -26,33 +26,13 @@
USA
***********************************************************************/
+#include "stock.h"
#include "util.h"
-#include <mysql++.h>
-#include <custom.h>
-
#include <iostream>
-#include <iomanip>
#include <vector>
using namespace std;
-
-// The following is calling a very complex macro which will create
-// "struct stock", which has the member variables:
-//
-// string item
-// ...
-// Date sdate
-//
-// plus methods to help populate the class from a MySQL row
-// among other things that I'll get to in a later example.
-sql_create_5(stock,
- 1, 5, // explained in the
user manual
- string, item,
- mysqlpp::longlong, num,
- double, weight,
- double, price,
- mysqlpp::Date, sdate)
int
main(int argc, char *argv[])
Modified: branches/v2.1-bakefile/examples/custom2.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/custom2.cpp?rev=1226&r1=1225&r2=1226&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/custom2.cpp (original)
+++ branches/v2.1-bakefile/examples/custom2.cpp Mon Mar 6 18:29:59 2006
@@ -25,24 +25,12 @@
USA
***********************************************************************/
+#include "stock.h"
#include "util.h"
-#include <mysql++.h>
-#include <custom.h>
-
#include <iostream>
-#include <string>
-#include <vector>
using namespace std;
-
-sql_create_5(stock,
- 1, 5,
- string, item,
- mysqlpp::longlong, num,
- double, weight,
- double, price,
- mysqlpp::Date, sdate)
int
main(int argc, char *argv[])
Modified: branches/v2.1-bakefile/examples/custom3.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/custom3.cpp?rev=1226&r1=1225&r2=1226&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/custom3.cpp (original)
+++ branches/v2.1-bakefile/examples/custom3.cpp Mon Mar 6 18:29:59 2006
@@ -25,24 +25,12 @@
USA
***********************************************************************/
+#include "stock.h"
#include "util.h"
-#include <mysql++.h>
-#include <custom.h>
-
#include <iostream>
-#include <string>
-#include <vector>
using namespace std;
-
-sql_create_5(stock,
- 1, 5,
- string, item,
- mysqlpp::longlong, num,
- double, weight,
- double, price,
- mysqlpp::Date, sdate)
int
main(int argc, char *argv[])
Modified: branches/v2.1-bakefile/examples/custom4.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/custom4.cpp?rev=1226&r1=1225&r2=1226&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/custom4.cpp (original)
+++ branches/v2.1-bakefile/examples/custom4.cpp Mon Mar 6 18:29:59 2006
@@ -27,44 +27,12 @@
USA
***********************************************************************/
+#include "stock.h"
#include "util.h"
-#include <mysql++.h>
-#include <custom.h>
-
#include <iostream>
-#include <iomanip>
-#include <string>
-#include <vector>
using namespace std;
-
-sql_create_5(stock,
- 1, // This number is used to make a SSQLS less-than-comparable.
- // When comparing two SSQLS structures, the first N elements are
- // compared. In this instance, we are saying that we only want
- // the first element ('item') to be used when comparing two
- // stock structures.
-
- 5, // Each SSQLS structure includes a number of constructors. Some
- // of these are fixed in nature, but one of these will have this
- // number of arguments, one for each of the first N elements in
- // the structure; it is an initialization ctor. Since N is the
- // same as the number of structure elements in this instance,
- // that ctor will be able to fully initialize the structure.
This
- // behavior is not always wanted, however, so the macro allows
- // you make the constructor take fewer parameters, leaving the
- // remaining elements uninitialized. An example of when this is
- // necessary is when you have a structure containing only two
- // integer elements: one of the other ctors defined for SSQLS
- // structures takes two ints, so the compiler barfs if you pass
- // 2 for this argument. You would need to pass 0 here to get
- // that SSQLS structure to compile.
- string, item,
- mysqlpp::longlong, num,
- double, weight,
- double, price,
- mysqlpp::Date, sdate)
int
main(int argc, char *argv[])
Modified: branches/v2.1-bakefile/examples/custom5.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/custom5.cpp?rev=1226&r1=1225&r2=1226&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/custom5.cpp (original)
+++ branches/v2.1-bakefile/examples/custom5.cpp Mon Mar 6 18:29:59 2006
@@ -26,24 +26,13 @@
USA
***********************************************************************/
+#include "stock.h"
#include "util.h"
-#include <mysql++.h>
-#include <custom.h>
-
#include <iostream>
-#include <iomanip>
#include <vector>
using namespace std;
-
-sql_create_5(stock,
- 1, 5,
- string, item,
- mysqlpp::longlong, num,
- double, weight,
- double, price,
- mysqlpp::Date, sdate)
int
main(int argc, char *argv[])
Added: branches/v2.1-bakefile/examples/stock.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/stock.h?rev=1226&view=auto
==============================================================================
--- branches/v2.1-bakefile/examples/stock.h (added)
+++ branches/v2.1-bakefile/examples/stock.h Mon Mar 6 18:29:59 2006
@@ -1,0 +1,22 @@
+#include <mysql++.h>
+#include <custom.h>
+
+#include <string>
+
+// The following is calling a very complex macro which will create
+// "struct stock", which has the member variables:
+//
+// string item
+// ...
+// Date sdate
+//
+// plus methods to help populate the class from a MySQL row. See the
+// user manual for further details.
+sql_create_5(stock,
+ 1, 5, // The meaning of these values is covered in the user manual
+ std::string, item,
+ mysqlpp::longlong, num,
+ double, weight,
+ double, price,
+ mysqlpp::Date, sdate)
+
Modified: branches/v2.1-bakefile/examples/util.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/util.cpp?rev=1226&r1=1225&r2=1226&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/util.cpp (original)
+++ branches/v2.1-bakefile/examples/util.cpp Mon Mar 6 18:29:59 2006
@@ -24,6 +24,12 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
***********************************************************************/
+
+// This include isn't needed by util module. It's just a test of the
+// new SSQLS feature allowing the structure to be defined in many
+// modules without having a multiply-defined static variable error.
+#define MYSQLPP_SSQLS_NO_STATICS
+#include "stock.h"
#include "util.h"
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits