[libgdamm] GdaSqlBuilder: Added wrapper around gda_sql_builder_expr(_value)



commit 528003dc08ff88f7789a19ac6334c703e26ce2f1
Author: Johannes Schmid <jhs gnome org>
Date:   Fri Sep 25 12:50:30 2009 +0200

    GdaSqlBuilder: Added wrapper around gda_sql_builder_expr(_value)

 ChangeLog                      |   31 +++-
 libgda/src/libgda_methods.defs |  377 +++++++++++++++++++++-------------------
 libgda/src/sqlbuilder.ccg      |    9 +-
 libgda/src/sqlbuilder.hg       |   13 ++-
 tools/m4/convert_libgdamm.m4   |    1 +
 5 files changed, 235 insertions(+), 196 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8e48d03..4d4c31d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,27 @@
+2009-09-25  Johannes Schmid <jschmid openismus com>
+
+	* libgda/src/sqlbuilder.hg:
+	* libgda/src/sqlbuilder.ccg:
+	Wrapped gda_sql_builder_expr(_value) after it was fixed in libgda
+	
+	* libgda/src/libgda_methods.defs:
+	Regenerated to have the new method
+	
+	* tools/m4/convert_libgdamm.m4:
+	Added Value conversion (can hopefully be removed once libgda fixes the
+	constness of the argument)
+
 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
+	* 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>
 
diff --git a/libgda/src/libgda_methods.defs b/libgda/src/libgda_methods.defs
index 78517f7..2b3f22f 100644
--- a/libgda/src/libgda_methods.defs
+++ b/libgda/src/libgda_methods.defs
@@ -5051,6 +5051,17 @@
   (varargs #t)
 )
 
+(define-method expr_value
+  (of-object "GdaSqlBuilder")
+  (c-name "gda_sql_builder_expr_value")
+  (return-type "guint")
+  (parameters
+    '("guint" "id")
+    '("GdaDataHandler*" "dh")
+    '("GValue*" "value")
+  )
+)
+
 (define-method param
   (of-object "GdaSqlBuilder")
   (c-name "gda_sql_builder_param")
@@ -5083,7 +5094,7 @@
   (parameters
     '("guint" "id")
     '("GdaSqlOperatorType" "op")
-    '("guint*" "op_ids")
+    '("const-guint*" "op_ids")
     '("gint" "op_ids_size")
   )
 )
@@ -6615,188 +6626,6 @@
 
 ;; -*- scheme -*-
 ; object definitions ...
-(define-object ReportDocument
-  (in-module "Gda")
-  (parent "GObject")
-  (c-name "GdaReportDocument")
-  (gtype-id "GDA_TYPE_REPORT_DOCUMENT")
-)
-
-(define-object ReportDocbookDocument
-  (in-module "Gda")
-  (parent "GdaReportDocument")
-  (c-name "GdaReportDocbookDocument")
-  (gtype-id "GDA_TYPE_REPORT_DOCBOOK_DOCUMENT")
-)
-
-(define-object ReportEngine
-  (in-module "Gda")
-  (parent "GObject")
-  (c-name "GdaReportEngine")
-  (gtype-id "GDA_TYPE_REPORT_ENGINE")
-)
-
-(define-object ReportRmlDocument
-  (in-module "Gda")
-  (parent "GdaReportDocument")
-  (c-name "GdaReportRmlDocument")
-  (gtype-id "GDA_TYPE_REPORT_RML_DOCUMENT")
-)
-
-;; Enumerations and flags ...
-
-
-;; From gda-report-docbook-document.h
-
-(define-function gda_report_docbook_document_get_type
-  (c-name "gda_report_docbook_document_get_type")
-  (return-type "GType")
-)
-
-(define-function gda_report_docbook_document_new
-  (c-name "gda_report_docbook_document_new")
-  (is-constructor-of "GdaReportDocbookDocument")
-  (return-type "GdaReportDocument*")
-  (parameters
-    '("GdaReportEngine*" "engine")
-  )
-)
-
-
-
-;; From gda-report-document.h
-
-(define-function gda_report_document_get_type
-  (c-name "gda_report_document_get_type")
-  (return-type "GType")
-)
-
-(define-method set_template
-  (of-object "GdaReportDocument")
-  (c-name "gda_report_document_set_template")
-  (return-type "none")
-  (parameters
-    '("const-gchar*" "file")
-  )
-)
-
-(define-method run_as_html
-  (of-object "GdaReportDocument")
-  (c-name "gda_report_document_run_as_html")
-  (return-type "gboolean")
-  (parameters
-    '("const-gchar*" "filename")
-    '("GError**" "error")
-  )
-)
-
-(define-method run_as_pdf
-  (of-object "GdaReportDocument")
-  (c-name "gda_report_document_run_as_pdf")
-  (return-type "gboolean")
-  (parameters
-    '("const-gchar*" "filename")
-    '("GError**" "error")
-  )
-)
-
-
-
-;; From gda-report-engine.h
-
-(define-function gda_report_engine_get_type
-  (c-name "gda_report_engine_get_type")
-  (return-type "GType")
-)
-
-(define-function gda_report_engine_new
-  (c-name "gda_report_engine_new")
-  (is-constructor-of "GdaReportEngine")
-  (return-type "GdaReportEngine*")
-  (parameters
-    '("xmlNodePtr" "spec_node")
-  )
-)
-
-(define-function gda_report_engine_new_from_string
-  (c-name "gda_report_engine_new_from_string")
-  (return-type "GdaReportEngine*")
-  (parameters
-    '("const-gchar*" "spec_string")
-  )
-)
-
-(define-function gda_report_engine_new_from_file
-  (c-name "gda_report_engine_new_from_file")
-  (return-type "GdaReportEngine*")
-  (parameters
-    '("const-gchar*" "spec_file_name")
-  )
-)
-
-(define-method declare_object
-  (of-object "GdaReportEngine")
-  (c-name "gda_report_engine_declare_object")
-  (return-type "none")
-  (parameters
-    '("GObject*" "object")
-    '("const-gchar*" "obj_name")
-  )
-)
-
-(define-method find_declared_object
-  (of-object "GdaReportEngine")
-  (c-name "gda_report_engine_find_declared_object")
-  (return-type "GObject*")
-  (parameters
-    '("GType" "obj_type")
-    '("const-gchar*" "obj_name")
-  )
-)
-
-(define-method run_as_node
-  (of-object "GdaReportEngine")
-  (c-name "gda_report_engine_run_as_node")
-  (return-type "xmlNodePtr")
-  (parameters
-    '("GError**" "error")
-  )
-)
-
-(define-method run_as_doc
-  (of-object "GdaReportEngine")
-  (c-name "gda_report_engine_run_as_doc")
-  (return-type "xmlDocPtr")
-  (parameters
-    '("GError**" "error")
-  )
-)
-
-
-
-;; From gda-report-rml-document.h
-
-(define-function gda_report_rml_document_get_type
-  (c-name "gda_report_rml_document_get_type")
-  (return-type "GType")
-)
-
-(define-function gda_report_rml_document_new
-  (c-name "gda_report_rml_document_new")
-  (is-constructor-of "GdaReportRmlDocument")
-  (return-type "GdaReportDocument*")
-  (parameters
-    '("GdaReportEngine*" "engine")
-  )
-)
-
-
-
-;; From libgda-report.h
-
-
-;; -*- scheme -*-
-; object definitions ...
 (define-object SqlParser
   (in-module "Gda")
   (parent "GObject")
@@ -8010,6 +7839,188 @@
 
 ;; -*- scheme -*-
 ; object definitions ...
+(define-object ReportDocument
+  (in-module "Gda")
+  (parent "GObject")
+  (c-name "GdaReportDocument")
+  (gtype-id "GDA_TYPE_REPORT_DOCUMENT")
+)
+
+(define-object ReportDocbookDocument
+  (in-module "Gda")
+  (parent "GdaReportDocument")
+  (c-name "GdaReportDocbookDocument")
+  (gtype-id "GDA_TYPE_REPORT_DOCBOOK_DOCUMENT")
+)
+
+(define-object ReportEngine
+  (in-module "Gda")
+  (parent "GObject")
+  (c-name "GdaReportEngine")
+  (gtype-id "GDA_TYPE_REPORT_ENGINE")
+)
+
+(define-object ReportRmlDocument
+  (in-module "Gda")
+  (parent "GdaReportDocument")
+  (c-name "GdaReportRmlDocument")
+  (gtype-id "GDA_TYPE_REPORT_RML_DOCUMENT")
+)
+
+;; Enumerations and flags ...
+
+
+;; From gda-report-docbook-document.h
+
+(define-function gda_report_docbook_document_get_type
+  (c-name "gda_report_docbook_document_get_type")
+  (return-type "GType")
+)
+
+(define-function gda_report_docbook_document_new
+  (c-name "gda_report_docbook_document_new")
+  (is-constructor-of "GdaReportDocbookDocument")
+  (return-type "GdaReportDocument*")
+  (parameters
+    '("GdaReportEngine*" "engine")
+  )
+)
+
+
+
+;; From gda-report-document.h
+
+(define-function gda_report_document_get_type
+  (c-name "gda_report_document_get_type")
+  (return-type "GType")
+)
+
+(define-method set_template
+  (of-object "GdaReportDocument")
+  (c-name "gda_report_document_set_template")
+  (return-type "none")
+  (parameters
+    '("const-gchar*" "file")
+  )
+)
+
+(define-method run_as_html
+  (of-object "GdaReportDocument")
+  (c-name "gda_report_document_run_as_html")
+  (return-type "gboolean")
+  (parameters
+    '("const-gchar*" "filename")
+    '("GError**" "error")
+  )
+)
+
+(define-method run_as_pdf
+  (of-object "GdaReportDocument")
+  (c-name "gda_report_document_run_as_pdf")
+  (return-type "gboolean")
+  (parameters
+    '("const-gchar*" "filename")
+    '("GError**" "error")
+  )
+)
+
+
+
+;; From gda-report-engine.h
+
+(define-function gda_report_engine_get_type
+  (c-name "gda_report_engine_get_type")
+  (return-type "GType")
+)
+
+(define-function gda_report_engine_new
+  (c-name "gda_report_engine_new")
+  (is-constructor-of "GdaReportEngine")
+  (return-type "GdaReportEngine*")
+  (parameters
+    '("xmlNodePtr" "spec_node")
+  )
+)
+
+(define-function gda_report_engine_new_from_string
+  (c-name "gda_report_engine_new_from_string")
+  (return-type "GdaReportEngine*")
+  (parameters
+    '("const-gchar*" "spec_string")
+  )
+)
+
+(define-function gda_report_engine_new_from_file
+  (c-name "gda_report_engine_new_from_file")
+  (return-type "GdaReportEngine*")
+  (parameters
+    '("const-gchar*" "spec_file_name")
+  )
+)
+
+(define-method declare_object
+  (of-object "GdaReportEngine")
+  (c-name "gda_report_engine_declare_object")
+  (return-type "none")
+  (parameters
+    '("GObject*" "object")
+    '("const-gchar*" "obj_name")
+  )
+)
+
+(define-method find_declared_object
+  (of-object "GdaReportEngine")
+  (c-name "gda_report_engine_find_declared_object")
+  (return-type "GObject*")
+  (parameters
+    '("GType" "obj_type")
+    '("const-gchar*" "obj_name")
+  )
+)
+
+(define-method run_as_node
+  (of-object "GdaReportEngine")
+  (c-name "gda_report_engine_run_as_node")
+  (return-type "xmlNodePtr")
+  (parameters
+    '("GError**" "error")
+  )
+)
+
+(define-method run_as_doc
+  (of-object "GdaReportEngine")
+  (c-name "gda_report_engine_run_as_doc")
+  (return-type "xmlDocPtr")
+  (parameters
+    '("GError**" "error")
+  )
+)
+
+
+
+;; From gda-report-rml-document.h
+
+(define-function gda_report_rml_document_get_type
+  (c-name "gda_report_rml_document_get_type")
+  (return-type "GType")
+)
+
+(define-function gda_report_rml_document_new
+  (c-name "gda_report_rml_document_new")
+  (is-constructor-of "GdaReportRmlDocument")
+  (return-type "GdaReportDocument*")
+  (parameters
+    '("GdaReportEngine*" "engine")
+  )
+)
+
+
+
+;; From libgda-report.h
+
+
+;; -*- scheme -*-
+; object definitions ...
 (define-object BasicForm
   (in-module "Gdaui")
   (parent "GtkVBox")
diff --git a/libgda/src/sqlbuilder.ccg b/libgda/src/sqlbuilder.ccg
index b187bc3..4741e76 100644
--- a/libgda/src/sqlbuilder.ccg
+++ b/libgda/src/sqlbuilder.ccg
@@ -30,9 +30,14 @@ namespace Gnome
 namespace Gda
 {
 
-uint SqlBuilder::cond_v(uint id, SqlOperatorType op, Glib::ArrayHandle<uint> op_ids)
+guint 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());
+  return gda_sql_builder_cond_v(gobj(), id, (GdaSqlOperatorType) op, op_ids.data(), op_ids.size());
+}
+
+guint SqlBuilder::expr(guint id, Value& value)
+{
+  return gda_sql_builder_expr_value(gobj(), id, NULL, value.gobj());
 }
 
 } /* namespace Gda */
diff --git a/libgda/src/sqlbuilder.hg b/libgda/src/sqlbuilder.hg
index d088853..5fdeda9 100644
--- a/libgda/src/sqlbuilder.hg
+++ b/libgda/src/sqlbuilder.hg
@@ -51,9 +51,18 @@ public:
 
   // Expression API
   _WRAP_METHOD(guint ident(guint id, const Glib::ustring& string), gda_sql_builder_ident)
-  // TODO: expr -> vararg
+  _IGNORE(gda_sql_builder_expr)
+  _WRAP_METHOD(guint expr(guint id, const Glib::RefPtr<DataHandler>& dh, Value& value), gda_sql_builder_expr_value)
+   /** Defines an expression in Builder which may be reused to build other parts of a statement.
+   * @param id: the requested ID, or 0 if to be determined automatically
+   * @param value: value to set the expression to
+   * 
+   * See expr() except that no custom datahandler is given 
+   *
+   * @return the ID of the new expression, or 0 if there was an error
+   */
+  guint expr(guint id, Value& value);
   _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);
diff --git a/tools/m4/convert_libgdamm.m4 b/tools/m4/convert_libgdamm.m4
index df1bdcb..50cdc6e 100644
--- a/tools/m4/convert_libgdamm.m4
+++ b/tools/m4/convert_libgdamm.m4
@@ -147,6 +147,7 @@ _CONVERSION(`const Glib::ArrayHandle<int>&',`const gint*', `$3.data()')
 _CONVERSION(`const Value&', `GValue*', `const_cast<GValue*>(($3).gobj())')
 _CONVERSION(`const Value&', `const GValue*', `($3).gobj()')
 _CONVERSION(`Value', `GValue*', `($3).gobj()')
+_CONVERSION(`Value&', `GValue*', `($3).gobj()')
 _CONVERSION(`GValue*', `Value', `$2($3)')
 _CONVERSION(`const GValue*', `Value', `$2($3)')
 



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