Author: wyoung
Date: Tue Jul 17 19:51:24 2007
New Revision: 1712
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1712&view=rev
Log:
Renamed fieldinf1 example to just fieldinf. There's only one...
Added:
trunk/examples/fieldinf.cpp
- copied unchanged from r1706, trunk/examples/fieldinf1.cpp
Removed:
trunk/examples/fieldinf1.cpp
Modified:
trunk/ (props changed)
trunk/README.examples
trunk/mysql++.bkl
Propchange: trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jul 17 19:51:24 2007
@@ -39,7 +39,7 @@
complic1
custom[0-9]
dbinfo
-fieldinf1
+fieldinf
for_each
load_jpeg
multiquery
Modified: trunk/README.examples
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/README.examples?rev=1712&r1=1711&r2=1712&view=diff
==============================================================================
--- trunk/README.examples (original)
+++ trunk/README.examples Tue Jul 17 19:51:24 2007
@@ -112,7 +112,7 @@
line argument to be a JPEG file name. We've included
examples/logo.jpg as a sample, if you want to use that.
- fieldinf1: Shows how to get information about the fields in
+ fieldinf: Shows how to get information about the fields in
a result set. (Types, etc.)
dbinfo: Dumps a bunch of information about the database
Removed: trunk/examples/fieldinf1.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/fieldinf1.cpp?rev=1711&view=auto
==============================================================================
--- trunk/examples/fieldinf1.cpp (original)
+++ trunk/examples/fieldinf1.cpp (removed)
@@ -1,114 +1,0 @@
-/***********************************************************************
- fieldinf1.cpp - Example showing how to request information about the
- fields in a table, such as their SQL and C++-equivalent types, as
- MySQL++ sees it.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004-2007 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.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with MySQL++; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
- USA
-***********************************************************************/
-
-#include "util.h"
-
-#include <mysql++.h>
-
-#include <iostream>
-#include <iomanip>
-
-using namespace std;
-using namespace mysqlpp;
-
-int
-main(int argc, char *argv[])
-{
- try {
- Connection con(use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- Query query = con.query("select * from stock");
- cout << "Query: " << query.preview() << endl;
-
- Result res = query.store();
- cout << "Records Found: " << res.size() << endl << endl;
-
- cout << "Query Info:\n";
- cout.setf(ios::left);
-
- for (unsigned int i = 0; i < res.names().size(); i++) {
- cout << setw(2) << i
- // this is the name of the field
- << setw(15) << res.names(i).c_str()
- // this is the SQL identifier name
- // Result::types(unsigned int) returns
a mysql_type_info which in many
- // ways is like type_info except that
it has additional sql type
- // information in it. (with one of the
methods being sql_name())
- << setw(15) << res.types(i).sql_name()
- // this is the C++ identifier name
which most closely resembles
- // the sql name (its is implementation
defined and often not very readable)
- << setw(20) << res.types(i).name()
- << endl;
- }
-
- cout << endl;
-
- if (res.types(0) == typeid(string)) {
- // this is demonstrating how a mysql_type_info can be
- // compared with a C++ type_info.
- cout << "Field 'item' is of an SQL type which most "
- "closely resembles\nthe C++ string
type\n";
- }
-
- if (res.types(1) == typeid(longlong)) {
- cout << "Field 'num' is of an SQL type which most "
- "closely resembles\nC++ long long int
type\n";
- }
- else if (res.types(1).base_type() == typeid(longlong)) {
- // you have to be careful as if it can be null the
actual
- // type is Null<TYPE> not TYPE. So you should always
use
- // the base_type method to get at the underlying type.
- // If the type is not null than this base type would be
- // the same as its type.
- cout << "Field 'num' base type is of an SQL type which "
- "most closely\nresembles the C++ long
long int type\n";
- }
- }
- catch (const BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
Modified: trunk/mysql++.bkl
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/mysql%2B%2B.bkl?rev=1712&r1=1711&r2=1712&view=diff
==============================================================================
--- trunk/mysql++.bkl (original)
+++ trunk/mysql++.bkl Tue Jul 17 19:51:24 2007
@@ -238,8 +238,8 @@
<exe id="dbinfo" template="libutil-user,examples">
<sources>examples/dbinfo.cpp</sources>
</exe>
- <exe id="fieldinf1" template="libutil-user,examples">
- <sources>examples/fieldinf1.cpp</sources>
+ <exe id="fieldinf" template="libutil-user,examples">
+ <sources>examples/fieldinf.cpp</sources>
</exe>
<exe id="load_jpeg" template="libutil-user,examples">
<sources>examples/load_jpeg.cpp</sources>
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits