Author: mysqlpp
Date: Sun Dec 2 15:49:51 2007
New Revision: 1944
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1944&view=rev
Log:
Realphabetized methods in query module
Modified:
trunk/lib/query.cpp
trunk/lib/query.h
Modified: trunk/lib/query.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1944&r1=1943&r2=1944&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Sun Dec 2 15:49:51 2007
@@ -66,23 +66,6 @@
}
-Query&
-Query::operator=(const Query& rhs)
-{
- set_exceptions(rhs.throw_exceptions());
- template_defaults = rhs.template_defaults;
- conn_ = rhs.conn_;
- copacetic_ = rhs.copacetic_;
-
- return *this;
-}
-
-Query::operator private_bool_type() const
-{
- return *conn_ && copacetic_ ? &Query::copacetic_ : 0;
-}
-
-
ulonglong
Query::affected_rows()
{
@@ -236,6 +219,23 @@
Query::more_results()
{
return conn_->driver()->more_results();
+}
+
+
+Query&
+Query::operator=(const Query& rhs)
+{
+ set_exceptions(rhs.throw_exceptions());
+ template_defaults = rhs.template_defaults;
+ conn_ = rhs.conn_;
+ copacetic_ = rhs.copacetic_;
+
+ return *this;
+}
+
+Query::operator private_bool_type() const
+{
+ return *conn_ && copacetic_ ? &Query::copacetic_ : 0;
}
Modified: trunk/lib/query.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.h?rev=1944&r1=1943&r2=1944&view=diff
==============================================================================
--- trunk/lib/query.h (original)
+++ trunk/lib/query.h Sun Dec 2 15:49:51 2007
@@ -147,6 +147,77 @@
/// what values they have in the original.
Query(const Query& q);
+ /// \brief Return a SQL-escaped version of a character buffer
+ ///
+ /// \param ps pointer to C++ string to hold escaped version; if
+ /// original is 0, also holds the original data to be escaped
+ /// \param original if given, pointer to the character buffer to
+ /// escape instead of contents of *ps
+ /// \param length if both this and original are given, number of
+ /// characters to escape instead of ps->length()
+ ///
+ /// \retval number of characters placed in *ps
+ ///
+ /// This method has three basic operation modes:
+ ///
+ /// - Pass just a pointer to a C++ string containing the original
+ /// data to escape, plus act as receptacle for escaped version
+ /// - Pass a pointer to a C++ string to receive escaped string plus
+ /// a pointer to a C string to be escaped
+ /// - Pass nonzero for all parameters, taking original to be a
+ /// pointer to an array of char with given length; does not treat
+ /// null characters as special
+ ///
+ /// There's a degenerate fourth mode, where ps is zero: simply
+ /// returns 0, because there is nowhere to store the result.
+ ///
+ /// Note that if original is 0, we always ignore the length
+ /// parameter even if it is nonzero. Length always comes from
+ /// ps->length() in this case.
+ ///
+ /// ps is a pointer because if it were a reference, the other
+ /// overload would be impossible to call: the compiler would
+ /// complain that the two overloads are ambiguous because
+ /// std::string has a char* conversion ctor. A nice bonus is that
+ /// pointer syntax makes it clearer that the first parameter is an
+ /// "out" parameter.
+ ///
+ /// \see comments for escape_string(char*, const char*, size_t)
+ /// for further details.
+ size_t escape_string(std::string* ps, const char* original = 0,
+ size_t length = 0) const;
+
+ /// \brief Return a SQL-escaped version of the given character
+ /// buffer
+ ///
+ /// \param escaped character buffer to hold escaped version; must
+ /// point to at least (length * 2 + 1) bytes
+ /// \param original pointer to the character buffer to escape
+ /// \param length number of characters to escape
+ ///
+ /// \retval number of characters placed in escaped
+ ///
+ /// This is part of Query because proper SQL escaping takes the
+ /// database's current character set into account, which requires
+ /// access to the Connection object the query will go out on. Also,
+ /// this function is very important to MySQL++'s Query stream
+ /// manipulator mechanism, so it's more convenient for this method
+ /// to live in Query rather than Connection.
+ size_t escape_string(char* escaped, const char* original,
+ size_t length) const;
+
+ /// \brief Get the last error number that was set.
+ ///
+ /// This just delegates to Connection::errnum(). Query has nothing
+ /// extra to say, so use either, as makes sense in your program.
+ int errnum() const;
+
+ /// \brief Get the last error message that was set.
+ ///
+ /// This just delegates to Connection::error(). Query has nothing
+ /// extra to say, so use either, as makes sense in your program.
+ const char* error() const;
+
/// \brief Assign another query's state to this object
///
/// The same caveats apply to this operator as apply to the copy
@@ -173,77 +244,6 @@
/// the last operation.
operator private_bool_type() const;
- /// \brief Return a SQL-escaped version of a character buffer
- ///
- /// \param ps pointer to C++ string to hold escaped version; if
- /// original is 0, also holds the original data to be escaped
- /// \param original if given, pointer to the character buffer to
- /// escape instead of contents of *ps
- /// \param length if both this and original are given, number of
- /// characters to escape instead of ps->length()
- ///
- /// \retval number of characters placed in *ps
- ///
- /// This method has three basic operation modes:
- ///
- /// - Pass just a pointer to a C++ string containing the original
- /// data to escape, plus act as receptacle for escaped version
- /// - Pass a pointer to a C++ string to receive escaped string plus
- /// a pointer to a C string to be escaped
- /// - Pass nonzero for all parameters, taking original to be a
- /// pointer to an array of char with given length; does not treat
- /// null characters as special
- ///
- /// There's a degenerate fourth mode, where ps is zero: simply
- /// returns 0, because there is nowhere to store the result.
- ///
- /// Note that if original is 0, we always ignore the length
- /// parameter even if it is nonzero. Length always comes from
- /// ps->length() in this case.
- ///
- /// ps is a pointer because if it were a reference, the other
- /// overload would be impossible to call: the compiler would
- /// complain that the two overloads are ambiguous because
- /// std::string has a char* conversion ctor. A nice bonus is that
- /// pointer syntax makes it clearer that the first parameter is an
- /// "out" parameter.
- ///
- /// \see comments for escape_string(char*, const char*, size_t)
- /// for further details.
- size_t escape_string(std::string* ps, const char* original = 0,
- size_t length = 0) const;
-
- /// \brief Return a SQL-escaped version of the given character
- /// buffer
- ///
- /// \param escaped character buffer to hold escaped version; must
- /// point to at least (length * 2 + 1) bytes
- /// \param original pointer to the character buffer to escape
- /// \param length number of characters to escape
- ///
- /// \retval number of characters placed in escaped
- ///
- /// This is part of Query because proper SQL escaping takes the
- /// database's current character set into account, which requires
- /// access to the Connection object the query will go out on. Also,
- /// this function is very important to MySQL++'s Query stream
- /// manipulator mechanism, so it's more convenient for this method
- /// to live in Query rather than Connection.
- size_t escape_string(char* escaped, const char* original,
- size_t length) const;
-
- /// \brief Get the last error number that was set.
- ///
- /// This just delegates to Connection::errnum(). Query has nothing
- /// extra to say, so use either, as makes sense in your program.
- int errnum() const;
-
- /// \brief Get the last error message that was set.
- ///
- /// This just delegates to Connection::error(). Query has nothing
- /// extra to say, so use either, as makes sense in your program.
- const char* error() const;
-
/// \brief Treat the contents of the query string as a template
/// query.
///
@@ -252,6 +252,19 @@
/// "Template Queries" chapter in the user manual for more
/// information.
void parse();
+
+ /// \brief Return the query string currently in the buffer.
+ std::string preview() { return str(template_defaults); }
+
+ /// \brief Return the query string currently in the buffer with
+ /// template query parameter substitution.
+ ///
+ /// \param arg0 the value to substitute for the first template query
+ /// parameter
+ std::string preview(const SQLTypeAdapter& arg0) { return str(arg0); }
+
+ /// \brief Return the query string currently in the buffer.
+ std::string preview(SQLQueryParms& p) { return str(p); }
/// \brief Reset the query object so that it can be reused.
///
@@ -263,19 +276,6 @@
/// queries using one of the other methods. (Static strings, SSQLS,
/// or the stream interface.)
void reset();
-
- /// \brief Return the query string currently in the buffer.
- std::string preview() { return str(template_defaults); }
-
- /// \brief Return the query string currently in the buffer with
- /// template query parameter substitution.
- ///
- /// \param arg0 the value to substitute for the first template query
- /// parameter
- std::string preview(const SQLTypeAdapter& arg0) { return str(arg0); }
-
- /// \brief Return the query string currently in the buffer.
- std::string preview(SQLQueryParms& p) { return str(p); }
/// \brief Get built query as a null-terminated C++ string
std::string str() { return str(template_defaults); }
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits