Author: wyoung
Date: Thu Jul 12 05:35:28 2007
New Revision: 1679

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1679&view=rev
Log:
Removed Query::execute(), store() and use() overloads taking a lone
SQLQueryParms object reference.  Theoretically someone could be using
this mechanism, but what it's really for is to just make some the
querydef macro crap a little simpler, at the expense of a more cluttered
class interface.  Now we handle all translations between SQLQueryParms
to a query string literally, inline.  This is functionally no different
from what happened before, we just snapped one layer of indirection.

Modified:
    trunk/Wishlist
    trunk/lib/query.cpp
    trunk/lib/query.h
    trunk/lib/querydef.pl

Modified: trunk/Wishlist
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=1679&r1=1678&r2=1679&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Thu Jul 12 05:35:28 2007
@@ -132,10 +132,6 @@
     o Apply Waba's patch allowing Null<T> fields in SSQLSes:
       
           http://lists.mysql.com/plusplus/5433
-
-    o Remove Query::execute(), store() and use() overloads taking
-      a SQLQueryParms object reference.  Since v2.2, this is now
-      pointless.
 
     o Change Lockable::lock() to return true if it succeeds.
 

Modified: trunk/lib/query.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1679&r1=1678&r2=1679&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Thu Jul 12 05:35:28 2007
@@ -107,20 +107,20 @@
 
 
 ResNSel
-Query::execute(const SQLString& str)
+Query::execute(const SQLString& s)
 {
        if ((parse_elems_.size() == 2) && !def.processing_) {
                // We're a template query and we haven't gone through this path
-               // before, so take str to be a lone parameter for the query.
+               // before, so take s to be a lone parameter for the query.
                // We will come back through this function with a completed
                // query, but the processing_ flag will be reset, allowing us to
                // take the 'else' path, avoiding an infinite loop.
                AutoFlag<> af(def.processing_);
-               return execute(SQLQueryParms() << str);
-       }
-       else {
-               // Take str to be the entire query string
-               return execute(str.data(), str.length());
+               return execute(str(SQLQueryParms() << s));
+       }
+       else {
+               // Take s to be the entire query string
+               return execute(s.data(), s.length());
        }
 }
 
@@ -158,18 +158,6 @@
                return ResNSel();
        }
 }
-
-
-#if !defined(DOXYGEN_IGNORE)
-// Doxygen will not generate documentation for this section.
-
-ResNSel
-Query::execute(SQLQueryParms& p)
-{
-       return execute(str(p));
-}
-
-#endif // !defined(DOXYGEN_IGNORE)
 
 
 std::string
@@ -407,20 +395,20 @@
 
 
 Result 
-Query::store(const SQLString& str)
+Query::store(const SQLString& s)
 {
        if ((parse_elems_.size() == 2) && !def.processing_) {
                // We're a template query and we haven't gone through this path
-               // before, so take str to be a lone parameter for the query.
+               // before, so take s to be a lone parameter for the query.
                // We will come back through this function with a completed
                // query, but the processing_ flag will be reset, allowing us to
                // take the 'else' path, avoiding an infinite loop.
                AutoFlag<> af(def.processing_);
-               return store(SQLQueryParms() << str);
-       }
-       else {
-               // Take str to be the entire query string
-               return store(str.data(), str.length());
+               return store(str(SQLQueryParms() << s));
+       }
+       else {
+               // Take s to be the entire query string
+               return store(s.data(), s.length());
        }
 }
 
@@ -474,18 +462,6 @@
 }
 
 
