Author: wyoung
Date: Thu Jul 19 03:00:53 2007
New Revision: 1720

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1720&view=rev
Log:
Added first cut at test for manip.h.  (More depth needed)

Added:
    trunk/test/test_manip.cpp
Modified:
    trunk/bmark.txt
    trunk/mysql++.bkl

Modified: trunk/bmark.txt
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/bmark.txt?rev=1720&r1=1719&r2=1720&view=diff
==============================================================================
--- trunk/bmark.txt (original)
+++ trunk/bmark.txt Thu Jul 19 03:00:53 2007
@@ -1,3 +1,6 @@
+---------------- BEGIN test_manip OUTPUT ----------------
+================ END test_manip OUTPUT ================
+
 ---------------- BEGIN test_tcp OUTPUT ----------------
 TCP address parsing passed.
 ================ END test_tcp OUTPUT ================

Modified: trunk/mysql++.bkl
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/mysql%2B%2B.bkl?rev=1720&r1=1719&r2=1720&view=diff
==============================================================================
--- trunk/mysql++.bkl (original)
+++ trunk/mysql++.bkl Thu Jul 19 03:00:53 2007
@@ -182,6 +182,9 @@
 
        <!-- Define library testing programs' output targets, if enabled -->
        <if cond="BUILDTEST=='yes'">
+               <exe id="test_manip" template="programs">
+                       <sources>test/test_manip.cpp</sources>
+               </exe>
                <exe id="test_tcp" template="programs">
                        <sources>test/test_tcp.cpp</sources>
                </exe>

Added: trunk/test/test_manip.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/test/test_manip.cpp?rev=1720&view=auto
==============================================================================
--- trunk/test/test_manip.cpp (added)
+++ trunk/test/test_manip.cpp Thu Jul 19 03:00:53 2007
@@ -1,0 +1,53 @@
+/***********************************************************************
+ test_manip.cpp - Tests the quoting and escaping manipulators.
+
+ Copyright (c) 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 <mysql++.h>
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+
+int
+main()
+{
+       mysqlpp::Connection c;
+       mysqlpp::Query q(&c);
+
+       char test[] = "Doodle me, James, doodle me!";
+       const size_t len = strlen(test);
+       
+       q << mysqlpp::quote << test;
+       std::string result = q.str();
+       if ((result.length() == (len + 2)) && (result[0] == '\'') &&
+                       (result[len + 1] == '\'')) {
+               return 0;
+       }
+       else {
+               std::cerr << "Failed to quote char[]" << std::endl;
+               return 1;
+       }
+}
+


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to