Author: wyoung
Date: Thu Jun 28 06:20:35 2007
New Revision: 1626
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1626&view=rev
Log:
Removed 'updel' example program. Not only was it a fairly silly oddball
example, its function is now better done with Query::for_each()
Removed:
trunk/examples/updel.cpp
Modified:
trunk/ (props changed)
trunk/README.examples
trunk/doc/userman/Makefile
trunk/doc/userman/userman.dbx
trunk/mysql++.bkl
Propchange: trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jun 28 06:20:35 2007
@@ -47,7 +47,6 @@
simple[0-9]
store_if
tquery
-updel
usequery
xaction
Modified: trunk/README.examples
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/README.examples?rev=1626&r1=1625&r2=1626&view=diff
==============================================================================
--- trunk/README.examples (original)
+++ trunk/README.examples Thu Jun 28 06:20:35 2007
@@ -118,10 +118,6 @@
JPEG you loaded. The ID value to use will be that reported
by load_jpeg.
- There is one other oddball, the updel example. It shows how to
- use the power of the matching syntax available in MySQL's SELECT
- statement to do fine-grained UPDATE or DELETE queries.
-
Dedicated Windows Examples
~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: trunk/doc/userman/Makefile
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/Makefile?rev=1626&r1=1625&r2=1626&view=diff
==============================================================================
--- trunk/doc/userman/Makefile (original)
+++ trunk/doc/userman/Makefile Thu Jun 28 06:20:35 2007
@@ -20,7 +20,7 @@
EX_TXT=cgi_jpeg.txt custom1.txt custom2.txt custom3.txt custom4.txt \
custom5.txt custom6.txt fieldinf1.txt load_jpeg.txt \
resetdb.txt simple1.txt simple2.txt simple3.txt stock.txt \
- tquery.txt updel.txt xaction.txt
+ tquery.txt xaction.txt
## ------------------------
Modified: trunk/doc/userman/userman.dbx
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/userman.dbx?rev=1626&r1=1625&r2=1626&view=diff
==============================================================================
--- trunk/doc/userman/userman.dbx (original)
+++ trunk/doc/userman/userman.dbx Thu Jun 28 06:20:35 2007
@@ -909,36 +909,6 @@
That retrieves the JPEG with ID 1 from the table and
returns it to the web server, which will send it on to
the browser.</para>
- </sect3>
-
- <sect3>
- <title>DELETE or UPDATE from SELECT</title>
-
- <para>MySQL's SELECT statement has more power to winnow
- out just the items of interest from the database than
- do DELETE or UPDATE queries. Therefore, many people
- have wanted the ability to execute a SELECT statement
- that in fact deletes or updates the rows matched,
- rather than returning them. This example implements
- that feature in just a few lines of code. It is
- <filename>examples/updel.cpp</filename>:</para>
-
- <programlisting><xi:include href="updel.txt" parse="text"
- xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
-
- <para>Notice that the row values used in the IN clause
- aren't escaped or quoted. This is because row elements are
- <ulink type="classref" url="ColData__Tmpl">ColData</ulink>
- types, so they have automatic escaping and quoting, as
- appropriate to the type being inserted. If you want to
- disable this feature, it's easily done: click the ColData
- link for the details.</para>
-
- <para>Users of this example should beware that one more
- check is required in order to run this query safely:
- in some extreme cases, the size of the query might grow
- larger than MySQL's maximum allowed packet size. This
- check should be added.</para>
</sect3>
</sect2>
</sect1>
Removed: trunk/examples/updel.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/updel.cpp?rev=1625&view=auto
==============================================================================
--- trunk/examples/updel.cpp (original)
+++ trunk/examples/updel.cpp (removed)
@@ -1,87 +1,0 @@
-/***********************************************************************
- updel.cpp - Example showing how to UPDATE or DELETE rows in a database
- while using the power of MySQL's SELECT filtering ability.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 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 <mysql++.h>
-
-#include <string>
-
-using namespace std;
-using namespace mysqlpp;
-
-#define MY_DATABASE "telcent"
-#define MY_TABLE "nazivi"
-#define MY_HOST "localhost"
-#define MY_USER "root"
-#define MY_PASSWORD ""
-#define MY_FIELD "naziv"
-#define MY_QUERY "SELECT URL from my_table as t1, my_table as t2 where
t1.field = t2.field"
-
-int
-main()
-{
- Connection con(use_exceptions);
- try {
- ostringstream strbuf;
- unsigned int i = 0;
- con.connect(MY_DATABASE, MY_HOST, MY_USER, MY_PASSWORD);
- Query query = con.query();
- query << MY_QUERY;
- ResUse res = query.use();
- Row row;
- strbuf << "delete from " << MY_TABLE << " where " << MY_FIELD <<
- " in (";
- // for UPDATE just replace the above DELETE FROM with UPDATE
statement
- for (; row = res.fetch_row(); i++)
- strbuf << row.at(0) << ",";
- if (!i)
- return 0;
- string output(strbuf.str());
- output.erase(output.size() - 1, 1);
- output += ")";
- query.exec(output);
- //cout << output << endl;
- }
- 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=1626&r1=1625&r2=1626&view=diff
==============================================================================
--- trunk/mysql++.bkl (original)
+++ trunk/mysql++.bkl Thu Jun 28 06:20:35 2007
@@ -251,9 +251,6 @@
<exe id="cgi_jpeg" template="common-example">
<sources>examples/cgi_jpeg.cpp</sources>
</exe>
- <exe id="updel" template="common-example">
- <sources>examples/updel.cpp</sources>
- </exe>
</if> <!-- build examples -->
<if cond="FORMAT=='autoconf'">
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits