Author: wyoung
Date: Fri Jul 13 02:15:34 2007
New Revision: 1683
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1683&view=rev
Log:
Renamed Query::def to Query::template_defaults to make its purpose
clearer.
Modified:
trunk/Wishlist
trunk/doc/userman/userman.dbx
trunk/lib/query.cpp
trunk/lib/query.h
Modified: trunk/Wishlist
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=1683&r1=1682&r2=1683&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Fri Jul 13 02:15:34 2007
@@ -72,8 +72,6 @@
that they only have meaning once a query is tried, but that
isn't true. They're an indicator of whether the object has
had any problems at all, not just problems in query execution.
-
- o Rename Query::def to tquery_defaults to clarify its purpose.
o Connection::error() returns const char*, while Query::error()
returns std::string. Pick one.
Modified: trunk/doc/userman/userman.dbx
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/userman.dbx?rev=1683&r1=1682&r2=1683&view=diff
==============================================================================
--- trunk/doc/userman/userman.dbx (original)
+++ trunk/doc/userman/userman.dbx Fri Jul 13 02:15:34 2007
@@ -1163,8 +1163,8 @@
<para>The template query mechanism allows you to set
default parameter values. You simply assign a value
for the parameter to the appropriate position in the
- <varname>Query::def</varname> array. You can refer to the
- parameters either by position or by name:</para>
+ <varname>Query::template_defaults</varname> array. You can
+ refer to the parameters either by position or by name:</para>
<programlisting>
query.def[1] = "item";
@@ -1229,10 +1229,11 @@
<sect2>
<title>Error Handling</title>
- <para>If for some reason you did not specify all the parameters
- when executing the query and the remaining parameters do not
- have their values set via <varname>Query::def</varname>,
- the query object will throw a <ulink type="classref"
+ <para>If for some reason you did not specify all
+ the parameters when executing the query and the
+ remaining parameters do not have their values set
+ via <varname>Query::template_defaults</varname>, the
+ query object will throw a <ulink type="classref"
url="BadParamCount"/> object. If this happens, you
can get an explanation of what happened by calling
<methodname>BadParamCount::what()</methodname>, like so:</para>
Modified: trunk/lib/query.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1683&r1=1682&r2=1683&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Fri Jul 13 02:15:34 2007
@@ -40,7 +40,7 @@
#endif
OptionalExceptions(te),
Lockable(false),
-def(this),
+template_defaults(this),
conn_(c),
success_(false)
{
@@ -57,7 +57,7 @@
#endif
OptionalExceptions(q.throw_exceptions()),
Lockable(q.locked()),
-def(q.def),
+template_defaults(q.template_defaults),
conn_(q.conn_),
success_(q.success_)
{
@@ -70,7 +70,7 @@
{
set_exceptions(rhs.throw_exceptions());
set_lock(rhs.locked());
- def = rhs.def;
+ template_defaults = rhs.template_defaults;
conn_ = rhs.conn_;
success_ = rhs.success_;
@@ -109,13 +109,13 @@
ResNSel
Query::execute(const SQLString& s)
{
- if ((parse_elems_.size() == 2) && !def.processing_) {
+ if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
// We're a template query and we haven't gone through this path
// 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_);
+ AutoFlag<> af(template_defaults.processing_);
return execute(str(SQLQueryParms() << s));
}
else {
@@ -361,8 +361,8 @@
if (size_t(num) < p.size()) {
c = &p;
}
- else if (size_t(num) < def.size()) {
- c = &def;
+ else if (size_t(num) < template_defaults.size()) {
+ c = &template_defaults;
}
else {
*this << " ERROR";
@@ -390,20 +390,20 @@
sbuffer_.str("");
parse_elems_.clear();
- def.clear();
+ template_defaults.clear();
}
Result
Query::store(const SQLString& s)
{
- if ((parse_elems_.size() == 2) && !def.processing_) {
+ if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
// We're a template query and we haven't gone through this path
// 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_);
+ AutoFlag<> af(template_defaults.processing_);
return store(str(SQLQueryParms() << s));
}
else {
@@ -545,13 +545,13 @@
ResUse
Query::use(const SQLString& s)
{
- if ((parse_elems_.size() == 2) && !def.processing_) {
+ if ((parse_elems_.size() == 2) && !template_defaults.processing_) {
// We're a template query and we haven't gone through this path
// 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_);
+ AutoFlag<> af(template_defaults.processing_);
return use(str(SQLQueryParms() << s));
}
else {
Modified: trunk/lib/query.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.h?rev=1683&r1=1682&r2=1683&view=diff
==============================================================================
--- trunk/lib/query.h (original)
+++ trunk/lib/query.h Fri Jul 13 02:15:34 2007
@@ -180,7 +180,7 @@
void reset();
/// \brief Return the query string currently in the buffer.
- std::string preview() { return str(def); }
+ std::string preview() { return str(template_defaults); }
/// \brief Return the query string currently in the buffer with
/// template query parameter substitution.
@@ -194,7 +194,7 @@
std::string preview(SQLQueryParms& p) { return str(p); }
/// \brief Get built query as a null-terminated C++ string
- std::string str() { return str(def); }
+ std::string str() { return str(template_defaults); }
/// \brief Get built query as a null-terminated C++ string with
/// template query parameter substitution.
@@ -239,7 +239,7 @@
/// \return ResNSel status information about the query
///
/// \sa exec(), store(), storein(), and use()
- ResNSel execute() { return execute(str(def)); }
+ ResNSel execute() { return execute(str(template_defaults)); }
/// \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(str(def)); }
+ ResUse use() { return use(str(template_defaults)); }
/// \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(str(def)); }
+ Result store() { return store(str(template_defaults)); }
/// \brief Execute query in a C++ string
///
@@ -572,7 +572,7 @@
template <class Sequence>
void storein_sequence(Sequence& con)
{
- storein_sequence(con, str(def));
+ storein_sequence(con, str(template_defaults));
}
/// \brief Execute a query, storing the result set in an STL
@@ -585,7 +585,7 @@
template <class Set>
void storein_set(Set& con)
{
- storein_set(con, str(def));
+ storein_set(con, str(template_defaults));
}
/// \brief Execute a query, and store the entire result set
@@ -609,7 +609,7 @@
template <class Container>
void storein(Container& con)
{
- storein(con, str(def));
+ storein(con, str(template_defaults));
}
/// \brief Specialization of storein_sequence() for \c std::vector
@@ -803,7 +803,7 @@
/// \brief The default template parameters
///
/// Used for filling in parameterized queries.
- SQLQueryParms def;
+ SQLQueryParms template_defaults;
private:
friend class SQLQueryParms;
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits