Author: wyoung
Date: Fri Mar 10 22:21:26 2006
New Revision: 1242
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1242&view=rev
Log:
Converted examples to use new mysqlpp::sql_* typedefs, particularly the
SSQLS based examples.
Modified:
branches/v2.1-bakefile/examples/stock.h
branches/v2.1-bakefile/examples/util.cpp
branches/v2.1-bakefile/examples/util.h
Modified: branches/v2.1-bakefile/examples/stock.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/stock.h?rev=1242&r1=1241&r2=1242&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/stock.h (original)
+++ branches/v2.1-bakefile/examples/stock.h Fri Mar 10 22:21:26 2006
@@ -6,17 +6,17 @@
// The following is calling a very complex macro which will create
// "struct stock", which has the member variables:
//
-// string item
+// sql_char item;
// ...
-// Date sdate
+// sql_date sdate;
//
// plus methods to help populate the class from a MySQL row. See the
-// user manual for further details.
+// SSQLS sections in 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)
+ mysqlpp::sql_char, item,
+ mysqlpp::sql_bigint, num,
+ mysqlpp::sql_double, weight,
+ mysqlpp::sql_double, price,
+ mysqlpp::sql_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=1242&r1=1241&r2=1242&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/util.cpp (original)
+++ branches/v2.1-bakefile/examples/util.cpp Fri Mar 10 22:21:26 2006
@@ -3,7 +3,7 @@
programs.
Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
+ MySQL AB, and (c) 2004-2006 by Educational Technology Resources, Inc.
Others may also hold copyrights on code in this file. See the CREDITS
file in the top directory of the distribution for details.
@@ -25,17 +25,17 @@
USA
***********************************************************************/
+#include "util.h"
+
+#include <iostream>
+#include <iomanip>
+#include <stdlib.h>
+
// 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"
-
-#include <iostream>
-#include <iomanip>
-#include <stdlib.h>
using namespace std;
@@ -108,8 +108,9 @@
// with the header printed out in the previous function.
void
-print_stock_row(const std::string& item, mysqlpp::longlong num,
- double weight, double price, const mysqlpp::Date& date)
+print_stock_row(const mysqlpp::sql_char& item, mysqlpp::sql_bigint num,
+ mysqlpp::sql_double weight, mysqlpp::sql_double price,
+ const mysqlpp::sql_date& date)
{
// We do UTF-8 translation on item field because there is Unicode
// data in this field in the sample database, and some systems
Modified: branches/v2.1-bakefile/examples/util.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/util.h?rev=1242&r1=1241&r2=1242&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/util.h (original)
+++ branches/v2.1-bakefile/examples/util.h Fri Mar 10 22:21:26 2006
@@ -3,7 +3,7 @@
example programs.
Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
+ MySQL AB, and (c) 2004-2006 by Educational Technology Resources, Inc.
Others may also hold copyrights on code in this file. See the CREDITS
file in the top directory of the distribution for details.
@@ -25,8 +25,8 @@
USA
***********************************************************************/
-#ifndef _util_hh_
-#define _util_hh_
+#if !defined(MYSQLPP_UTIL_H)
+#define MYSQLPP_UTIL_H
#include <mysql++.h>
@@ -34,8 +34,9 @@
void print_stock_header(int rows);
void print_stock_row(const mysqlpp::Row& r);
-void print_stock_row(const std::string& item, mysqlpp::longlong num,
- double weight, double price, const mysqlpp::Date& date);
+void print_stock_row(const mysqlpp::sql_char& item,
+ mysqlpp::sql_bigint num, mysqlpp::sql_double weight,
+ mysqlpp::sql_double price, const mysqlpp::sql_date& date);
void print_stock_rows(mysqlpp::Result& res);
void print_stock_table(mysqlpp::Query& query);
void get_stock_table(mysqlpp::Query& query, mysqlpp::Result& res);
@@ -43,4 +44,5 @@
const char* kdb = 0);
char* utf8trans(const char* utf8_str, char* ansi_str, int ansi_len);
-#endif
+#endif // !defined(MYSQLPP_UTIL_H)
+
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits