gnomemm r2008 - in libgdamm/trunk: . libgda/src
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r2008 - in libgdamm/trunk: . libgda/src
- Date: Thu, 22 Jan 2009 15:59:21 +0000 (UTC)
Author: murrayc
Date: Thu Jan 22 15:59:21 2009
New Revision: 2008
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2008&view=rev
Log:
2009-01-22 Murray Cumming <murrayc murrayc com>
* libgda/src/statement.ccg:
* libgda/src/statement.hg: Rename to_sql_extended() to to_sql().
Use Glib::convert_return_gchar_ptr_to_ustring() instead of leaking the
string. Added an overload with no arguments. Made them all const.
Modified:
libgdamm/trunk/ChangeLog
libgdamm/trunk/libgda/src/connection.hg
libgdamm/trunk/libgda/src/statement.ccg
libgdamm/trunk/libgda/src/statement.hg
Modified: libgdamm/trunk/libgda/src/connection.hg
==============================================================================
--- libgdamm/trunk/libgda/src/connection.hg (original)
+++ libgdamm/trunk/libgda/src/connection.hg Thu Jan 22 15:59:21 2009
@@ -114,22 +114,30 @@
_WRAP_METHOD(void clear_events_list(), gda_connection_clear_events_list)
_WRAP_METHOD_DOCS_ONLY(gda_connection_statement_execute)
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<Glib::Object> statement_execute(const Glib::RefPtr<Statement>& stmt, const Glib::RefPtr<Set>& params, StatementModelUsage model_usage, Glib::RefPtr<Set>& last_insert_row);
#else
Glib::RefPtr<Glib::Object> statement_execute(const Glib::RefPtr<Statement>& stmt, const Glib::RefPtr<Set>& params, StatementModelUsage model_usage, Glib::RefPtr<Set>& last_insert_row, std::auto_ptr<Glib::Error>& error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
+//TODO: Documentation:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
- Glib::RefPtr<Glib::Object> statement_execute(const Glib::RefPtr<Statement>& stmt, StatementModelUsage model_usage);
- Glib::RefPtr<Glib::Object> statement_execute(const Glib::ustring& sql, StatementModelUsage model_usage);
+ Glib::RefPtr<Glib::Object> statement_execute(const Glib::RefPtr<Statement>& stmt, StatementModelUsage model_usage = STATEMENT_MODEL_RANDOM_ACCESS);
#else
Glib::RefPtr<Glib::Object> statement_execute(const Glib::RefPtr<Statement>& stmt, StatementModelUsage model_usage, std::auto_ptr<Glib::Error>& error);
+#endif // GLIBMM_EXCEPTIONS_ENABLED
+
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ Glib::RefPtr<Glib::Object> statement_execute(const Glib::ustring& sql, StatementModelUsage model_usage = STATEMENT_MODEL_RANDOM_ACCESS);
+#else
Glib::RefPtr<Glib::Object> statement_execute(const Glib::ustring& sql, StatementModelUsage model_usage, std::auto_ptr<Glib::Error>& error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(Glib::RefPtr<DataModel> statement_execute_select(const Glib::RefPtr<Statement>& stmt, const Glib::RefPtr<Set>& params), gda_connection_statement_execute_select, errthrow)
+//TODO: Documentation:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<DataModel> statement_execute_select(const Glib::RefPtr<Statement>& stmt, StatementModelUsage model_usage = STATEMENT_MODEL_RANDOM_ACCESS);
Glib::RefPtr<DataModel> statement_execute_select(const Glib::ustring& sql, StatementModelUsage model_usage = STATEMENT_MODEL_RANDOM_ACCESS);
@@ -144,18 +152,23 @@
_WRAP_METHOD_DOCS_ONLY(gda_connection_statement_execute_non_select)
+
+//TODO: Documentation:
+//TODO: It's not nice that these two method overloads differ only by the constness of the set.
#ifdef GLIBMM_EXCEPTIONS_ENABLED
int statement_execute_non_select(const Glib::RefPtr<Statement>& stmt, const Glib::RefPtr<Set>& params, Glib::RefPtr<Set>& last_insert_row);
#else
int statement_execute_non_select(const Glib::RefPtr<Statement>& stmt, const Glib::RefPtr<Set>& params, Glib::RefPtr<Set>& last_insert_row, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
+//TODO: Documentation:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
int statement_execute_non_select(const Glib::RefPtr<Statement>& stmt, const Glib::RefPtr<Set>& params);
#else
int statement_execute_non_select(const Glib::RefPtr<Statement>& stmt, const Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
+//TODO: Documentation:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
int statement_execute_non_select(const Glib::RefPtr<Statement>& stmt);
#else
@@ -232,7 +245,7 @@
bool update_meta_store_table(const Glib::ustring& table_name);
#else
bool update_meta_store_table(const Glib::ustring& table_name, std::auto_ptr<Glib::Error>& err);
-#endif
+#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool statement_prepare(const Glib::RefPtr<Statement>& stmt), gda_connection_statement_prepare, errthrow)
Modified: libgdamm/trunk/libgda/src/statement.ccg
==============================================================================
--- libgdamm/trunk/libgda/src/statement.ccg (original)
+++ libgdamm/trunk/libgda/src/statement.ccg Thu Jan 22 15:59:21 2009
@@ -39,7 +39,8 @@
{
GError* gerror = 0;
GdaSet* set = 0;
- bool retval = gda_statement_get_parameters(gobj(), &set, &gerror);
+ const bool retval = gda_statement_get_parameters(gobj(), &set, &gerror);
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
@@ -47,22 +48,47 @@
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
- if (set)
+
+ if(set)
{
params = Glib::wrap(set);
params->reference();
}
+
+ return retval;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::ustring Statement::to_sql() const
+#else
+Glib::ustring Statement::to_sql(std::auto_ptr<Glib::Error>& error) const
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ const Glib::ustring retval =
+ Glib::convert_return_gchar_ptr_to_ustring(
+ gda_statement_to_sql(const_cast<GdaStatement*>(gobj()), 0, &gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
return retval;
}
-
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
-Glib::ustring Statement::to_sql(const Glib::RefPtr<Set>& params)
+Glib::ustring Statement::to_sql(const Glib::RefPtr<Set>& params) const
#else
-Glib::ustring Statement::to_sql(const Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error)
+Glib::ustring Statement::to_sql(const Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error) const
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
- Glib::ustring retval = gda_statement_to_sql(gobj(), Glib::unwrap(params), &gerror);
+ const Glib::ustring retval =
+ Glib::convert_return_gchar_ptr_to_ustring(
+ gda_statement_to_sql(const_cast<GdaStatement*>(gobj()), Glib::unwrap(params), &gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
@@ -74,17 +100,19 @@
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
-Glib::ustring Statement::to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
- StatementSqlFlag flags, HolderSList& params_used)
+Glib::ustring Statement::to_sql(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
+ StatementSqlFlag flags, const HolderSList& params_used) const
#else
-Glib::ustring Statement::to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
- StatementSqlFlag flags, HolderSList& params_used,
- std::auto_ptr<Glib::Error>& error)
+Glib::ustring Statement::to_sql(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
+ StatementSqlFlag flags, const HolderSList& params_used,
+ std::auto_ptr<Glib::Error>& error) const
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
GSList* list = 0;
- Glib::ustring retval = gda_statement_to_sql_extended(gobj(), Glib::unwrap(cnc), Glib::unwrap(params), (GdaStatementSqlFlag) flags, &list, &gerror);
+ const Glib::ustring retval =
+ Glib::convert_return_gchar_ptr_to_ustring(
+ gda_statement_to_sql_extended(const_cast<GdaStatement*>(gobj()), Glib::unwrap(cnc), Glib::unwrap(params), (GdaStatementSqlFlag) flags, &list, &gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
Modified: libgdamm/trunk/libgda/src/statement.hg
==============================================================================
--- libgdamm/trunk/libgda/src/statement.hg (original)
+++ libgdamm/trunk/libgda/src/statement.hg Thu Jan 22 15:59:21 2009
@@ -73,33 +73,41 @@
_WRAP_METHOD(Glib::ustring serialize() const, gda_statement_serialize)
- //TODO: Should this be const?
+ //TODO: Should this be const? Probably not, because the caller could change Set. murrayc.
_WRAP_METHOD_DOCS_ONLY(gda_statement_get_parameters)
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool get_parameters(Glib::RefPtr<Set>& out_params);
#else
bool get_parameters(Glib::RefPtr<Set>& out_params, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
+ _IGNORE(gda_statement_get_parameters)
+ //TODO: Documentation:
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ Glib::ustring to_sql() const;
+ #else
+ Glib::ustring to_sql(std::auto_ptr<Glib::Error>& error) const;
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ //TODO: Documentation:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
- Glib::ustring to_sql(const Glib::RefPtr<Set>& params);
+ Glib::ustring to_sql(const Glib::RefPtr<Set>& params) const;
#else
- Glib::ustring to_sql(const Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error);
+ Glib::ustring to_sql(const Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error) const;
#endif //GLIBMM_EXCEPTIONS_ENABLED
- _IGNORE(gda_statement_to_sql_real)
+ _IGNORE(gda_statement_to_sql)
typedef Glib::ListHandle< const Glib::RefPtr<Holder> > HolderSList;
- //TODO: Should this be const?
+ //TODO: Add an overload without the params?
_WRAP_METHOD_DOCS_ONLY(gda_statement_to_sql_extended)
#ifdef GLIBMM_EXCEPTIONS_ENABLED
- Glib::ustring to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
- StatementSqlFlag flags, HolderSList& params_used);
+ Glib::ustring to_sql(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
+ StatementSqlFlag flags, const HolderSList& params_used) const;
#else
- Glib::ustring to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
- StatementSqlFlag flags, HolderSList& params_used,
- std::auto_ptr<Glib::Error>& error);
+ Glib::ustring to_sql(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params,
+ StatementSqlFlag flags, const HolderSList& params_used,
+ std::auto_ptr<Glib::Error>& error) const;
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(SqlStatementType get_statement_type() const, gda_statement_get_statement_type)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]