[libgdamm] Wrapped GdaSqlBuilder class



commit fa132c6d47b9470a016c9ffbdd76fe04b3be8a86
Author: Johannes Schmid <jhs gnome org>
Date:   Thu Sep 24 13:54:06 2009 +0200

    Wrapped GdaSqlBuilder class

 ChangeLog                    |   12 +++++++
 libgda/src/filelist.am       |    1 +
 libgda/src/sqlbuilder.ccg    |   41 ++++++++++++++++++++++
 libgda/src/sqlbuilder.hg     |   76 ++++++++++++++++++++++++++++++++++++++++++
 tools/m4/convert_libgdamm.m4 |    2 +
 5 files changed, 132 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 37318d2..8e48d03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2009-09-24  Johannes Schmid <jschmid openismus com>
 
+  * libgda/src/filelist.am: 
+  Added sqlbuilder.hg/ccg
+  
+  * libgda/src/sqlbuilder.hg:
+  * libgda/src/sqlbuilder.ccg:
+  Wrapped GdaSqlBuilder class
+  
+  * tools/m4/convert_libgdamm.m4:
+  Added two new enums for GdaSqlBuilder
+
+2009-09-24  Johannes Schmid <jschmid openismus com>
+
 	* libgda/src/libgda_enums.defs:
 	* libgda/src/libgda_methods.defs:
 	* libgda/src/libgda_signals.defs:
diff --git a/libgda/src/filelist.am b/libgda/src/filelist.am
index 860f867..1bcb931 100644
--- a/libgda/src/filelist.am
+++ b/libgda/src/filelist.am
@@ -41,6 +41,7 @@ files_hg =			\
 	serverprovider.hg	\
 	set.hg			\
 	sqlparser.hg		\
+	sqlbuilder.hg   \
 	statement.hg		\
 	transactionstatus.hg	\
 	xatransaction.hg
diff --git a/libgda/src/sqlbuilder.ccg b/libgda/src/sqlbuilder.ccg
new file mode 100644
index 0000000..b187bc3
--- /dev/null
+++ b/libgda/src/sqlbuilder.ccg
@@ -0,0 +1,41 @@
+// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in
+
+/* sqlparser.cc
+ * 
+ * Copyright 2003 libgdamm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgdamm/sqlbuilder.h>
+#include <libgda/gda-sql-builder.h>
+#include <libgda/gda-enum-types.h>
+#include <sql-parser/gda-sql-parser-enum-types.h>
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+uint SqlBuilder::cond_v(uint id, SqlOperatorType op, Glib::ArrayHandle<uint> op_ids)
+{
+  return gda_sql_builder_cond_v(gobj(), id, (GdaSqlOperatorType) op, const_cast<guint*>(op_ids.data()), op_ids.size());
+}
+
+} /* namespace Gda */
+
+} /* namespace Gnome */
+
diff --git a/libgda/src/sqlbuilder.hg b/libgda/src/sqlbuilder.hg
new file mode 100644
index 0000000..d088853
--- /dev/null
+++ b/libgda/src/sqlbuilder.hg
@@ -0,0 +1,76 @@
+// -*- C++ -*- //
+
+/* sqlbuilder.h
+ *
+ * Copyright 2006 libgdamm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or(at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgdamm/statement.h>
+
+_DEFS(libgdamm,libgda)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+_WRAP_ENUM(SqlOperatorType, GdaSqlOperatorType)
+_WRAP_ENUM(SqlSelectJoinType, GdaSqlSelectJoinType)
+_WRAP_GERROR(SqlBuilderError, GdaSqlBuilderError, GDA_SQL_BUILDER_ERROR)
+
+/*
+ * @ingroup Connection
+ */
+class SqlBuilder : public Glib::Object
+{
+  _CLASS_GOBJECT(SqlBuilder, GdaSqlBuilder, GDA_SQL_BUILDER, Glib::Object, GObject)
+protected:
+  SqlBuilder(SqlStatementType type);
+public:
+  _WRAP_CREATE(SqlStatementType type)
+
+  _WRAP_METHOD(Glib::RefPtr<Statement> get_statement(), gda_sql_builder_get_statement, errthrow)
+  // TODO: Wrap SqlStatement
+  //_WRAP_METHOD(Glib::RefPtr<SqlStatement> get_sql_statement(bool copy_it), gda_sql_builder_get_sql_statement, errthrow)
+
+  // Expression API
+  _WRAP_METHOD(guint ident(guint id, const Glib::ustring& string), gda_sql_builder_ident)
+  // TODO: expr -> vararg
+  _WRAP_METHOD(guint param(guint id, const Glib::ustring& param_name, GType type, bool nullok), gda_sql_builder_param)
+
+  _WRAP_METHOD(guint cond(guint id, SqlOperatorType op, guint op1, guint op2, guint op3), gda_sql_builder_cond)
+  _WRAP_METHOD_DOCS_ONLY(gda_sql_builder_cond_v)
+  guint cond_v(guint id, SqlOperatorType op, Glib::ArrayHandle<guint> op_ids);
+
+  // Statement API
+  _WRAP_METHOD(guint select_add_target(guint id, guint table_id, const Glib::ustring& alias), gda_sql_builder_select_add_target)
+  _WRAP_METHOD(guint select_join_targets(guint id, guint left_target_id, guint right_target_id, SqlSelectJoinType join_type, guint join_expr), gda_sql_builder_select_join_targets)
+  _WRAP_METHOD(void join_add_field(guint join_id, const Glib::ustring& field_name), gda_sql_builder_join_add_field)
+  _WRAP_METHOD(void select_order_by(guint expr_id, bool asc, const Glib::ustring& collation_name), gda_sql_builder_select_order_by)
+  
+  // General Statement API
+  _WRAP_METHOD(void set_table(const Glib::ustring& table_name), gda_sql_builder_set_table)
+  _WRAP_METHOD(void set_where(guint cond_id), gda_sql_builder_set_where)
+  _WRAP_METHOD(void add_field(guint field_id, guint value_id), gda_sql_builder_add_field)
+  
+};
+
+} // namespace Gda
+} // namespace Gnome
+
diff --git a/tools/m4/convert_libgdamm.m4 b/tools/m4/convert_libgdamm.m4
index d0a21ad..df1bdcb 100644
--- a/tools/m4/convert_libgdamm.m4
+++ b/tools/m4/convert_libgdamm.m4
@@ -126,6 +126,8 @@ _CONV_ENUM(Gda,MetaSortType)
 _CONV_ENUM(Gda,MetaGraphInfo)
 _CONV_ENUM(Gda,StatementSqlFlag)
 _CONV_ENUM(Gda,SqlParserError)
+_CONV_ENUM(Gda,SqlOperatorType)
+_CONV_ENUM(Gda,SqlSelectJoinType)
 
 # structs
 _CONVERSION(`Blob&',`GdaBlob*',__FR2P)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]