-#if !defined(DOXYGEN_IGNORE)
-// Doxygen will not generate documentation for this section.
-
-Result
-Query::store(SQLQueryParms& p)
-{
-       return store(str(p));
-}
-
-#endif // !defined(DOXYGEN_IGNORE)
-
-
 Result
 Query::store_next()
 {
@@ -567,20 +543,20 @@
 
 
 ResUse
-Query::use(const SQLString& str)
+Query::use(const SQLString& s)
 {
        if ((parse_elems_.size() == 2) && !def.processing_) {
                // We're a template query and we haven't gone through this path
-               // before, so take str to be a lone parameter for the query.
+               // before, so take s to be a lone parameter for the query.
                // We will come back through this function with a completed
                // query, but the processing_ flag will be reset, allowing us to
                // take the 'else' path, avoiding an infinite loop.
                AutoFlag<> af(def.processing_);
-               return use(SQLQueryParms() << str);
-       }
-       else {
-               // Take str to be the entire query string
-               return use(str.data(), str.length());
+               return use(str(SQLQueryParms() << s));
+       }
+       else {
+               // Take s to be the entire query string
+               return use(s.data(), s.length());
        }
 }
 
@@ -630,16 +606,5 @@
 }
 
 
-#if !defined(DOXYGEN_IGNORE)
-// Doxygen will not generate documentation for this section.
-
-ResUse
-Query::use(SQLQueryParms& p)
-{
-       return use(str(p));
-}
-
-#endif // !defined(DOXYGEN_IGNORE)
-
 } // end namespace mysqlpp
 

Modified: trunk/lib/query.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.h?rev=1679&r1=1678&r2=1679&view=diff
==============================================================================
--- trunk/lib/query.h (original)
+++ trunk/lib/query.h Thu Jul 12 05:35:28 2007
@@ -239,7 +239,7 @@
        /// \return ResNSel status information about the query
        ///
        /// \sa exec(), store(), storein(), and use()
-       ResNSel execute() { return execute(def); }
+       ResNSel execute() { return execute(str(def)); }
 
        /// \brief Execute query in a C++ string, or substitute string into
        /// a template query and execute it.
@@ -284,7 +284,7 @@
        /// \return ResUse object that can walk through result set serially
        ///
        /// \sa exec(), execute(), store() and storein()
-       ResUse use() { return use(def); }
+       ResUse use() { return use(str(def)); }
 
        /// \brief Execute query in a C++ string
        ///
@@ -328,7 +328,7 @@
        /// \return Result object containing entire result set
        ///
        /// \sa exec(), execute(), storein(), and use()
-       Result store() { return store(def); }
+       Result store() { return store(str(def)); }
 
        /// \brief Execute query in a C++ string
        ///
@@ -792,9 +792,9 @@
        // like method declarations.
        mysql_query_define0(std::string, preview)
        mysql_query_define0(std::string, str)
-       mysql_query_define1(ResNSel, execute)
-       mysql_query_define1(Result, store)
-       mysql_query_define1(ResUse, use)
+       mysql_query_define0(ResNSel, execute)
+       mysql_query_define0(Result, store)
+       mysql_query_define0(ResUse, use)
        mysql_query_define2(storein_sequence)
        mysql_query_define2(storein_set)
        mysql_query_define2(storein)

Modified: trunk/lib/querydef.pl
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/querydef.pl?rev=1679&r1=1678&r2=1679&view=diff
==============================================================================
--- trunk/lib/querydef.pl (original)
+++ trunk/lib/querydef.pl Thu Jul 12 05:35:28 2007
@@ -63,20 +63,12 @@
        }
        print OUT ") \\\n";
 
-       print OUT "\t\t{ return FUNC(SQLQueryParms()";
+       print OUT "\t\t{ return FUNC(str(SQLQueryParms()";
        for (my $j = 0; $j < $i + 1; ++$j) {
                print OUT ' << arg', $j;
        }
-       print OUT "); } \\\n";
+       print OUT ")); } \\\n";
 }
-
-## Add mysql_query_define1 macro
-print OUT << "---";
-
-#define mysql_query_define1(RETURN, FUNC) \\
-       RETURN FUNC(SQLQueryParms& p); \\
-       mysql_query_define0(RETURN, FUNC)
----
 
 ## Add mysql_query_define2 macro
 print OUT << "---";


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

Reply via email to