Author: wyoung
Date: Thu Jun 25 08:21:49 2009
New Revision: 2538
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2538&view=rev
Log:
Minor changes to nascent SsqlsBase class to make it build and generate
docs without warnings. Still not yet being used, but it builds....
Modified:
trunk/lib/ssqls2.cpp
trunk/lib/ssqls2.h
Modified: trunk/lib/ssqls2.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/ssqls2.cpp?rev=2538&r1=2537&r2=2538&view=diff
==============================================================================
--- trunk/lib/ssqls2.cpp (original)
+++ trunk/lib/ssqls2.cpp Thu Jun 25 08:21:49 2009
@@ -32,49 +32,60 @@
using namespace std;
-namespace mysqlpp {
-
// All of the Active Record calls below follow a common pattern, which
// we can only express as a macro. They just wrap similar calls in
// Query, varying only in minor per-call specific details.
#define QUERY_ACTIVE_RECORD_WRAPPER(action, conn, fs) \
if (conn) conn_ = conn; \
if (conn_) { \
- if (conn_.connected()) { \
- if (populated(fs)) return
conn_.query().action(*this).execute(); \
- else if (conn_.throw_exceptions()) throw BadQuery( \
+ if (conn_->connected()) { \
+ if (populated(fs)) return
conn_->query().action(*this).execute(); \
+ else if (conn_->throw_exceptions()) throw BadQuery( \
"Cannot " #action " insufficiently
populated SSQLS"); \
else return false; \
} \
- else if (conn_.throw_exceptions()) throw ConnectionFailed(
+ else if (conn_->throw_exceptions()) throw ConnectionFailed( \
"Cannot " #action " SSQLS without established
connection"); \
else return false; \
} \
- else throw ObjectNotInitialized(typeid(*this).name()); \
+ else throw ObjectNotInitialized(typeid(*this).name());
+namespace mysqlpp {
bool
SsqlsBase::create(Connection* conn) const
{
- QUERY_ACTIVE_RECORD_WRAPPER(insert, conn, fs_not_autoinc);
+ (void)conn;
+ //TODO define Query::insert(SsqlsBase&)
+ //QUERY_ACTIVE_RECORD_WRAPPER(insert, conn, fs_not_autoinc);
+ return false;
}
bool
SsqlsBase::load(Connection* conn) const
{
- QUERY_ACTIVE_RECORD_WRAPPER(select, conn, fs_key);
+ (void)conn;
+ //TODO define Query::select(SsqlsBase&)
+ //QUERY_ACTIVE_RECORD_WRAPPER(select, conn, fs_key);
+ return false;
}
bool
SsqlsBase::remove(Connection* conn) const
{
- QUERY_ACTIVE_RECORD_WRAPPER(remove, conn, fs_key);
+ (void)conn;
+ //TODO define Query::remove(SsqlsBase&)
+ //QUERY_ACTIVE_RECORD_WRAPPER(remove, conn, fs_key);
+ return false;
}
bool
SsqlsBase::save(Connection* conn) const
{
- QUERY_ACTIVE_RECORD_WRAPPER(update, conn, fs_all);
+ (void)conn;
+ //TODO define Query::update(SsqlsBase&)
+ //QUERY_ACTIVE_RECORD_WRAPPER(update, conn, fs_all);
+ return false;
}
} // end namespace mysqlpp
Modified: trunk/lib/ssqls2.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/ssqls2.h?rev=2538&r1=2537&r2=2538&view=diff
==============================================================================
--- trunk/lib/ssqls2.h (original)
+++ trunk/lib/ssqls2.h Thu Jun 25 08:21:49 2009
@@ -27,6 +27,8 @@
#if !defined(MYSQLPP_SSQLS2_H)
#define MYSQLPP_SSQLS2_H
+#include "common.h"
+
#include <iostream>
namespace mysqlpp {
@@ -34,6 +36,7 @@
#if !defined(DOXYGEN_IGNORE)
// Make Doxygen ignore this
class MYSQLPP_EXPORT Connection;
+class MYSQLPP_EXPORT Row;
#endif
/// \brief Base class for all SSQLSv2 classes
@@ -49,7 +52,7 @@
fs_all, ///< all fields
fs_key, ///< fields with "is key" attribute
fs_set, ///< fields that have been given a value
- fs_not_autoinc, ///< fields without "is autoinc" attribute
+ fs_not_autoinc ///< fields without "is autoinc" attribute
};
/// \brief Create table in database matching subclass schema
@@ -213,8 +216,8 @@
/// particular call.
SsqlsBase(Connection* conn = 0) :
output_mode_(om_value_list),
- instance_table_name_(0),
- conn_(conn)
+ conn_(conn),
+ instance_table_name_(0)
{
}
@@ -224,11 +227,13 @@
/// \param conn pointer to connection we should use for Active
/// Record methods' queries, if no connection is passed for that
/// particular call.
+ /// \todo do something with row parameter
SsqlsBase(const Row& row, Connection* conn = 0) :
output_mode_(om_value_list),
- instance_table_name_(0),
- conn_(conn)
- {
+ conn_(conn),
+ instance_table_name_(0)
+ {
+ (void)row;
}
/// \brief Destructor
@@ -238,7 +243,7 @@
mutable enum {
om_equal_list,
om_name_list,
- om_value_list,
+ om_value_list
} output_mode_;
/// \brief Connection object we were initialized from, if any
@@ -270,8 +275,10 @@
/// reset to give value lists again on completion of the insert operation.
/// For example:
///
-/// \code stock s = ...; // initialize an SSQLSv2 object of 'stock' class
-/// \code cout << "Set field names: " << s.name_list() << endl;
+/// \code
+/// stock s = ...; // initialize an SSQLSv2 object of 'stock' class
+/// cout << "Set field names: " << s.name_list() << endl;
+/// \endcode
///
/// The \c s.name_list() call sets the output mode to "names", then passes
/// \c cout and \c *this to this operator, which then calls the version
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits