| gda-attributes-manager.h | | gda-attributes-manager.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 2008 The GNOME Foundation. | | * Copyright (C) 2008 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| void gda_attributes_manager_set_full (GdaAttributesMana
ger *mgr, gpointer ptr, | | void gda_attributes_manager_set_full (GdaAttributesMana
ger *mgr, gpointer ptr, | |
| const gchar *att_n
ame, const GValue *value, GDestroyNotify destroy); | | const gchar *att_n
ame, const GValue *value, GDestroyNotify destroy); | |
| const GValue *gda_attributes_manager_get (GdaAttributesMana
ger *mgr, gpointer ptr, const gchar *att_name); | | const GValue *gda_attributes_manager_get (GdaAttributesMana
ger *mgr, gpointer ptr, const gchar *att_name); | |
| void gda_attributes_manager_copy (GdaAttributesMana
ger *from_mgr, gpointer *from, | | void gda_attributes_manager_copy (GdaAttributesMana
ger *from_mgr, gpointer *from, | |
| GdaAttributesManag
er *to_mgr, gpointer *to); | | GdaAttributesManag
er *to_mgr, gpointer *to); | |
| void gda_attributes_manager_clear (GdaAttributesMana
ger *mgr, gpointer ptr); | | void gda_attributes_manager_clear (GdaAttributesMana
ger *mgr, gpointer ptr); | |
| void gda_attributes_manager_foreach (GdaAttributesMana
ger *mgr, gpointer ptr, | | void gda_attributes_manager_foreach (GdaAttributesMana
ger *mgr, gpointer ptr, | |
| GdaAttributesManag
erFunc func, gpointer data); | | GdaAttributesManag
erFunc func, gpointer data); | |
| | | | |
| /* possible predefined attribute names for gda_holder_get_attribute() or gd
a_column_get_attribute() */ | | /* possible predefined attribute names for gda_holder_get_attribute() or gd
a_column_get_attribute() */ | |
|
| #define GDA_ATTRIBUTE_DESCRIPTION "__gda_attr_descr" /* G_TYPE_STRING */ | | /** | |
| #define GDA_ATTRIBUTE_NAME "__gda_attr_name" /* G_TYPE_STRING */ | | * GDA_ATTRIBUTE_DESCRIPTION: | |
| #define GDA_ATTRIBUTE_NUMERIC_PRECISION "__gda_attr_numeric_precision" /* G | | * The corresponding attribute is the description of the object it refers t | |
| _TYPE_INT */ | | o (value has a G_TYPE_STRING type). | |
| #define GDA_ATTRIBUTE_NUMERIC_SCALE "__gda_attr_numeric_scale" /* G_TYPE_IN | | */ | |
| T */ | | #define GDA_ATTRIBUTE_DESCRIPTION "__gda_attr_descr" | |
| #define GDA_ATTRIBUTE_AUTO_INCREMENT "__gda_attr_autoinc" /* G_TYPE_BOOLEAN | | | |
| */ | | /** | |
| #define GDA_ATTRIBUTE_IS_DEFAULT "__gda_attr_is_default" /* G_TYPE_BOOLEAN | | * GDA_ATTRIBUTE_NAME: | |
| */ | | * The corresponding attribute is the name of the object it refers to (valu | |
| | | e has a G_TYPE_STRING type). | |
| | | */ | |
| | | #define GDA_ATTRIBUTE_NAME "__gda_attr_name" | |
| | | | |
| | | /** | |
| | | * GDA_ATTRIBUTE_NUMERIC_PRECISION: | |
| | | * The corresponding attribute is the number of significant digits of the o | |
| | | bject it refers to (value has a G_TYPE_INT type). | |
| | | */ | |
| | | #define GDA_ATTRIBUTE_NUMERIC_PRECISION "__gda_attr_numeric_precision" | |
| | | | |
| | | /** | |
| | | * GDA_ATTRIBUTE_NUMERIC_SCALE: | |
| | | * The corresponding attribute is the number of significant digits to the r | |
| | | ight of the decimal point of the object it refers to (value has a G_TYPE_IN | |
| | | T type). | |
| | | */ | |
| | | #define GDA_ATTRIBUTE_NUMERIC_SCALE "__gda_attr_numeric_scale" | |
| | | | |
| | | /** | |
| | | * GDA_ATTRIBUTE_AUTO_INCREMENT: | |
| | | * The corresponding attribute specifies if the object it refers to is auto | |
| | | incremented (value has a G_TYPE_BOOLEAN type). | |
| | | */ | |
| | | #define GDA_ATTRIBUTE_AUTO_INCREMENT "__gda_attr_autoinc" | |
| | | | |
| | | /** | |
| | | * GDA_ATTRIBUTE_IS_DEFAULT: | |
| | | * The corresponding attribute specifies if the object it refers to has its | |
| | | value to default (value has a G_TYPE_BOOLEAN type). | |
| | | */ | |
| | | #define GDA_ATTRIBUTE_IS_DEFAULT "__gda_attr_is_default" | |
| | | | |
| | | /** | |
| | | * GDA_ATTRIBUTE_TREE_NODE_UNKNOWN_CHILDREN: | |
| | | * This attribute, if %TRUE specifies that a tree node may or may not have | |
| | | any children nodes (value has a G_TYPE_BOOLEAN type). | |
| | | */ | |
| | | #define GDA_ATTRIBUTE_TREE_NODE_UNKNOWN_CHILDREN "__gda_attr_tnuchild" | |
| | | | |
| | | /** | |
| | | * SECTION:gda-attributes-manager | |
| | | * @short_description: Manager for lists of attributes | |
| | | * @title: Attributes manager | |
| | | * @stability: Stable | |
| | | * | |
| | | * he #GdaAttributesManager manages lists of named values (attributes) for | |
| | | the benefit of | |
| | | * others (objects or resources for which only a pointer is known). It is u | |
| | | sed internally by &LIBGDA; | |
| | | * whenever an object or a simple structure may have several attributes. | |
| | | * | |
| | | * The features are similar to those of the <link linkend="g-object-set-dat | |
| | | a">g_object_set_data()</link> and similar | |
| | | * but with the following major differences: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>it works with GObject objects and also with simple poin | |
| | | ters to data</para></listitem> | |
| | | * <listitem><para>attributes names are considered static (they are not co | |
| | | pied) and so they must either be static strings or allocated strings which | |
| | | exist (unchanged) while an attribute uses it as name</para></listitem> | |
| | | * <listitem><para>it is possible to iterate through the attributes</para> | |
| | | </listitem> | |
| | | * <listitem><para>the associated values are expected to be #GValue values | |
| | | </para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * Attibute names can be any string, but &LIBGDA; reserves some for its own | |
| | | usage, see below. | |
| | | * | |
| | | * The #GdaAttributesManager implements its own locking mechanism so it is | |
| | | thread-safe. | |
| | | * | |
| | | * | |
| | | */ | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 12 lines changed or deleted | | 87 lines changed or added | |
|
| gda-blob-op.h | | gda-blob-op.h | |
|
| /* GDA Common Library | | /* | |
| * Copyright (C) 2007 - 2009 The GNOME Foundation. | | * Copyright (C) 2007 - 2011 The GNOME Foundation. | |
| * | | * | |
| * Authors: | | * Authors: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 55 | | skipping to change at line 55 | |
| | | | |
| struct _GdaBlobOpClass { | | struct _GdaBlobOpClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /* Virtual methods */ | | /* Virtual methods */ | |
| glong (* get_length) (GdaBlobOp *op); | | glong (* get_length) (GdaBlobOp *op); | |
| glong (* read) (GdaBlobOp *op, GdaBlob *blob, glong offset,
glong size); | | glong (* read) (GdaBlobOp *op, GdaBlob *blob, glong offset,
glong size); | |
| glong (* write) (GdaBlobOp *op, GdaBlob *blob, glong offset)
; | | glong (* write) (GdaBlobOp *op, GdaBlob *blob, glong offset)
; | |
| gboolean (* write_all) (GdaBlobOp *op, GdaBlob *blob); | | gboolean (* write_all) (GdaBlobOp *op, GdaBlob *blob); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-blob-op | |
| | | * @short_description: Binary data and BLOBs handling | |
| | | * @title: Blobs | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * This object is a base class for individual database providers which supp | |
| | | ort BLOB types. It supports | |
| | | * operations to read and write data in a BLOB value (of type GDA_BLOB_TYPE | |
| | | ). | |
| | | * | |
| | | * Libgda offers two methods to manipulate binary values as two containers: | |
| | | <link linkend="GdaBinary">GdaBinary</link> | |
| | | * and <link linkend="GdaBlob">GdaBlob</link>: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>When reading from a data model returned by &LIBGDA; bin | |
| | | ary data will often be in a GdaBlob | |
| | | * object, and the associated <link linkend="GdaBlobOp">GdaBlobOp</link> | |
| | | object can be used to manipulate the | |
| | | * binary object (in a database for example)</para></listitem> | |
| | | * <listitem><para>When the binary value is created by the user, then ther | |
| | | e is no point in using a GdaBlob as | |
| | | * there can not be any <link linkend="GdaBlobOp">GdaBlobOp</link> object | |
| | | , so the GdaBinary container is | |
| | | * enough.</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * Note that a <link linkend="GdaBlob">GdaBlob</link> value (the "data" att | |
| | | ribute) will often not contain any data | |
| | | * (or only some part of the actual BLOB) | |
| | | * and that it's up to the user to use the associated <link linkend="GdaBlo | |
| | | bOp">GdaBlobOp</link> object to | |
| | | * "load" the data into the container (into the actual process heap). | |
| | | * | |
| | | * For example to load the 1st 40 bytes of a blob: | |
| | | * <programlisting> | |
| | | *GValue *blob_value = ... | |
| | | *GdaBlob *blob; | |
| | | * | |
| | | *blob = (GdaBlob*) gda_value_get_blob (blob_value); | |
| | | *gda_blob_op_read (blob->op, blob, 0, 40); | |
| | | * </programlisting> | |
| | | * | |
| | | * Another example is to write the contents of a blob to a file on disk, us | |
| | | ing a special | |
| | | * <link linkend="GdaBlobOp">GdaBlobOp</link> object (internal to &LIBGDA; | |
| | | which interfaces | |
| | | * with a file in a filesystem): | |
| | | * <programlisting> | |
| | | *GValue *blob_value; // value to copy from | |
| | | *GValue *tmp_value; | |
| | | *GdaBlob *file_blob; | |
| | | * | |
| | | *GValue *blob_value = ... | |
| | | *tmp_value = gda_value_new_blob_from_file ("MyFile.bin"); | |
| | | *file_blob = (GdaBlob*) gda_value_get_blob (tmp_value); | |
| | | * | |
| | | *if (! gda_blob_op_write_all (file_blob->op, gda_value_get_blob (blob_valu | |
| | | e))) { | |
| | | * // error | |
| | | *} | |
| | | *else { | |
| | | * gsize size; | |
| | | * size = gda_blob_op_get_length (file_blob->op); | |
| | | * g_print ("Wrote %s, size = %d\n", filename, size); | |
| | | *} | |
| | | *gda_value_free (tmp_value); | |
| | | * </programlisting> | |
| | | * | |
| | | * For further information, see: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>the section about <link linkend="gen_blobs">Binary la | |
| | | rge objects (BLOBs)</link>'s | |
| | | * abstraction</para></listitem> | |
| | | * <listitem><para><link linkend="libgda-provider-blobop">Virtual method | |
| | | s for Blob operations</link> | |
| | | * section for more information | |
| | | * about how to implement the virtual methods when creating a databa | |
| | | se provider</para></listitem> | |
| | | * </itemizedlist> | |
| | | */ | |
| | | | |
| GType gda_blob_op_get_type (void) G_GNUC_CONST; | | GType gda_blob_op_get_type (void) G_GNUC_CONST; | |
| | | | |
| glong gda_blob_op_get_length (GdaBlobOp *op); | | glong gda_blob_op_get_length (GdaBlobOp *op); | |
| glong gda_blob_op_read (GdaBlobOp *op, GdaBlob *blob, glong offset
, glong size); | | glong gda_blob_op_read (GdaBlobOp *op, GdaBlob *blob, glong offset
, glong size); | |
| gboolean gda_blob_op_read_all (GdaBlobOp *op, GdaBlob *blob); | | gboolean gda_blob_op_read_all (GdaBlobOp *op, GdaBlob *blob); | |
| glong gda_blob_op_write (GdaBlobOp *op, GdaBlob *blob, glong offset
); | | glong gda_blob_op_write (GdaBlobOp *op, GdaBlob *blob, glong offset
); | |
| gboolean gda_blob_op_write_all (GdaBlobOp *op, GdaBlob *blob); | | gboolean gda_blob_op_write_all (GdaBlobOp *op, GdaBlob *blob); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 86 lines changed or added | |
|
| gda-column.h | | gda-column.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 1998 - 2009 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Michael Lausch <michael@lausch.at> | | * Michael Lausch <michael@lausch.at> | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * | | * | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 54 | |
| GdaColumnPrivate *priv; | | GdaColumnPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaColumnClass { | | struct _GdaColumnClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /* signals */ | | /* signals */ | |
| void (* name_changed) (GdaColumn *column, const gchar *old_name); | | void (* name_changed) (GdaColumn *column, const gchar *old_name); | |
| void (* g_type_changed) (GdaColumn *column, GType old_type, GType ne
w_type); | | void (* g_type_changed) (GdaColumn *column, GType old_type, GType ne
w_type); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-column | |
| | | * @short_description: Management of #GdaDataModel column attributes | |
| | | * @title: GdaDataModel columns | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * The #GdaColumn object represents a #GdaDataModel's column and handle all | |
| | | its properties. | |
| | | */ | |
| | | | |
| GType gda_column_get_type (void) G_GNUC_CONST; | | GType gda_column_get_type (void) G_GNUC_CONST; | |
| GdaColumn *gda_column_new (void); | | GdaColumn *gda_column_new (void); | |
| GdaColumn *gda_column_copy (GdaColumn *column); | | GdaColumn *gda_column_copy (GdaColumn *column); | |
| | | | |
| const gchar *gda_column_get_description (GdaColumn *column); | | const gchar *gda_column_get_description (GdaColumn *column); | |
| void gda_column_set_description (GdaColumn *column, con
st gchar *title); | | void gda_column_set_description (GdaColumn *column, con
st gchar *title); | |
| | | | |
| const gchar *gda_column_get_name (GdaColumn *column); | | const gchar *gda_column_get_name (GdaColumn *column); | |
| void gda_column_set_name (GdaColumn *column, const gch
ar *name); | | void gda_column_set_name (GdaColumn *column, const gch
ar *name); | |
| | | | |
| | | | |
| skipping to change at line 94 | | skipping to change at line 105 | |
| void gda_column_set_position (GdaColumn *column, gint posi
tion); | | void gda_column_set_position (GdaColumn *column, gint posi
tion); | |
| | | | |
| const GValue *gda_column_get_default_value (GdaColumn *column); | | const GValue *gda_column_get_default_value (GdaColumn *column); | |
| void gda_column_set_default_value (GdaColumn *column, const GVa
lue *default_value); | | void gda_column_set_default_value (GdaColumn *column, const GVa
lue *default_value); | |
| | | | |
| const GValue *gda_column_get_attribute (GdaColumn *column, const gch
ar *attribute); | | const GValue *gda_column_get_attribute (GdaColumn *column, const gch
ar *attribute); | |
| void gda_column_set_attribute (GdaColumn *column, const gch
ar *attribute, const GValue *value, | | void gda_column_set_attribute (GdaColumn *column, const gch
ar *attribute, const GValue *value, | |
| GDestroyNotify destroy); | | GDestroyNotify destroy); | |
| | | | |
| /** | | /** | |
|
| * gda_column_set_attribute_static | | * gda_column_set_attribute_static: | |
| * @holder: a #GdaHolder | | * @holder: a #GdaHolder | |
| * @attribute: attribute's name | | * @attribute: attribute's name | |
| * @value: the value to set the attribute to, or %NULL | | * @value: the value to set the attribute to, or %NULL | |
| * | | * | |
| * This function is similar to gda_column_set_attribute() but for static st
rings | | * This function is similar to gda_column_set_attribute() but for static st
rings | |
| */ | | */ | |
| #define gda_column_set_attribute_static(holder,attribute,value) gda_column_
set_attribute((holder),(attribute),(value),NULL) | | #define gda_column_set_attribute_static(holder,attribute,value) gda_column_
set_attribute((holder),(attribute),(value),NULL) | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 15 lines changed or added | |
|
| gda-config.h | | gda-config.h | |
| | | | |
| skipping to change at line 126 | | skipping to change at line 126 | |
| void (*dsn_changed) (GdaConfig *conf, GdaDsnInfo *ds
n); | | void (*dsn_changed) (GdaConfig *conf, GdaDsnInfo *ds
n); | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-config | |
| | | * @short_description: Access/Management of libgda configuration | |
| | | * @title: Configuration | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * The functions in this section allow applications an easy access to libgd | |
| | | a's | |
| | | * configuration (the list of data sources and database providers). | |
| | | * | |
| | | * As soon as a <link linkend="GdaConfig">GdaConfig</link> is needed (for e | |
| | | xample when requesting information | |
| | | * about a data source or about a server provider), a single instance objec | |
| | | t is created, | |
| | | * and no other will need to be created. A pointer to this object can be ob | |
| | | tained with | |
| | | * <link linkend="gda-config-get">gda_config_get()</link>. Of course one ca | |
| | | n (right after having called | |
| | | * <link linkend="gda-init">gda_init()</link>) force the creation of a GdaC | |
| | | onfig object with some | |
| | | * specific properties set, using a simple call like: | |
| | | * <programlisting> | |
| | | *g_object_new (GDA_TYPE_CONFIG, "user-filename", "my_file", NULL); | |
| | | * </programlisting> | |
| | | * Please note that after that call, the caller has a reference to the newl | |
| | | y created object, and should technically | |
| | | * call <link linkend="g-object-unref">g_object_unref()</link> when finishe | |
| | | d using it. It is safe to do this | |
| | | * but also pointless since that object should not be destroyed (as no othe | |
| | | r will be created) as &LIBGDA; also | |
| | | * keeps a reference for itself. | |
| | | * | |
| | | *Data sources are defined in a per-user configuration file which is by def | |
| | | ault <filename>${HOME}/.libgda/config</filename> and | |
| | | * in a system wide configuration file which is by default <filename>${pref | |
| | | ix}/etc/libgda-4.0/config</filename>. Those | |
| | | * filenames can be modified by setting the <link linkend="GdaConfig--user- | |
| | | file">user-file</link> and | |
| | | * <link linkend="GdaConfig--system-file">system-file</link> properties for | |
| | | the single <link linkend="GdaConfig">GdaConfig</link> | |
| | | * instance. Note that setting either of these properties to <literal>NULL< | |
| | | /literal> will disable using the corresponding | |
| | | * configuration file (DSN will exist only in memory and their definition w | |
| | | ill be lost when the application finishes). | |
| | | * | |
| | | * The #GdaConfig object implements its own locking mechanism so it is thre | |
| | | ad-safe. | |
| | | * | |
| | | * Note about localization: when the #GdaConfig loads configuration files, | |
| | | it filters the | |
| | | * contents based on the current locale, so for example if your current loc | |
| | | ale is "de" then | |
| | | * all the loaded strings (for the ones which are translated) will be in th | |
| | | e German language. | |
| | | * Changing the locale afterwards will have no effect on the #GdaConfig and | |
| | | the already loaded | |
| | | * configuration. | |
| | | * The consequence is that you should first call setlocale() youself in you | |
| | | r code before using | |
| | | * a #GdaConfig object. As a side note you should also call gtk_init() befo | |
| | | re gdaui_init() because | |
| | | * gtk_init() calls setlocale(). | |
| | | */ | |
| | | | |
| GType gda_config_get_type (void) G_GNUC_CONST; | | GType gda_config_get_type (void) G_GNUC_CONST; | |
| GdaConfig* gda_config_get (void); | | GdaConfig* gda_config_get (void); | |
| | | | |
| GdaDsnInfo *gda_config_get_dsn_info (const gchar *dsn_na
me); | | GdaDsnInfo *gda_config_get_dsn_info (const gchar *dsn_na
me); | |
| gboolean gda_config_define_dsn (const GdaDsnInfo *i
nfo, GError **error); | | gboolean gda_config_define_dsn (const GdaDsnInfo *i
nfo, GError **error); | |
| gboolean gda_config_remove_dsn (const gchar *dsn_na
me, GError **error); | | gboolean gda_config_remove_dsn (const gchar *dsn_na
me, GError **error); | |
| gboolean gda_config_dsn_needs_authentication (const gchar *dsn_na
me); | | gboolean gda_config_dsn_needs_authentication (const gchar *dsn_na
me); | |
| GdaDataModel *gda_config_list_dsn (void); | | GdaDataModel *gda_config_list_dsn (void); | |
| gboolean gda_config_can_modify_system_config (void); | | gboolean gda_config_can_modify_system_config (void); | |
| | | | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 65 lines changed or added | |
|
| gda-connection.h | | gda-connection.h | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| GDA_CONNECTION_OPEN_ERROR, | | GDA_CONNECTION_OPEN_ERROR, | |
| GDA_CONNECTION_STATEMENT_TYPE_ERROR, | | GDA_CONNECTION_STATEMENT_TYPE_ERROR, | |
| GDA_CONNECTION_CANT_LOCK_ERROR, | | GDA_CONNECTION_CANT_LOCK_ERROR, | |
| GDA_CONNECTION_TASK_NOT_FOUND_ERROR, | | GDA_CONNECTION_TASK_NOT_FOUND_ERROR, | |
| GDA_CONNECTION_UNSUPPORTED_THREADS_ERROR, | | GDA_CONNECTION_UNSUPPORTED_THREADS_ERROR, | |
| GDA_CONNECTION_CLOSED_ERROR | | GDA_CONNECTION_CLOSED_ERROR | |
| } GdaConnectionError; | | } GdaConnectionError; | |
| | | | |
| #define GDA_CONNECTION_NONEXIST_DSN_ERROR GDA_CONNECTION_DSN_NOT_FOUND_ERRO
R | | #define GDA_CONNECTION_NONEXIST_DSN_ERROR GDA_CONNECTION_DSN_NOT_FOUND_ERRO
R | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-connection | |
| | | * @short_description: A connection to a database | |
| | | * @title: GdaConnection | |
| | | * @stability: Stable | |
| | | * | |
| | | * Each connection to a database is represented by a #GdaConnection object. | |
| | | A connection is created (and opened) | |
| | | * using gda_connection_open_from_dsn() if a data source has been defined, | |
| | | or gda_connection_open_from_string() | |
| | | * otherwise. It is not recommended to create a #GdaConnection object using | |
| | | g_object_new() as the results are | |
| | | * unpredictable (some parts won't correctly be initialized). | |
| | | * | |
| | | * Use the connection object to execute statements, use transactions, get m | |
| | | eta data information, ... | |
| | | * | |
| | | * If supported by the database provider being used, statements can be exec | |
| | | uted asynchronously instead of | |
| | | * blocking the execution thread untill the execution of a statement is fin | |
| | | ished. Each database provider | |
| | | * is free to implement this feature as it wishes (using the API or using t | |
| | | hreads). The steps involved to | |
| | | * execute a statement are then: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>Request the statement execution using | |
| | | * <link linkend="gda-connection-async-statement-execute">gda_connectio | |
| | | n_async_statement_execute() which returns an | |
| | | * execution ID to be used to identify a specific request</link></par | |
| | | a></listitem> | |
| | | * <listitem><para>Do some useful things (that is why async. statements' | |
| | | excution are for)</para></listitem> | |
| | | * <listitem><para>Use one or more times | |
| | | * <link linkend="gda-connection-async-fetch-result">gda_connection_asy | |
| | | nc_fetch_result()</link> to see | |
| | | * if the execution is finished, using the request ID</para></listitem> | |
| | | * <listitem><para>Use <link linkend="gda-connection-async-cancel">gda_co | |
| | | nnection_async_cancel()</link> to cancel | |
| | | * the execution of a statement</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * The #GdaConnection object implements its own locking mechanism so it is | |
| | | thread-safe. However ad some database | |
| | | * providers rely on an API which does not support threads or supports it o | |
| | | nly partially, the connections | |
| | | * opened using those providers will only be accessible from the thread whi | |
| | | ch created them (any other thread will | |
| | | * be blocked trying to access the connection, use the | |
| | | * <link linkend="gda-lockable-try-lock">gda_lockable_try_lock()</link> met | |
| | | hod to check it the connection | |
| | | * is usable from a thread). | |
| | | * | |
| | | * If a connection really needs to be accessed by several threads at once, | |
| | | then it is possible to pass the | |
| | | * #GDA_CONNECTION_OPTIONS_THREAD_SAFE flag when opening it. This flag requ | |
| | | ests that the real connection | |
| | | * be created and really accessed in a <emphasis>private</emphasis> sub thr | |
| | | ead. | |
| | | */ | |
| | | | |
| struct _GdaConnection { | | struct _GdaConnection { | |
| GObject object; | | GObject object; | |
| GdaConnectionPrivate *priv; | | GdaConnectionPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaConnectionClass { | | struct _GdaConnectionClass { | |
| GObjectClass object_class; | | GObjectClass object_class; | |
| | | | |
| /* signals */ | | /* signals */ | |
| void (*error) (GdaConnection *cnc, GdaConnecti
onEvent *error); | | void (*error) (GdaConnection *cnc, GdaConnecti
onEvent *error); | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 171 | |
| * | | * | |
| * Additional information about the GDA_CONNECTION_OPTIONS_THREAD_SAFE and
GDA_CONNECTION_OPTIONS_THREAD_ISOLATED flags: | | * Additional information about the GDA_CONNECTION_OPTIONS_THREAD_SAFE and
GDA_CONNECTION_OPTIONS_THREAD_ISOLATED flags: | |
| * The GDA_CONNECTION_OPTIONS_THREAD_SAFE flag specifies that it has to be
able to use the returned connection object from | | * The GDA_CONNECTION_OPTIONS_THREAD_SAFE flag specifies that it has to be
able to use the returned connection object from | |
| * several threads at once (locking is ensured by the #GdaConnection itself
). Depending on the database provider's | | * several threads at once (locking is ensured by the #GdaConnection itself
). Depending on the database provider's | |
| * implementation and on the native libraries it uses, the "normal" connect
ion object might not respect this requirement, | | * implementation and on the native libraries it uses, the "normal" connect
ion object might not respect this requirement, | |
| * and in this case a specific thread is started and used as the unique thr
ead which will manipulate the actual connection, | | * and in this case a specific thread is started and used as the unique thr
ead which will manipulate the actual connection, | |
| * while a "wrapper connection" is actually returned and used by the caller
(that wrapper connection passes method calls | | * while a "wrapper connection" is actually returned and used by the caller
(that wrapper connection passes method calls | |
| * from the calling thread to the actual connection's specific thread, and
gets the results back). | | * from the calling thread to the actual connection's specific thread, and
gets the results back). | |
| * | | * | |
| * The GDA_CONNECTION_OPTIONS_THREAD_ISOLATED forces using a specific threa
d and a "wrapper connection" even if the | | * The GDA_CONNECTION_OPTIONS_THREAD_ISOLATED forces using a specific threa
d and a "wrapper connection" even if the | |
|
| * "normal" connection would itself be thread safe; this is usefull for exa
mple to be sure the asynchronous API can | | * "normal" connection would itself be thread safe; this is useful for exam
ple to be sure the asynchronous API can | |
| * always be used (see gda_connection_async_statement_execute()). | | * always be used (see gda_connection_async_statement_execute()). | |
| * | | * | |
| * Having a specific thread and a "wrapper connection" definitely has an im
pact on the performances (because it involves | | * Having a specific thread and a "wrapper connection" definitely has an im
pact on the performances (because it involves | |
| * messages passing between threads for every method call), so using the | | * messages passing between threads for every method call), so using the | |
| * GDA_CONNECTION_OPTIONS_THREAD_SAFE or GDA_CONNECTION_OPTIONS_THREAD_ISOL
ATED flags should be carefully considered. | | * GDA_CONNECTION_OPTIONS_THREAD_SAFE or GDA_CONNECTION_OPTIONS_THREAD_ISOL
ATED flags should be carefully considered. | |
| * | | * | |
| * Note about the @GDA_CONNECTION_OPTIONS_AUTO_META_DATA flag: | | * Note about the @GDA_CONNECTION_OPTIONS_AUTO_META_DATA flag: | |
| * <itemizedlist> | | * <itemizedlist> | |
| * <listitem><para>Every time a DDL statement is successfully executed, th
e associated mate data, if | | * <listitem><para>Every time a DDL statement is successfully executed, th
e associated mate data, if | |
| defined, will be updated, which has a impact on performances<
/para></listitem> | | defined, will be updated, which has a impact on performances<
/para></listitem> | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 61 lines changed or added | |
|
| gda-data-comparator.h | | gda-data-comparator.h | |
|
| /* gda-data-comparator.h | | /* | |
| * | | * Copyright (C) 2008 - 2011 Vivien Malerba | |
| * Copyright (C) 2008 - 2009 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 76 | |
| GObject object; | | GObject object; | |
| GdaDataComparatorPrivate *priv; | | GdaDataComparatorPrivate *priv; | |
| }; | | }; | |
| | | | |
| /* struct for the object's class */ | | /* struct for the object's class */ | |
| struct _GdaDataComparatorClass | | struct _GdaDataComparatorClass | |
| { | | { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| gboolean (* diff_computed) (GdaDataComparator *comp,
GdaDiff *diff); | | gboolean (* diff_computed) (GdaDataComparator *comp,
GdaDiff *diff); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-comparator | |
| | | * @short_description: Simple data model's contents comparison | |
| | | * @title: GdaDataComparator | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * The #GdaDataComparator is a simple object which takes two #GdaDataModel | |
| | | objects and compare them. | |
| | | * Actual comparison is performed when the gda_data_comparator_compute_diff | |
| | | () is called; for each | |
| | | * difference found, the <link linkend="GdaDataComparator-diff-computed">di | |
| | | ff-computed</link> signal | |
| | | * is emitted (any user installed signal handler which returns FALSE stops | |
| | | the computing process). | |
| | | * | |
| | | * There are some limitations to this object: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>The data models compared must have the same number and | |
| | | type of columns</para></listitem> | |
| | | * <listitem><para>The comparison is done column-for-column: one cannot o | |
| | | mit columns in the comparison, nor compare | |
| | | * columns with different positions</para></listitem> | |
| | | * </itemizedlist> | |
| | | */ | |
| | | | |
| GType gda_data_comparator_get_type (void) G_GNUC_CONST; | | GType gda_data_comparator_get_type (void) G_GNUC_CONST; | |
| GObject *gda_data_comparator_new (GdaDataModel *old_mo
del, GdaDataModel *new_model); | | GObject *gda_data_comparator_new (GdaDataModel *old_mo
del, GdaDataModel *new_model); | |
| void gda_data_comparator_set_key_columns (GdaDataComparator *c
omp, const gint *col_numbers, gint nb_cols); | | void gda_data_comparator_set_key_columns (GdaDataComparator *c
omp, const gint *col_numbers, gint nb_cols); | |
| gboolean gda_data_comparator_compute_diff (GdaDataComparator *c
omp, GError **error); | | gboolean gda_data_comparator_compute_diff (GdaDataComparator *c
omp, GError **error); | |
| gint gda_data_comparator_get_n_diffs (GdaDataComparator *c
omp); | | gint gda_data_comparator_get_n_diffs (GdaDataComparator *c
omp); | |
| const GdaDiff *gda_data_comparator_get_diff (GdaDataComparator *c
omp, gint pos); | | const GdaDiff *gda_data_comparator_get_diff (GdaDataComparator *c
omp, gint pos); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 29 lines changed or added | |
|
| gda-data-handler.h | | gda-data-handler.h | |
|
| /* gda-data-handler.h | | /* | |
| * | | * Copyright (C) 2003 - 2011 Vivien Malerba | |
| * Copyright (C) 2003 - 2006 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 50 | |
| gchar *(* get_sql_from_value) (GdaDataHandler *dh, const G
Value *value); | | gchar *(* get_sql_from_value) (GdaDataHandler *dh, const G
Value *value); | |
| gchar *(* get_str_from_value) (GdaDataHandler *dh, const G
Value *value); | | gchar *(* get_str_from_value) (GdaDataHandler *dh, const G
Value *value); | |
| GValue *(* get_value_from_sql) (GdaDataHandler *dh, const g
char *sql, GType type); | | GValue *(* get_value_from_sql) (GdaDataHandler *dh, const g
char *sql, GType type); | |
| GValue *(* get_value_from_str) (GdaDataHandler *dh, const g
char *str, GType type); | | GValue *(* get_value_from_str) (GdaDataHandler *dh, const g
char *str, GType type); | |
| GValue *(* get_sane_init_value) (GdaDataHandler *dh, GType t
ype); | | GValue *(* get_sane_init_value) (GdaDataHandler *dh, GType t
ype); | |
| | | | |
| gboolean (* accepts_g_type) (GdaDataHandler *dh, GType t
ype); | | gboolean (* accepts_g_type) (GdaDataHandler *dh, GType t
ype); | |
| const gchar *(* get_descr) (GdaDataHandler *dh); | | const gchar *(* get_descr) (GdaDataHandler *dh); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-handler | |
| | | * @short_description: Interface which provides data handling (conversions) | |
| | | capabilities | |
| | | * @title: GdaDataHandler | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * Because data types vary a lot from a DBMS to another, the #GdaDataHandle | |
| | | r interface helps | |
| | | * managing data in its various representations, and converting from one to | |
| | | another: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>as a #GValue which is a generic value container for th | |
| | | e C language</para></listitem> | |
| | | * <listitem><para>as a human readable string</para></listitem> | |
| | | * <listitem><para>as an SQL string (a string which can be used in SQL st | |
| | | atements)</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * For each data type, a corresponding #GdaDataHandler object can be reques | |
| | | ted using the | |
| | | * <link linkend="gda-data-handler-get-default">gda_data_handler_get_defaul | |
| | | t()</link> function. However, when working | |
| | | * with a specific database provider, it's better to use a #GdaDataHandler | |
| | | which may be specific to the | |
| | | * database provider which will correctly handle each database specifics us | |
| | | ing | |
| | | * <link linkend="gda-server-provider-get-data-handler-g-type">gda_server_p | |
| | | rovider_get_data_handler_g_type()</link> or | |
| | | * <link linkend="gda-server-provider-get-data-handler-dbms">gda_server_pro | |
| | | vider_get_data_handler_dbms()</link>. | |
| | | */ | |
| | | | |
| GType gda_data_handler_get_type (void) G_GNUC_CONST; | | GType gda_data_handler_get_type (void) G_GNUC_CONST; | |
| | | | |
| /* Simple data manipulation */ | | /* Simple data manipulation */ | |
| gchar *gda_data_handler_get_sql_from_value (GdaDataHandler *dh,
const GValue *value); | | gchar *gda_data_handler_get_sql_from_value (GdaDataHandler *dh,
const GValue *value); | |
| gchar *gda_data_handler_get_str_from_value (GdaDataHandler *dh,
const GValue *value); | | gchar *gda_data_handler_get_str_from_value (GdaDataHandler *dh,
const GValue *value); | |
| GValue *gda_data_handler_get_value_from_sql (GdaDataHandler *dh,
const gchar *sql, GType type); | | GValue *gda_data_handler_get_value_from_sql (GdaDataHandler *dh,
const gchar *sql, GType type); | |
| GValue *gda_data_handler_get_value_from_str (GdaDataHandler *dh,
const gchar *str, GType type); | | GValue *gda_data_handler_get_value_from_str (GdaDataHandler *dh,
const gchar *str, GType type); | |
| GValue *gda_data_handler_get_sane_init_value (GdaDataHandler *dh,
GType type); | | GValue *gda_data_handler_get_sane_init_value (GdaDataHandler *dh,
GType type); | |
| | | | |
| /* information about the data handler itself */ | | /* information about the data handler itself */ | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 36 lines changed or added | |
|
| gda-data-model-array.h | | gda-data-model-array.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 1998 - 2009 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| typedef struct _GdaDataModelArrayPrivate GdaDataModelArrayPrivate; | | typedef struct _GdaDataModelArrayPrivate GdaDataModelArrayPrivate; | |
| | | | |
| struct _GdaDataModelArray { | | struct _GdaDataModelArray { | |
| GObject object; | | GObject object; | |
| GdaDataModelArrayPrivate *priv; | | GdaDataModelArrayPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaDataModelArrayClass { | | struct _GdaDataModelArrayClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-model-array | |
| | | * @short_description: An implementation of #GdaDataModel based on a #GArra | |
| | | y | |
| | | * @title: GdaDataModelArray | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * The #GdaDataModelArray object is a data model which internally uses a #G | |
| | | Array to index all its rows (represented | |
| | | * as #GdaRow objects). In this data model, all the data is stored in memor | |
| | | y, which can be a memory limitation if the number | |
| | | * of rows is huge. | |
| | | * This type of data model is easy to use to store some temporary data, and | |
| | | has a random access mode (any value can be accessed | |
| | | * at any time without the need for an iterator). | |
| | | */ | |
| | | | |
| GType gda_data_model_array_get_type (void) G_GNUC_CON
ST; | | GType gda_data_model_array_get_type (void) G_GNUC_CON
ST; | |
| GdaDataModel *gda_data_model_array_new_with_g_types (gint cols, ...); | | GdaDataModel *gda_data_model_array_new_with_g_types (gint cols, ...); | |
|
| | | GdaDataModel *gda_data_model_array_new_with_g_types_v (gint cols, GTyp
e *types); | |
| GdaDataModel *gda_data_model_array_new (gint cols); | | GdaDataModel *gda_data_model_array_new (gint cols); | |
| GdaDataModelArray *gda_data_model_array_copy_model (GdaDataModel *sr
c, GError **error); | | GdaDataModelArray *gda_data_model_array_copy_model (GdaDataModel *sr
c, GError **error); | |
| | | | |
| GdaRow *gda_data_model_array_get_row (GdaDataModelArra
y *model, gint row, GError **error); | | GdaRow *gda_data_model_array_get_row (GdaDataModelArra
y *model, gint row, GError **error); | |
| void gda_data_model_array_set_n_columns (GdaDataModelArra
y *model, gint cols); | | void gda_data_model_array_set_n_columns (GdaDataModelArra
y *model, gint cols); | |
| void gda_data_model_array_clear (GdaDataModelArra
y *model); | | void gda_data_model_array_clear (GdaDataModelArra
y *model); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 22 lines changed or added | |
|
| gda-data-model-bdb.h | | gda-data-model-bdb.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 2007 - 2009 The GNOME Foundation. | | * Copyright (C) 2007 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| GdaDataModelBdbPrivate *priv; | | GdaDataModelBdbPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaDataModelBdbClass { | | struct _GdaDataModelBdbClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /* virtual methods */ | | /* virtual methods */ | |
| GSList *(*create_key_columns) (GdaDataModelBdb *mode
l); | | GSList *(*create_key_columns) (GdaDataModelBdb *mode
l); | |
| GSList *(*create_data_columns) (GdaDataModelBdb *mode
l); | | GSList *(*create_data_columns) (GdaDataModelBdb *mode
l); | |
| GValue *(*get_key_part) (GdaDataModelBdb *mode
l, | | GValue *(*get_key_part) (GdaDataModelBdb *mode
l, | |
|
| | | | |
| gpointer data, gint l
ength, gint part); | | gpointer data, gint l
ength, gint part); | |
| GValue *(*get_data_part) (GdaDataModelBdb *mode
l, | | GValue *(*get_data_part) (GdaDataModelBdb *mode
l, | |
| gpointer data, gint l
ength, gint part); | | gpointer data, gint l
ength, gint part); | |
| gboolean (*update_key_part) (GdaDataModelBdb *mode
l, | | gboolean (*update_key_part) (GdaDataModelBdb *mode
l, | |
| gpointer data, gint l
ength, gint part, | | gpointer data, gint l
ength, gint part, | |
| const GValue *value,
GError **error); | | const GValue *value,
GError **error); | |
| gboolean (*update_data_part) (GdaDataModelBdb *mode
l, | | gboolean (*update_data_part) (GdaDataModelBdb *mode
l, | |
| gpointer data, gint l
ength, gint part, | | gpointer data, gint l
ength, gint part, | |
| const GValue *value,
GError **error); | | const GValue *value,
GError **error); | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-model-bdb | |
| | | * @short_description: GdaDataModel to access Berkeley DB database contents | |
| | | * @title: GdaDataModelBdb | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * The #GdaDataModelBdb object allows to access the contents of a Berkeley | |
| | | DB database as a | |
| | | * #GdaDataModel object. | |
| | | * | |
| | | * By default the resulting GdaDataModel contains only two columns (named " | |
| | | key" and "data") of type | |
| | | * GDA_TYPE_BINARY, but this object can be subclassed to convert the key or | |
| | | data part of a BDB record | |
| | | * into several columns (implement the create_key_columns(), create_data_co | |
| | | lumns(), get_key_part(), and get_data_part() | |
| | | * virtual methods). | |
| | | * | |
| | | * Note: this type of data model is available only if the Berkeley DB libra | |
| | | ry was found at compilation time. | |
| | | */ | |
| | | | |
| GType gda_data_model_bdb_get_type (void) G_GNUC_CONST; | | GType gda_data_model_bdb_get_type (void) G_GNUC_CONST; | |
| GdaDataModel *gda_data_model_bdb_new (const gchar *filename, const
gchar *db_name); | | GdaDataModel *gda_data_model_bdb_new (const gchar *filename, const
gchar *db_name); | |
| | | | |
| const GSList *gda_data_model_bdb_get_errors (GdaDataModelBdb *model); | | const GSList *gda_data_model_bdb_get_errors (GdaDataModelBdb *model); | |
| void gda_data_model_bdb_clean_errors (GdaDataModelBdb *model); | | void gda_data_model_bdb_clean_errors (GdaDataModelBdb *model); | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 27 lines changed or added | |
|
| gda-data-model-dir.h | | gda-data-model-dir.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 2007 - 2009 The GNOME Foundation. | | * Copyright (C) 2007 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| typedef struct _GdaDataModelDirPrivate GdaDataModelDirPrivate; | | typedef struct _GdaDataModelDirPrivate GdaDataModelDirPrivate; | |
| | | | |
| struct _GdaDataModelDir { | | struct _GdaDataModelDir { | |
| GObject object; | | GObject object; | |
| GdaDataModelDirPrivate *priv; | | GdaDataModelDirPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaDataModelDirClass { | | struct _GdaDataModelDirClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-model-dir | |
| | | * @short_description: GdaDataModel to list files in filesystem | |
| | | * @title: GdaDataModelDir | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * The #GdaDataModelDir object lists files on a filesystem which are locate | |
| | | d | |
| | | * below a "basedir" directory, one file per row. The data model has the fo | |
| | | llowing columns: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>the "dir_name" column (G_TYPE_STRING): contains the di | |
| | | rname part of the file</para></listitem> | |
| | | * <listitem><para>the "file_name" column (G_TYPE_STRING): contains the f | |
| | | ile name part of the file</para></listitem> | |
| | | * <listitem><para>the "size" column (G_TYPE_UINT): contains the size in | |
| | | bytes of the file</para></listitem> | |
| | | * <listitem><para>the "mime_type" column (G_TYPE_STRING): contains the m | |
| | | ime type of the file (if GnomeVFS has been found, and NULL otherwise)</para | |
| | | ></listitem> | |
| | | * <listitem><para>the "md5sum" column (G_TYPE_STRING): contains the MD5 | |
| | | hash of each file (if LibGCrypt has been found, and NULL otherwise)</para>< | |
| | | /listitem> | |
| | | * <listitem><para>the "data" column (GDA_TYPE_BLOB): contains the conten | |
| | | ts of each file</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * Note that the actual values of the "mime_type", "md5sum" and "data" colu | |
| | | mns are computed only when they | |
| | | * are requested to help with performances. | |
| | | */ | |
| | | | |
| GType gda_data_model_dir_get_type (void) G_GNUC_CONST; | | GType gda_data_model_dir_get_type (void) G_GNUC_CONST; | |
| GdaDataModel *gda_data_model_dir_new (const gchar *basedir); | | GdaDataModel *gda_data_model_dir_new (const gchar *basedir); | |
| | | | |
| const GSList *gda_data_model_dir_get_errors (GdaDataModelDir *model); | | const GSList *gda_data_model_dir_get_errors (GdaDataModelDir *model); | |
| void gda_data_model_dir_clean_errors (GdaDataModelDir *model); | | void gda_data_model_dir_clean_errors (GdaDataModelDir *model); | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 36 lines changed or added | |
|
| gda-data-model-import.h | | gda-data-model-import.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 2006 - 2010 The GNOME Foundation. | | * Copyright (C) 2006 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-model-import | |
| | | * @short_description: Importing data from a string or a file | |
| | | * @title: GdaDataModelImport | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * The #GdaDataModelImport data model imports data from a string or a file. | |
| | | The data can either be | |
| | | * in a CSV (comma separated values) format or in an XML format as describe | |
| | | d by the libgda-array.dtd DTD (as a side | |
| | | * way it is also possible to import data from an already-build XML tree va | |
| | | lidated against that DTD). | |
| | | * | |
| | | * The caller must decide, upon construction, if the new #GdaDataModelImpor | |
| | | t must support random access or simply | |
| | | * a cursor based access. Random access makes it easier to use the resultin | |
| | | g data model but consumes more memory as | |
| | | * all the data is copied in memory, and is thus not suitable for large dat | |
| | | a sets. Note that importing from an | |
| | | * already-build XML tree will always result in a random access data model. | |
| | | * | |
| | | * Various import options can be specified using parameters in a #GdaParame | |
| | | terList object. The available options | |
| | | * depend on the format of the imported data listed here: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>"SEPARATOR" (string, CVS import only): specifies the s | |
| | | eparator to consider</para></listitem> | |
| | | * <listitem><para>"ESCAPE_CHAR" (string, CVS import only): specifies the | |
| | | character used to "escape" the strings | |
| | | * contained between two separators</para></listitem> | |
| | | * <listitem><para>"ENCODING" (string, CVS import only): specifies the ch | |
| | | aracter set used in the imported data</para></listitem> | |
| | | * <listitem><para>"TITLE_AS_FIRST_LINE" (boolean, CVS import only): TRUE | |
| | | to specify that the first line of the | |
| | | * imported data contains the column names</para></listitem> | |
| | | * <listitem><para>"G_TYPE_<col number>" (GType, CVS import only): | |
| | | specifies the requested GType type for the column | |
| | | * numbered "col number"</para></listitem> | |
| | | * </itemizedlist> | |
| | | */ | |
| | | | |
| GType gda_data_model_import_get_type (void) G_GNUC_CONST; | | GType gda_data_model_import_get_type (void) G_GNUC_CONST; | |
| GdaDataModel *gda_data_model_import_new_file (const gchar *filename, gb
oolean random_access, GdaSet *options); | | GdaDataModel *gda_data_model_import_new_file (const gchar *filename, gb
oolean random_access, GdaSet *options); | |
| GdaDataModel *gda_data_model_import_new_mem (const gchar *data, gboole
an random_access, GdaSet *options); | | GdaDataModel *gda_data_model_import_new_mem (const gchar *data, gboole
an random_access, GdaSet *options); | |
| GdaDataModel *gda_data_model_import_new_xml_node (xmlNodePtr node); | | GdaDataModel *gda_data_model_import_new_xml_node (xmlNodePtr node); | |
| | | | |
| GSList *gda_data_model_import_get_errors (GdaDataModelImport *model
); | | GSList *gda_data_model_import_get_errors (GdaDataModelImport *model
); | |
| void gda_data_model_import_clean_errors (GdaDataModelImport *model
); | | void gda_data_model_import_clean_errors (GdaDataModelImport *model
); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 44 lines changed or added | |
|
| gda-data-model-iter.h | | gda-data-model-iter.h | |
|
| /* gda-data-model-iter.h | | /* | |
| * | | * Copyright (C) 2005 - 2011 Vivien Malerba | |
| * Copyright (C) 2005 - 2009 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 57 | |
| }; | | }; | |
| | | | |
| /* struct for the object's class */ | | /* struct for the object's class */ | |
| struct _GdaDataModelIterClass | | struct _GdaDataModelIterClass | |
| { | | { | |
| GdaSetClass parent_class; | | GdaSetClass parent_class; | |
| | | | |
| void (* row_changed) (GdaDataModelIter *iter
, gint row); | | void (* row_changed) (GdaDataModelIter *iter
, gint row); | |
| void (* end_of_data) (GdaDataModelIter *iter
); | | void (* end_of_data) (GdaDataModelIter *iter
); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-model-iter | |
| | | * @short_description: Data model iterator | |
| | | * @title: GdaDataModelIter | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * A #GdaDataModelIter object is used to iterate through the rows of a #Gda | |
| | | DataModel. If the data model is accessible | |
| | | * in a random access way then any number of #GdaDataModelIter objects can | |
| | | be created on the same data model, and | |
| | | * if the data model only supports a cursor based access then only one #Gda | |
| | | DataModelIter can be created. In any case | |
| | | * creating a #GdaDataModelIter should be done using the gda_data_model_cre | |
| | | ate_iter() method. Note that if | |
| | | * the data model only supports a cursor based access, then calling this me | |
| | | thod several times will always return | |
| | | * the same #GdaDataModelIter, but with its reference count increased by 1 | |
| | | (so you should call g_object_unref() when | |
| | | * finished with it). | |
| | | * | |
| | | * When a #GdaDataModelIter is valid (that is when it points to an existing | |
| | | row in the data model it iterates through), | |
| | | * the individual values (corresponding to each column of the data model, a | |
| | | t the pointer row) can be accessed | |
| | | * using the gda_data_model_iter_get_value_at() or gda_data_model_iter_get_ | |
| | | value_for_field() methods | |
| | | * (or in the same way #GdaSet's values are accessed as #GdaDataModelIter i | |
| | | nherits the #GdaSet). | |
| | | * | |
| | | * Right after being created, a #GdaDataModelIter is invalid (does not poin | |
| | | t to any row of its data model). To read the | |
| | | * first row of the data model, use the gda_data_model_iter_move_next() met | |
| | | hod. Calling this method several times will | |
| | | * move the iterator forward, up to when the data model has no more rows an | |
| | | d the #GdaDataModelIter will be declared invalid | |
| | | * (and gda_data_model_iter_move_next() has returned FALSE). Note that at t | |
| | | his point, the number of rows in the data | |
| | | * model will be known. | |
| | | * | |
| | | * If the data model supports it, a #GdaDataModelIter can be moved backward | |
| | | s using the gda_data_model_iter_move_prev() | |
| | | * method. However if the iterator is invalid, moving backwards will not be | |
| | | possible (on the contrary to | |
| | | * gda_data_model_iter_move_next() which moves to the first row). | |
| | | * | |
| | | * The gda_data_model_iter_move_to_row() method, if the iterator can be mov | |
| | | ed both forward and backwards, can move the | |
| | | * iterator to a specific row (sometimes faster than moving it forward or b | |
| | | ackwards a number of times). | |
| | | * | |
| | | * The following figure illustrates the #GdaDataModelIter usage: | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="GdaDataModelIter.png" format="PNG" contentwidth= | |
| | | "190mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaDataModelIter's usage</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | * | |
| | | * Note: the new #GdaDataModelIter does not hold any reference to the data | |
| | | model it iterates through (ie. | |
| | | * if this data model is destroyed at some point, the new iterator will bec | |
| | | ome useless but in | |
| | | * any case it will not prevent the data model from being destroyed). | |
| | | */ | |
| | | | |
| GType gda_data_model_iter_get_type (void) G_GNUC_CO
NST; | | GType gda_data_model_iter_get_type (void) G_GNUC_CO
NST; | |
| | | | |
| const GValue *gda_data_model_iter_get_value_at (GdaDataModelIte
r *iter, gint col); | | const GValue *gda_data_model_iter_get_value_at (GdaDataModelIte
r *iter, gint col); | |
| const GValue *gda_data_model_iter_get_value_for_field (GdaDataModelIte
r *iter, const gchar *field_name); | | const GValue *gda_data_model_iter_get_value_for_field (GdaDataModelIte
r *iter, const gchar *field_name); | |
| gboolean gda_data_model_iter_set_value_at (GdaDataModelIte
r *iter, gint col, | | gboolean gda_data_model_iter_set_value_at (GdaDataModelIte
r *iter, gint col, | |
| const GValue *va
lue, GError **error); | | const GValue *va
lue, GError **error); | |
| | | | |
| gboolean gda_data_model_iter_move_to_row (GdaDataModelIte
r *iter, gint row); | | gboolean gda_data_model_iter_move_to_row (GdaDataModelIte
r *iter, gint row); | |
| gboolean gda_data_model_iter_move_next (GdaDataModelIte
r *iter); | | gboolean gda_data_model_iter_move_next (GdaDataModelIte
r *iter); | |
| gboolean gda_data_model_iter_move_prev (GdaDataModelIte
r *iter); | | gboolean gda_data_model_iter_move_prev (GdaDataModelIte
r *iter); | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 72 lines changed or added | |
|
| gda-data-model.h | | gda-data-model.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 1998 - 2008 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| | | | |
| skipping to change at line 78 | | skipping to change at line 78 | |
| | | | |
| typedef enum { | | typedef enum { | |
| GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR, | | GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR, | |
| GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR, | | GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR, | |
| GDA_DATA_MODEL_VALUES_LIST_ERROR, | | GDA_DATA_MODEL_VALUES_LIST_ERROR, | |
| GDA_DATA_MODEL_VALUE_TYPE_ERROR, | | GDA_DATA_MODEL_VALUE_TYPE_ERROR, | |
| GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR, | | GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR, | |
| GDA_DATA_MODEL_ACCESS_ERROR, | | GDA_DATA_MODEL_ACCESS_ERROR, | |
| GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR, | | GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR, | |
| GDA_DATA_MODEL_FILE_EXIST_ERROR, | | GDA_DATA_MODEL_FILE_EXIST_ERROR, | |
|
| GDA_DATA_MODEL_XML_FORMAT_ERROR | | GDA_DATA_MODEL_XML_FORMAT_ERROR, | |
| | | | |
| | | GDA_DATA_MODEL_TRUNCATED_ERROR, | |
| | | GDA_DATA_MODEL_OTHER_ERROR | |
| } GdaDataModelError; | | } GdaDataModelError; | |
| | | | |
| /* struct for the interface */ | | /* struct for the interface */ | |
| struct _GdaDataModelIface { | | struct _GdaDataModelIface { | |
| GTypeInterface g_iface; | | GTypeInterface g_iface; | |
| | | | |
| /* virtual table */ | | /* virtual table */ | |
| gint (* i_get_n_rows) (GdaDataModel *model); | | gint (* i_get_n_rows) (GdaDataModel *model); | |
| gint (* i_get_n_columns) (GdaDataModel *model); | | gint (* i_get_n_columns) (GdaDataModel *model); | |
| | | | |
| | | | |
| skipping to change at line 120 | | skipping to change at line 123 | |
| void (* i_set_notify) (GdaDataModel *model, gb
oolean do_notify_changes); | | void (* i_set_notify) (GdaDataModel *model, gb
oolean do_notify_changes); | |
| gboolean (* i_get_notify) (GdaDataModel *model); | | gboolean (* i_get_notify) (GdaDataModel *model); | |
| void (* i_send_hint) (GdaDataModel *model, Gd
aDataModelHint hint, const GValue *hint_value); | | void (* i_send_hint) (GdaDataModel *model, Gd
aDataModelHint hint, const GValue *hint_value); | |
| | | | |
| /* signals */ | | /* signals */ | |
| void (* row_inserted) (GdaDataModel *model, gi
nt row); | | void (* row_inserted) (GdaDataModel *model, gi
nt row); | |
| void (* row_updated) (GdaDataModel *model, gi
nt row); | | void (* row_updated) (GdaDataModel *model, gi
nt row); | |
| void (* row_removed) (GdaDataModel *model, gi
nt row); | | void (* row_removed) (GdaDataModel *model, gi
nt row); | |
| void (* changed) (GdaDataModel *model); | | void (* changed) (GdaDataModel *model); | |
| void (* reset) (GdaDataModel *model); | | void (* reset) (GdaDataModel *model); | |
|
| | | | |
| | | /* getting more information about a data model */ | |
| | | GError **(* i_get_exceptions) (GdaDataModel *model); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-model | |
| | | * @short_description: Data model interface | |
| | | * @title: GdaDataModel | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModelIter | |
| | | * | |
| | | * A #GdaDataModel represents an array of values organized in rows and colu | |
| | | mns. All the data in the same | |
| | | * column have the same type, and all the data in each row have the same se | |
| | | mantic meaning. The #GdaDataModel is | |
| | | * actually an interface implemented by other objects to support various ki | |
| | | nds of data storage and operations. | |
| | | * | |
| | | * Depending on the real implementation, the contents of data models may be | |
| | | modified by the user using functions | |
| | | * provided by the model. The actual operations a data model permits can be | |
| | | known using the | |
| | | * gda_data_model_get_access_flags() method. | |
| | | * | |
| | | * Again, depending on the real implementation, data retrieving can be done | |
| | | either accessing direct random | |
| | | * values located by their row and column, or using a cursor, or both. Use | |
| | | the gda_data_model_get_access_flags() | |
| | | * method to know how the data model can be accessed. | |
| | | * <itemizedlist> | |
| | | * <listitem><para>Random access to a data model's contents is done using | |
| | | gda_data_model_get_value_at(), or using | |
| | | * one or more #GdaDataModelIter object(s);</para></listitem> | |
| | | * <listitem><para>Cursor access to a data model's contents is done using | |
| | | a #GdaDataModelIter object (only one can be created), | |
| | | * it is <emphasis>not possible</emphasis> to use gda_data_model_get_ | |
| | | value_at() in this mode.</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * Random access data models are easier to use since picking a value is ver | |
| | | y simple using the gda_data_model_get_value_at(), | |
| | | * but consume more memory since all the accessible values must generally b | |
| | | e present in memory even if they are not used. | |
| | | * Thus if a data model must handle large quantities of data, it is general | |
| | | ly wiser to use a data model which can be | |
| | | * only accessed using a cursor. | |
| | | * | |
| | | * As a side note there are also data models which wrap other data models s | |
| | | uch as: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>The #GdaDataProxy data model which stores temporary | |
| | | modifications and shows only some | |
| | | * parts of the wrapped data model</para></listitem> | |
| | | * <listitem><para>The #GdaDataAccessWrapper data model which offers a | |
| | | memory efficient random access on top of a | |
| | | * wrapped cursor based access data model</para></listitem> | |
| | | * </itemizedlist> | |
| | | */ | |
| | | | |
| GType gda_data_model_get_type (void) G_GNUC_CON
ST; | | GType gda_data_model_get_type (void) G_GNUC_CON
ST; | |
| | | | |
| GdaDataModelAccessFlags gda_data_model_get_access_flags (GdaDataModel *mo
del); | | GdaDataModelAccessFlags gda_data_model_get_access_flags (GdaDataModel *mo
del); | |
| | | | |
| gint gda_data_model_get_n_rows (GdaDataModel *mo
del); | | gint gda_data_model_get_n_rows (GdaDataModel *mo
del); | |
| gint gda_data_model_get_n_columns (GdaDataModel *mo
del); | | gint gda_data_model_get_n_columns (GdaDataModel *mo
del); | |
| | | | |
| GdaColumn *gda_data_model_describe_column (GdaDataModel *mo
del, gint col); | | GdaColumn *gda_data_model_describe_column (GdaDataModel *mo
del, gint col); | |
| gint gda_data_model_get_column_index (GdaDataModel *mo
del, const gchar *name); | | gint gda_data_model_get_column_index (GdaDataModel *mo
del, const gchar *name); | |
| const gchar *gda_data_model_get_column_name (GdaDataModel *mod
el, gint col); | | const gchar *gda_data_model_get_column_name (GdaDataModel *mod
el, gint col); | |
| | | | |
| skipping to change at line 154 | | skipping to change at line 199 | |
| const GValue *val
ue, GError **error); | | const GValue *val
ue, GError **error); | |
| gboolean gda_data_model_set_values (GdaDataModel *mo
del, gint row, | | gboolean gda_data_model_set_values (GdaDataModel *mo
del, gint row, | |
| GList *values, GE
rror **error); | | GList *values, GE
rror **error); | |
| gint gda_data_model_append_row (GdaDataModel *mo
del, GError **error); | | gint gda_data_model_append_row (GdaDataModel *mo
del, GError **error); | |
| gint gda_data_model_append_values (GdaDataModel *mo
del, const GList *values, GError **error); | | gint gda_data_model_append_values (GdaDataModel *mo
del, const GList *values, GError **error); | |
| gboolean gda_data_model_remove_row (GdaDataModel *mo
del, gint row, GError **error); | | gboolean gda_data_model_remove_row (GdaDataModel *mo
del, gint row, GError **error); | |
| gint gda_data_model_get_row_from_values (GdaDataModel *mo
del, GSList *values, gint *cols_index); | | gint gda_data_model_get_row_from_values (GdaDataModel *mo
del, GSList *values, gint *cols_index); | |
| | | | |
| void gda_data_model_send_hint (GdaDataModel *mo
del, GdaDataModelHint hint, const GValue *hint_value); | | void gda_data_model_send_hint (GdaDataModel *mo
del, GdaDataModelHint hint, const GValue *hint_value); | |
| | | | |
|
| | | GError **gda_data_model_get_exceptions (GdaDataModel *mo | |
| | | del); | |
| | | | |
| /* contents saving and loading */ | | /* contents saving and loading */ | |
| gchar *gda_data_model_export_to_string (GdaDataModel *mo
del, GdaDataModelIOFormat format, | | gchar *gda_data_model_export_to_string (GdaDataModel *mo
del, GdaDataModelIOFormat format, | |
| const gint *cols,
gint nb_cols, | | const gint *cols,
gint nb_cols, | |
| const gint *rows,
gint nb_rows, GdaSet *options); | | const gint *rows,
gint nb_rows, GdaSet *options); | |
| gboolean gda_data_model_export_to_file (GdaDataModel *mo
del, GdaDataModelIOFormat format, | | gboolean gda_data_model_export_to_file (GdaDataModel *mo
del, GdaDataModelIOFormat format, | |
| const gchar *file
, | | const gchar *file
, | |
| const gint *cols,
gint nb_cols, | | const gint *cols,
gint nb_cols, | |
| const gint *rows,
gint nb_rows, | | const gint *rows,
gint nb_rows, | |
| GdaSet *options,
GError **error); | | GdaSet *options,
GError **error); | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 67 lines changed or added | |
|
| gda-data-proxy.h | | gda-data-proxy.h | |
|
| /* gda-data-proxy.h | | /* | |
| * | | * Copyright (C) 2005 - 2011 Vivien Malerba | |
| * Copyright (C) 2005 - 2009 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 69 | |
| void (* row_delete_changed) (GdaDataProxy *proxy,
gint row, gboolean to_be_deleted); | | void (* row_delete_changed) (GdaDataProxy *proxy,
gint row, gboolean to_be_deleted); | |
| | | | |
| void (* sample_size_changed) (GdaDataProxy *proxy,
gint sample_size); | | void (* sample_size_changed) (GdaDataProxy *proxy,
gint sample_size); | |
| void (* sample_changed) (GdaDataProxy *proxy,
gint sample_start, gint sample_end); | | void (* sample_changed) (GdaDataProxy *proxy,
gint sample_start, gint sample_end); | |
| | | | |
| GError *(* validate_row_changes) (GdaDataProxy *proxy,
gint row, gint proxied_row); | | GError *(* validate_row_changes) (GdaDataProxy *proxy,
gint row, gint proxied_row); | |
| void (* row_changes_applied) (GdaDataProxy *proxy,
gint row, gint proxied_row); | | void (* row_changes_applied) (GdaDataProxy *proxy,
gint row, gint proxied_row); | |
| | | | |
| void (* filter_changed) (GdaDataProxy *proxy); | | void (* filter_changed) (GdaDataProxy *proxy); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-proxy | |
| | | * @short_description: Proxy to hold modifications for any #GdaDataModel, p | |
| | | roviding the #GdaDataModel interface itself | |
| | | * @title: GdaDataProxy | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel | |
| | | * | |
| | | * This object stores modifications to be made to a #GdaDataModel object wh | |
| | | ich is proxied until the modifications are actually | |
| | | * written to the #GdaDataModel, it can also filter the proxied data model | |
| | | to show only a subset (a defined number of continuous | |
| | | * rows or by a filter to apply). | |
| | | * | |
| | | * Specifically, for a proxied data model having <varname>nb_cols</varname | |
| | | > columns and <varname>nb_rows</varname> rows, | |
| | | * the #GdaDataProxy object has the following attributes: | |
| | | * <itemizedlist> | |
| | | * <listitem> | |
| | | * <para><varname>2 * nb_cols</varname> columns: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>the first (>= 0) <varname>nb_cols</varname> col | |
| | | umns are the current values stored in the | |
| | | * proxy (which correspond to the values of the proxied data mode | |
| | | l if the considered row has not been | |
| | | * changed). The associated values are writable.</para></listitem | |
| | | > | |
| | | * <listitem><para>the last <varname>nb_cols</varname> columns are th | |
| | | e values stored in the proxied data model, | |
| | | * at column <varname>col - nb_cols</varname></para></listitem> | |
| | | * </itemizedlist> | |
| | | * </para> | |
| | | * </listitem> | |
| | | * <listitem><para>a variable number of rows depending on the following | |
| | | attributes: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>if the proxy is configured to have an empty row as | |
| | | the first row</para></listitem> | |
| | | * <listitem><para>if the proxy only displays parts of the proxied da | |
| | | ta model</para></listitem> | |
| | | * <listitem><para>if new rows have been added to the proxy</para></l | |
| | | istitem> | |
| | | * </itemizedlist> | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * This situation is illustrated in the following schema, where there is a | |
| | | direct mapping between the proxy's | |
| | | * rows and the proxied data model's rows: | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="data_proxy1.png" format="PNG" contentwidth="170 | |
| | | mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaDataProxy's values mapping regarding the proxied data mo | |
| | | del</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | * | |
| | | * Note that unless explicitly mentioned, the columns are read-only. | |
| | | * | |
| | | * The following figures illustrate row mappings between the data proxy an | |
| | | d the proxied data model in | |
| | | * several situations (which can be combined, but are shown alone for simp | |
| | | licity): | |
| | | * <itemizedlist> | |
| | | * <listitem><para>situation where rows 1 and 5 have been marked as dele | |
| | | ted from the data proxy, using | |
| | | * <link linkend="gda-data-proxy-delete">gda_data_proxy_delete()</link> | |
| | | method, the data | |
| | | * proxy has 2 rows less than the proxied data model: | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="data_proxy2.png" format="PNG" contentwidth=" | |
| | | 100mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaDataProxy with 2 rows marked as deleted</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | * </para></listitem> | |
| | | * <listitem><para>situation where the data proxy only shows a sample of | |
| | | the proxied data model | |
| | | * at any given time, using the | |
| | | * <link linkend="gda-data-proxy-set-sample-size">gda_data_proxy_set_sa | |
| | | mple_size()</link> method | |
| | | * (the sample here is 4 rows wide, and starts at row 3): | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="data_proxy3.png" format="PNG" contentwidth=" | |
| | | 100mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaDataProxy with a sample size of 4</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | * </para></listitem> | |
| | | * <listitem><para>situation where the data proxy shows a row of NULL va | |
| | | lues, using the | |
| | | * <link linkend="GdaDataproxy-prepend-null-entry">"prepend-null-entry" | |
| | | </link> property: | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="data_proxy4.png" format="PNG" contentwidth=" | |
| | | 100mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaDataProxy with an extra row of NULL values</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | * </para></listitem> | |
| | | * <listitem><para>situation where a row has been added to the data prox | |
| | | y, using for example the | |
| | | * <link linkend="gda-data-model-append-row">gda_data_model_append_row( | |
| | | )</link> method: | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="data_proxy5.png" format="PNG" contentwidth=" | |
| | | 100mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaDataProxy where a row has been added</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * The #GdaDataProxy objects are thread safe, which means any proxy object | |
| | | can be used from | |
| | | * any thread at the same time as they implement their own locking mechani | |
| | | sms. | |
| | | */ | |
| | | | |
| GType gda_data_proxy_get_type (void) G_GNUC_CON
ST; | | GType gda_data_proxy_get_type (void) G_GNUC_CON
ST; | |
| GObject *gda_data_proxy_new (GdaDataModel *mo
del); | | GObject *gda_data_proxy_new (GdaDataModel *mo
del); | |
| | | | |
| GdaDataModel *gda_data_proxy_get_proxied_model (GdaDataProxy *pr
oxy); | | GdaDataModel *gda_data_proxy_get_proxied_model (GdaDataProxy *pr
oxy); | |
| gint gda_data_proxy_get_proxied_model_n_cols (GdaDataProxy *pr
oxy); | | gint gda_data_proxy_get_proxied_model_n_cols (GdaDataProxy *pr
oxy); | |
| gint gda_data_proxy_get_proxied_model_n_rows (GdaDataProxy *pr
oxy); | | gint gda_data_proxy_get_proxied_model_n_rows (GdaDataProxy *pr
oxy); | |
| gboolean gda_data_proxy_is_read_only (GdaDataProxy *pr
oxy); | | gboolean gda_data_proxy_is_read_only (GdaDataProxy *pr
oxy); | |
| GSList *gda_data_proxy_get_values (GdaDataProxy *pr
oxy, gint proxy_row, | | GSList *gda_data_proxy_get_values (GdaDataProxy *pr
oxy, gint proxy_row, | |
| gint *cols_index,
gint n_cols); | | gint *cols_index,
gint n_cols); | |
| GdaValueAttribute gda_data_proxy_get_value_attributes (GdaDataProxy *pr
oxy, gint proxy_row, gint col); | | GdaValueAttribute gda_data_proxy_get_value_attributes (GdaDataProxy *pr
oxy, gint proxy_row, gint col); | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 136 lines changed or added | |
|
| gda-data-select-priv.h | | gda-data-select-priv.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 2008 The GNOME Foundation. | | * Copyright (C) 2008 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| #define __GDA_DATA_SELECT_PRIV_H__ | | #define __GDA_DATA_SELECT_PRIV_H__ | |
| | | | |
| #include <glib-object.h> | | #include <glib-object.h> | |
| #include <libgda/gda-row.h> | | #include <libgda/gda-row.h> | |
| #include <libgda/providers-support/gda-pstmt.h> | | #include <libgda/providers-support/gda-pstmt.h> | |
| #include <sql-parser/gda-sql-statement.h> | | #include <sql-parser/gda-sql-statement.h> | |
| #include <libgda/gda-data-select.h> | | #include <libgda/gda-data-select.h> | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-select-priv | |
| | | * @short_description: Base class for all the data models returned by DBMS | |
| | | providers when a SELECT statement is executed | |
| | | * @title: Subclassing GdaDataSelect | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel and #GdaDataSelect | |
| | | * | |
| | | * All database providers should subclass this class when returning a data | |
| | | model after the execution of a SELECT | |
| | | * statement. Specifically it has the following features: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>Manages its list of <link linkend="GdaColumn">GdaColu | |
| | | mn</link> using the list exported by the prepared statement object (<link l | |
| | | inkend="GdaPStmt">GdaPStmt</link>)</para></listitem> | |
| | | * <listitem><para>Allows random or cursor based access</para></listitem | |
| | | > | |
| | | * <listitem><para>Allows for efficient memory usage allowing the subcla | |
| | | ss to finely tune its memory usage</para></listitem> | |
| | | * <listitem><para>Provides a generic mechanism for writable data models | |
| | | </para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * See the <link linkend="libgda-provider-recordset">Virtual methods for r | |
| | | ecordsets</link> section for more information | |
| | | * about how to implement the virtual methods of the subclassed object. | |
| | | * | |
| | | * This section documents the methods available for the database provider' | |
| | | s implementations. | |
| | | */ | |
| | | | |
| GType gda_data_select_get_type (void) G_GNUC_C
ONST; | | GType gda_data_select_get_type (void) G_GNUC_C
ONST; | |
| | | | |
| /* API reserved to provider's implementations */ | | /* API reserved to provider's implementations */ | |
| void gda_data_select_take_row (GdaDataSelect
*model, GdaRow *row, gint rownum); | | void gda_data_select_take_row (GdaDataSelect
*model, GdaRow *row, gint rownum); | |
| GdaRow *gda_data_select_get_stored_row (GdaDataSelect
*model, gint rownum); | | GdaRow *gda_data_select_get_stored_row (GdaDataSelect
*model, gint rownum); | |
| GdaConnection *gda_data_select_get_connection (GdaDataSelect
*model); | | GdaConnection *gda_data_select_get_connection (GdaDataSelect
*model); | |
| void gda_data_select_set_columns (GdaDataSelect
*model, GSList *columns); | | void gda_data_select_set_columns (GdaDataSelect
*model, GSList *columns); | |
| | | | |
|
| | | void gda_data_select_add_exception (GdaDataSelect | |
| | | *model, GError *error); | |
| | | | |
| /* internal API */ | | /* internal API */ | |
| void _gda_data_select_share_private_data (GdaDataSelect *master,
GdaDataSelect *slave); | | void _gda_data_select_share_private_data (GdaDataSelect *master,
GdaDataSelect *slave); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 36 lines changed or added | |
|
| gda-data-select.h | | gda-data-select.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 2008 - 2009 The GNOME Foundation. | | * Copyright (C) 2008 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| | | | |
| struct _GdaDataSelect { | | struct _GdaDataSelect { | |
| GObject object; | | GObject object; | |
| GdaDataSelectPrivate *priv; | | GdaDataSelectPrivate *priv; | |
| | | | |
| /* read only information */ | | /* read only information */ | |
| GdaPStmt *prep_stmt; /* use the "prepared-stmt" property to
set this */ | | GdaPStmt *prep_stmt; /* use the "prepared-stmt" property to
set this */ | |
| gint nb_stored_rows; /* number of GdaRow objects curren
tly stored */ | | gint nb_stored_rows; /* number of GdaRow objects curren
tly stored */ | |
| gint advertized_nrows; /* set when the number of rows b
ecomes known, -1 untill then */ | | gint advertized_nrows; /* set when the number of rows b
ecomes known, -1 untill then */ | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| gpointer _gda_reserved3; | | gpointer _gda_reserved3; | |
| gpointer _gda_reserved4; | | gpointer _gda_reserved4; | |
| }; | | }; | |
| | | | |
| /* | | /* | |
| * Depending on model access flags, the implementations are: | | * Depending on model access flags, the implementations are: | |
| * | | * | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 98 | |
| /* GDA_DATA_MODEL_ACCESS_RANDOM */ | | /* GDA_DATA_MODEL_ACCESS_RANDOM */ | |
| gint (*fetch_nb_rows) (GdaDataSelect *model); | | gint (*fetch_nb_rows) (GdaDataSelect *model); | |
| gboolean (*fetch_random) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | | gboolean (*fetch_random) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | |
| gboolean (*store_all) (GdaDataSelect *model, GError **er
ror); | | gboolean (*store_all) (GdaDataSelect *model, GError **er
ror); | |
| | | | |
| /* GDA_STATEMENT_MODEL_CURSOR_* */ | | /* GDA_STATEMENT_MODEL_CURSOR_* */ | |
| gboolean (*fetch_next) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | | gboolean (*fetch_next) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | |
| gboolean (*fetch_prev) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | | gboolean (*fetch_prev) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | |
| gboolean (*fetch_at) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | | gboolean (*fetch_at) (GdaDataSelect *model, GdaRow **pr
ow, gint rownum, GError **error); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-data-select | |
| | | * @short_description: Base class for data models returned by the execution | |
| | | of a SELECT statement | |
| | | * @title: GdaDataSelect | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaDataModel and the <link linkend="data-select">Advanced Gd | |
| | | aDataSelect usage</link> section. | |
| | | * | |
| | | * This data model implements the <link linkend="GdaDataModel">GdaDataModel | |
| | | </link> interface and is the required | |
| | | * base object when database providers implement a data model returned whe | |
| | | n a SELECT statement has been executed. | |
| | | * As the <link linkend="GdaDataModel">GdaDataModel</link> interface is im | |
| | | plemented, consult the API | |
| | | * to access and modify the data held in a <link linkend="GdaDataSelect">G | |
| | | daDataSelect</link> object. | |
| | | * | |
| | | * The default behaviour however is to disallow modifications, and this se | |
| | | ction documents how to characterize | |
| | | * a <link linkend="GdaDataSelect">GdaDataSelect</link> to allow modificat | |
| | | ions. Once this is done, any modification | |
| | | * done to the data model will be propagated to the modified table in the | |
| | | database using INSERT, UPDATE or DELETE | |
| | | * statements. | |
| | | * | |
| | | * After any modification, it is still possible to read values from the da | |
| | | ta model (even values for rows which have | |
| | | * been modified or inserted). The data model might then execute some SELE | |
| | | CT statement to fetch some actualized values. | |
| | | * Note: there is a corner case where a modification made to a row would m | |
| | | ake the row not selected at first in the data model | |
| | | * (for example is the original SELECT statement included a clause <![CDAT | |
| | | A["WHERE id < 100"]]> and the modification sets the | |
| | | * <![CDATA["id"]]> value to 110), then the row will still be in the data | |
| | | model even though it would not be if the SELECT statement | |
| | | * which execution created the data model in the first place was re-run. T | |
| | | his is illustrated in the schema below: | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="writable_data_model.png" format="PNG" contentwi | |
| | | dth="100mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaDataSelect data model's contents after some modification | |
| | | s</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | */ | |
| | | | |
| GType gda_data_select_get_type (void) G_GNUC_C
ONST; | | GType gda_data_select_get_type (void) G_GNUC_C
ONST; | |
| | | | |
| gboolean gda_data_select_set_row_selection_condition (GdaDataSele
ct *model, GdaSqlExpr *expr, GError **error); | | gboolean gda_data_select_set_row_selection_condition (GdaDataSele
ct *model, GdaSqlExpr *expr, GError **error); | |
| gboolean gda_data_select_set_row_selection_condition_sql (GdaDataSele
ct *model, const gchar *sql_where, GError **error); | | gboolean gda_data_select_set_row_selection_condition_sql (GdaDataSele
ct *model, const gchar *sql_where, GError **error); | |
| gboolean gda_data_select_compute_row_selection_condition (GdaDataSele
ct *model, GError **error); | | gboolean gda_data_select_compute_row_selection_condition (GdaDataSele
ct *model, GError **error); | |
| | | | |
| gboolean gda_data_select_set_modification_statement (GdaDataSele
ct *model, GdaStatement *mod_stmt, GError **error); | | gboolean gda_data_select_set_modification_statement (GdaDataSele
ct *model, GdaStatement *mod_stmt, GError **error); | |
| gboolean gda_data_select_set_modification_statement_sql (GdaDataSele
ct *model, const gchar *sql, GError **error); | | gboolean gda_data_select_set_modification_statement_sql (GdaDataSele
ct *model, const gchar *sql, GError **error); | |
| gboolean gda_data_select_compute_modification_statements (GdaDataSele
ct *model, GError **error); | | gboolean gda_data_select_compute_modification_statements (GdaDataSele
ct *model, GError **error); | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 54 lines changed or added | |
|
| gda-meta-store.h | | gda-meta-store.h | |
|
| /* gda-meta-store.h | | /* | |
| | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
|
| * Copyright (C) 2008 - 2011 Vivien Malerba | | * AUTHORS: | |
| | | * Vivien Malerba <malerba@gnome-db.org> | |
| | | * Daniel Espinosa <esodan@gmail.com> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 75 | |
| } GdaMetaStoreChangeType; | | } GdaMetaStoreChangeType; | |
| | | | |
| typedef struct { | | typedef struct { | |
| /* change general information */ | | /* change general information */ | |
| GdaMetaStoreChangeType c_type; | | GdaMetaStoreChangeType c_type; | |
| gchar *table_name; | | gchar *table_name; | |
| GHashTable *keys; /* key = ('+' or '-') and a column pos
ition in @table (string) starting at 0, | | GHashTable *keys; /* key = ('+' or '-') and a column pos
ition in @table (string) starting at 0, | |
| * value = a GValue pointer */ | | * value = a GValue pointer */ | |
| } GdaMetaStoreChange; | | } GdaMetaStoreChange; | |
| | | | |
|
| /* suggestion */ | | /** | |
| | | * GdaMetaContext: | |
| | | * @table_name: the name of the table <emphasis>in the GdaMetaStore's inter | |
| | | nal database</emphasis> | |
| | | * @size: the size of the @column_names and @column_values arrays | |
| | | * @column_names: an array of column names (columns of the @table_name tabl | |
| | | e) | |
| | | * @column_values: an array of values, one for each column named in @column | |
| | | _names | |
| | | * | |
| | | * The <structname>GdaMetaContext</structname> represents a meta data modif | |
| | | ication | |
| | | * context: the <emphasis>how</emphasis> when used with gda_meta_store_modi | |
| | | fy_with_context(), | |
| | | * and the <emphasis>what</emphasis> when used with gda_connection_update_m | |
| | | eta_store(). | |
| | | */ | |
| typedef struct { | | typedef struct { | |
| gchar *table_name; | | gchar *table_name; | |
| gint size; | | gint size; | |
| gchar **column_names; | | gchar **column_names; | |
| GValue **column_values; | | GValue **column_values; | |
| } GdaMetaContext; | | } GdaMetaContext; | |
| | | | |
| /* struct for the object's data */ | | /* struct for the object's data */ | |
| struct _GdaMetaStore | | struct _GdaMetaStore | |
| { | | { | |
| | | | |
| skipping to change at line 106 | | skipping to change at line 119 | |
| void (*meta_changed) (GdaMetaStore *store, GSList *changes); | | void (*meta_changed) (GdaMetaStore *store, GSList *changes); | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-meta-store | |
| | | * @short_description: Dictionary object | |
| | | * @title: GdaMetaStore | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaMetaStruct | |
| | | * | |
| | | * Previous versions of &LIBGDA; relied on an XML based file to store dicti | |
| | | onary information, such as | |
| | | * the database's schema (tables, views, etc) and various other information | |
| | | . The problems were that it was | |
| | | * difficult for an application to integrate its own data into the dictiona | |
| | | ry and that there were some | |
| | | * performances problems as the XML file needed to be parsed (and converted | |
| | | into its own in-memory structure) | |
| | | * before any data could be read out of it. | |
| | | * | |
| | | * The new dictionary now relies on a database structure to store its data | |
| | | (see the | |
| | | * <link linkend="information_schema">database schema</link> section for a | |
| | | detailed description). The actual database can be a | |
| | | * single file (using an SQLite database), an entirely in memory database ( | |
| | | also using an SQLite database), or | |
| | | * a more conventional backend such as a PostgreSQL database for a shared d | |
| | | ictionary on a server. | |
| | | * | |
| | | * The #GdaMetaStore object is thread safe. | |
| | | */ | |
| | | | |
| GType gda_meta_store_get_type (void) G_GNUC_CON
ST; | | GType gda_meta_store_get_type (void) G_GNUC_CON
ST; | |
| GdaMetaStore *gda_meta_store_new_with_file (const gchar *fil
e_name); | | GdaMetaStore *gda_meta_store_new_with_file (const gchar *fil
e_name); | |
| GdaMetaStore *gda_meta_store_new (const gchar *cnc
_string); | | GdaMetaStore *gda_meta_store_new (const gchar *cnc
_string); | |
| gint gda_meta_store_get_version (GdaMetaStore *st
ore); | | gint gda_meta_store_get_version (GdaMetaStore *st
ore); | |
| | | | |
| GdaConnection *gda_meta_store_get_internal_connection (GdaMetaStore *st
ore); | | GdaConnection *gda_meta_store_get_internal_connection (GdaMetaStore *st
ore); | |
| gchar *gda_meta_store_sql_identifier_quote (const gchar *id,
GdaConnection *cnc); | | gchar *gda_meta_store_sql_identifier_quote (const gchar *id,
GdaConnection *cnc); | |
| GdaDataModel *gda_meta_store_extract (GdaMetaStore *st
ore, const gchar *select_sql, GError **error, ...); | | GdaDataModel *gda_meta_store_extract (GdaMetaStore *st
ore, const gchar *select_sql, GError **error, ...); | |
|
| | | GdaDataModel *gda_meta_store_extract_v (GdaMetaStore *st | |
| | | ore, const gchar *select_sql, GHashTable *vars, | |
| | | GError **error); | |
| gboolean gda_meta_store_modify (GdaMetaStore *st
ore, const gchar *table_name, | | gboolean gda_meta_store_modify (GdaMetaStore *st
ore, const gchar *table_name, | |
| GdaDataModel *new
_data, const gchar *condition, GError **error, ...); | | GdaDataModel *new
_data, const gchar *condition, GError **error, ...); | |
|
| | | gboolean gda_meta_store_modify_v (GdaMetaStore *st | |
| | | ore, const gchar *table_name, | |
| | | GdaDataModel *new | |
| | | _data, const gchar *condition, | |
| | | gint nvalues, con | |
| | | st gchar **value_names, | |
| | | const GValue **va | |
| | | lues, GError **error); | |
| gboolean gda_meta_store_modify_with_context (GdaMetaStore *st
ore, GdaMetaContext *context, | | gboolean gda_meta_store_modify_with_context (GdaMetaStore *st
ore, GdaMetaContext *context, | |
| GdaDataModel *new
_data, GError **error); | | GdaDataModel *new
_data, GError **error); | |
| GdaDataModel *gda_meta_store_create_modify_data_model (GdaMetaStore *st
ore, const gchar *table_name); | | GdaDataModel *gda_meta_store_create_modify_data_model (GdaMetaStore *st
ore, const gchar *table_name); | |
| | | | |
| void gda_meta_store_set_identifiers_style (GdaMetaStore *st
ore, GdaSqlIdentifierStyle style); | | void gda_meta_store_set_identifiers_style (GdaMetaStore *st
ore, GdaSqlIdentifierStyle style); | |
| void gda_meta_store_set_reserved_keywords_func(GdaMetaStore *s
tore, GdaSqlReservedKeywordsFunc func); | | void gda_meta_store_set_reserved_keywords_func(GdaMetaStore *s
tore, GdaSqlReservedKeywordsFunc func); | |
| | | | |
| gboolean gda_meta_store_get_attribute_value (GdaMetaStore *st
ore, const gchar *att_name, | | gboolean gda_meta_store_get_attribute_value (GdaMetaStore *st
ore, const gchar *att_name, | |
| gchar **att_value
, GError **error); | | gchar **att_value
, GError **error); | |
| gboolean gda_meta_store_set_attribute_value (GdaMetaStore *st
ore, const gchar *att_name, | | gboolean gda_meta_store_set_attribute_value (GdaMetaStore *st
ore, const gchar *att_name, | |
| | | | |
End of changes. 6 change blocks. |
| 3 lines changed or deleted | | 62 lines changed or added | |
|
| gda-meta-struct.h | | gda-meta-struct.h | |
|
| /* gda-meta-struct.h | | /* | |
| * | | | |
| * Copyright (C) 2008 - 2011 Vivien Malerba | | * Copyright (C) 2008 - 2011 Vivien Malerba | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 83 | |
| */ | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_META_DB_UNKNOWN, | | GDA_META_DB_UNKNOWN, | |
| GDA_META_DB_TABLE, | | GDA_META_DB_TABLE, | |
| GDA_META_DB_VIEW | | GDA_META_DB_VIEW | |
| } GdaMetaDbObjectType; | | } GdaMetaDbObjectType; | |
| | | | |
| /* | | /* | |
| * Controls which features are computed about database objects | | * Controls which features are computed about database objects | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaMetaStructFeature: | |
| | | * @GDA_META_STRUCT_FEATURE_NONE: database objects only have their own attr | |
| | | ibutes | |
| | | * @GDA_META_STRUCT_FEATURE_FOREIGN_KEYS: foreign keys are computed for tab | |
| | | les | |
| | | * @GDA_META_STRUCT_FEATURE_VIEW_DEPENDENCIES: for views, the tables they u | |
| | | se are also computed | |
| | | * @GDA_META_STRUCT_FEATURE_ALL: all the features are computed | |
| | | * | |
| | | * Controls which features are computed about database objects. | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_META_STRUCT_FEATURE_NONE = 0, | | GDA_META_STRUCT_FEATURE_NONE = 0, | |
| GDA_META_STRUCT_FEATURE_FOREIGN_KEYS = 1 << 0, | | GDA_META_STRUCT_FEATURE_FOREIGN_KEYS = 1 << 0, | |
| GDA_META_STRUCT_FEATURE_VIEW_DEPENDENCIES = 1 << 1, | | GDA_META_STRUCT_FEATURE_VIEW_DEPENDENCIES = 1 << 1, | |
| | | | |
| GDA_META_STRUCT_FEATURE_ALL = GDA_META_STRUCT_FEATURE_
FOREIGN_KEYS | | | GDA_META_STRUCT_FEATURE_ALL = GDA_META_STRUCT_FEATURE_
FOREIGN_KEYS | | |
| GDA_META_STRUCT_FEATURE_
VIEW_DEPENDENCIES | | GDA_META_STRUCT_FEATURE_
VIEW_DEPENDENCIES | |
| } GdaMetaStructFeature; | | } GdaMetaStructFeature; | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 400 | | skipping to change at line 408 | |
| * GDA_META_TABLE_FOREIGN_KEY_IS_DECLARED | | * GDA_META_TABLE_FOREIGN_KEY_IS_DECLARED | |
| * @fk: a pointer to a #GdaMetaTableForeignKey | | * @fk: a pointer to a #GdaMetaTableForeignKey | |
| * | | * | |
| * Tells if @fk is an actual foreign key defined in the database's schema,
or if it is an indication which | | * Tells if @fk is an actual foreign key defined in the database's schema,
or if it is an indication which | |
| * has been added to help Libgda understand the database schema. | | * has been added to help Libgda understand the database schema. | |
| * | | * | |
| * Returns: %TRUE if @fk has been declared in the database's meta data and
%FALSE if @fk is an actual foreign key defined in the database's schema | | * Returns: %TRUE if @fk has been declared in the database's meta data and
%FALSE if @fk is an actual foreign key defined in the database's schema | |
| */ | | */ | |
| #define GDA_META_TABLE_FOREIGN_KEY_IS_DECLARED(fk) (((GdaMetaTableForeignKe
y*)(fk))->declared) | | #define GDA_META_TABLE_FOREIGN_KEY_IS_DECLARED(fk) (((GdaMetaTableForeignKe
y*)(fk))->declared) | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-meta-struct | |
| | | * @short_description: In memory representation of some database objects | |
| | | * @title: GdaMetaStruct | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaMetaStore | |
| | | * | |
| | | * The #GdaMetaStruct object reads data from a #GdaMetaStore object and | |
| | | * creates an easy to use in memory representation for some database objec | |
| | | ts. For example one can easily | |
| | | * analyze the columns of a table (or its foreign keys) using a #GdaMetaSt | |
| | | ruct. | |
| | | * | |
| | | * When created, the new #GdaMetaStruct object is empty (it does not have | |
| | | any information about any database object). | |
| | | * Information about database objects is computed upon request using the g | |
| | | da_meta_struct_complement() method. Information | |
| | | * about individual database objects is represented by #GdaMetaDbObject st | |
| | | ructures, which can be obtained using | |
| | | * gda_meta_struct_get_db_object() or gda_meta_struct_get_all_db_objects() | |
| | | . | |
| | | * | |
| | | * Note that the #GdaMetaDbObject structures may change or may be removed | |
| | | or replaced by others, so it not | |
| | | * advised to keep pointers to these structures: pointers to these structu | |
| | | res should be considered valid | |
| | | * as long as gda_meta_struct_complement() and other similar functions hav | |
| | | e not been called. | |
| | | * | |
| | | * In the following code sample, one prints the columns names and types of | |
| | | a table: | |
| | | * <programlisting> | |
| | | *GdaMetaStruct *mstruct; | |
| | | *GdaMetaDbObject *dbo; | |
| | | *GValue *catalog, *schema, *name; | |
| | | * | |
| | | * // Define name (and optionnally catalog and schema) | |
| | | *[...] | |
| | | * | |
| | | *mstruct = gda_meta_struct_new (); | |
| | | *gda_meta_struct_complement (mstruct, store, GDA_META_DB_TABLE, catalog, s | |
| | | chema, name, NULL); | |
| | | *dbo = gda_meta_struct_get_db_object (mstruct, catalog, schema, name); | |
| | | *if (!dbo) | |
| | | * g_print ("Table not found\n"); | |
| | | *else { | |
| | | * GSList *list; | |
| | | * for (list = GDA_META_TABLE (dbo)->columns; list; list = list->nex | |
| | | t) { | |
| | | * GdaMetaTableColumn *tcol = GDA_META_TABLE_COLUMN (list->d | |
| | | ata); | |
| | | * g_print ("COLUMN: %s (%s)\n", tcol->column_name, tcol->co | |
| | | lumn_type); | |
| | | * } | |
| | | *} | |
| | | *gda_meta_struct_free (mstruct); | |
| | | * </programlisting> | |
| | | * If now the database object type is not known, one can use the following | |
| | | code: | |
| | | * <programlisting> | |
| | | *GdaMetaStruct *mstruct; | |
| | | *GdaMetaDbObject *dbo; | |
| | | *GValue *catalog, *schema, *name; | |
| | | * | |
| | | * // Define name (and optionnally catalog and schema) | |
| | | *[...] | |
| | | * | |
| | | *mstruct = gda_meta_struct_new (); | |
| | | *gda_meta_struct_complement (mstruct, store, GDA_META_DB_UNKNOWN, catalog, | |
| | | schema, name, NULL); | |
| | | *dbo = gda_meta_struct_get_db_object (mstruct, catalog, schema, name); | |
| | | *if (!dbo) | |
| | | * g_print ("Object not found\n"); | |
| | | *else { | |
| | | * if ((dbo->obj_type == GDA_META_DB_TABLE) || (dbo->obj_type == GDA | |
| | | _META_DB_VIEW)) { | |
| | | * if (dbo->obj_type == GDA_META_DB_TABLE) | |
| | | * g_print ("Is a table\n"); | |
| | | * else if (dbo->obj_type == GDA_META_DB_VIEW) { | |
| | | * g_print ("Is a view, definition is:\n"); | |
| | | * g_print ("%s\n", GDA_META_VIEW (dbo)->view_def); | |
| | | * } | |
| | | * | |
| | | * GSList *list; | |
| | | * for (list = GDA_META_TABLE (dbo)->columns; list; list = l | |
| | | ist->next) { | |
| | | * GdaMetaTableColumn *tcol = GDA_META_TABLE_COLUMN | |
| | | (list->data); | |
| | | * g_print ("COLUMN: %s (%s)\n", tcol->column_name, | |
| | | tcol->column_type); | |
| | | * } | |
| | | * } | |
| | | * else | |
| | | * g_print ("Not a table or a view\n"); | |
| | | *} | |
| | | *gda_meta_struct_free (mstruct); | |
| | | * </programlisting> | |
| | | */ | |
| | | | |
| GType gda_meta_struct_get_type (void) G_GNUC_CONST; | | GType gda_meta_struct_get_type (void) G_GNUC_CONST; | |
| GdaMetaStruct *gda_meta_struct_new (GdaMetaStore *store
, GdaMetaStructFeature features); | | GdaMetaStruct *gda_meta_struct_new (GdaMetaStore *store
, GdaMetaStructFeature features); | |
| GdaMetaDbObject *gda_meta_struct_complement (GdaMetaStruct *mstr
uct, GdaMetaDbObjectType type, | | GdaMetaDbObject *gda_meta_struct_complement (GdaMetaStruct *mstr
uct, GdaMetaDbObjectType type, | |
| const GValue *catalo
g, const GValue *schema, const GValue *name, | | const GValue *catalo
g, const GValue *schema, const GValue *name, | |
| GError **error); | | GError **error); | |
| gboolean gda_meta_struct_complement_schema (GdaMetaStruct *mstr
uct, | | gboolean gda_meta_struct_complement_schema (GdaMetaStruct *mstr
uct, | |
| const GValue *catalo
g, const GValue *schema, GError **error); | | const GValue *catalo
g, const GValue *schema, GError **error); | |
| gboolean gda_meta_struct_complement_default (GdaMetaStruct *mstr
uct, GError **error); | | gboolean gda_meta_struct_complement_default (GdaMetaStruct *mstr
uct, GError **error); | |
| gboolean gda_meta_struct_complement_all (GdaMetaStruct *mstr
uct, GError **error); | | gboolean gda_meta_struct_complement_all (GdaMetaStruct *mstr
uct, GError **error); | |
| gboolean gda_meta_struct_complement_depend (GdaMetaStruct *mstr
uct, GdaMetaDbObject *dbo, | | gboolean gda_meta_struct_complement_depend (GdaMetaStruct *mstr
uct, GdaMetaDbObject *dbo, | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 112 lines changed or added | |
|
| gda-pstmt.h | | gda-pstmt.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 2008 The GNOME Foundation. | | * Copyright (C) 2008 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| * can copy */ | | * can copy */ | |
| | | | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| }; | | }; | |
| | | | |
| struct _GdaPStmtClass { | | struct _GdaPStmtClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-pstmt | |
| | | * @short_description: Base class for prepared statement's | |
| | | * @title: GdaPstmt | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * The #GdaPStmt represents the association between a #GdaStatement stateme | |
| | | nt and a <emphasis>prepared statement</emphasis> | |
| | | * which is database dependent and is an in-memory representation of a stat | |
| | | ement. Using prepared statement has the | |
| | | * following advantages: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>the parsing of the SQL has to be done only once, which | |
| | | improves performances if the statement | |
| | | * has to be executed more than once</para></listitem> | |
| | | * <listitem><para>if a statement has been prepared, then it means it is | |
| | | syntactically correct and has been | |
| | | * <emphasis>understood</emphasis> by the database's API</para></listit | |
| | | em> | |
| | | * <listitem><para>it is possible to use variables in prepared statement | |
| | | which eliminates the risk | |
| | | * of SQL code injection</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * The #GdaPStmt is not intended to be instantiated, but subclassed by data | |
| | | base provider's implementation. | |
| | | * Once created, the database provider's implementation can decide to assoc | |
| | | iate (for future lookup) to | |
| | | * a #GdaStatement object in a connection using gda_connection_add_prepared | |
| | | _statement(). | |
| | | * | |
| | | * The #GdaPStmt object can keep a reference to the #GdaStatement object (w | |
| | | hich can be set and get using | |
| | | * the gda_pstmt_set_gda_statement() and gda_pstmt_get_gda_statement()), ho | |
| | | wever that reference | |
| | | * if a weak one (which means it will be lost if the #GdaStatement object i | |
| | | s destroyed). | |
| | | */ | |
| | | | |
| GType gda_pstmt_get_type (void) G_GNUC_CONST; | | GType gda_pstmt_get_type (void) G_GNUC_CONST; | |
| void gda_pstmt_set_gda_statement (GdaPStmt *pstmt, GdaStatement *s
tmt); | | void gda_pstmt_set_gda_statement (GdaPStmt *pstmt, GdaStatement *s
tmt); | |
| void gda_pstmt_copy_contents (GdaPStmt *src, GdaPStmt *dest); | | void gda_pstmt_copy_contents (GdaPStmt *src, GdaPStmt *dest); | |
| GdaStatement *gda_pstmt_get_gda_statement (GdaPStmt *pstmt); | | GdaStatement *gda_pstmt_get_gda_statement (GdaPStmt *pstmt); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 43 lines changed or added | |
|
| gda-report-engine.h | | gda-report-engine.h | |
|
| /* GDA | | /* | |
| * Copyright (C) 2007 - 2009 The GNOME Foundation. | | * Copyright (C) 2007 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| typedef struct _GdaReportEnginePrivate GdaReportEnginePrivate; | | typedef struct _GdaReportEnginePrivate GdaReportEnginePrivate; | |
| | | | |
| struct _GdaReportEngine { | | struct _GdaReportEngine { | |
| GObject base; | | GObject base; | |
| GdaReportEnginePrivate *priv; | | GdaReportEnginePrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaReportEngineClass { | | struct _GdaReportEngineClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-report-engine | |
| | | * @short_description: Low level report generator based on XML | |
| | | * @title: GdaReportEngine | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * The #GdaReportEngine object generates a report based on a specifications | |
| | | file in any XML format. It browses | |
| | | * through the XML file and replaces the parts of it which are <gda_repo | |
| | | rt...> action nodes. The generated | |
| | | * XML file may then need to be processed using other post-processor tools | |
| | | depending on the XML file format. | |
| | | * | |
| | | * The following "action" tags known are: | |
| | | * <table frame="all"> | |
| | | * <tgroup cols="4" colsep="1" rowsep="1" align="justify"> | |
| | | * <thead> | |
| | | * <row> | |
| | | * <entry>Node name</entry> | |
| | | * <entry>Description</entry> | |
| | | * <entry>Attributes</entry> | |
| | | * <entry><gda_report...> sub nodes</entry> | |
| | | * </row> | |
| | | * </thead> | |
| | | * <tbody> | |
| | | * <row> | |
| | | * <entry><gda_report_section></entry> | |
| | | * <entry> | |
| | | * <para>Starts a section which runs a SELECT query to generate a d | |
| | | ata model (#GdaDataModel). | |
| | | * </para> | |
| | | * <para> | |
| | | * A parameter named "<query_name>|?nrows" is cre | |
| | | ated and is available in any sub node | |
| | | * of the <gda_report_section> node, which contains the num | |
| | | ber of rows in the section's data model. | |
| | | * </para> | |
| | | * </entry> | |
| | | * <entry> | |
| | | * <itemizedlist> | |
| | | * <listitem><para>"query_name": the name of a SELECT #GdaStateme | |
| | | nt to be run; using this attribute | |
| | | * implies that a GdaStatement has | |
| | | * already been created and that the query has been declared | |
| | | to the GdaReportEngine object | |
| | | * with the "query_name "name. | |
| | | * To define a query within the report spec., add a <gda_r | |
| | | eport_query> | |
| | | * sub node instead | |
| | | * </para></listitem> | |
| | | * <listitem><para>"cnc_name": name of the connection to use (the | |
| | | #GdaConnection object has | |
| | | * already been created and has been declared to the GdaRepor | |
| | | tEngine object with the "cnc_name" name) | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * </entry> | |
| | | * <entry> | |
| | | * <itemizedlist> | |
| | | * <listitem><para><gda_report_query> to define the SELECT | |
| | | query which will be run. It is also | |
| | | * possible to use a named query using the "query_name" attribute | |
| | | of the <gda_report_section> node | |
| | | * </para></listitem> | |
| | | * <listitem><para><gda_report_if_empty_section> to define | |
| | | the contents by which the <gda_report_section> | |
| | | * node is replaced if the data model for the section contain | |
| | | s no row. | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * </entry> | |
| | | * </row> | |
| | | * <row> | |
| | | * <entry><gda_report_iter></entry> | |
| | | * <entry> | |
| | | * <para>Repeats is list of children nodes for each row in the sect | |
| | | ion's data model. Note that is that data | |
| | | * model has no row, then the contents of the <gda_report_iter | |
| | | > node will not appear at all in the | |
| | | * final result. | |
| | | * </para> | |
| | | * <para> | |
| | | * For each column of the data model, several parameters are crea | |
| | | ted, named | |
| | | * <query_name>|@<column_name> (such as "custome | |
| | | rs|@@name" for the "name" column) | |
| | | * and <query_name>|#<column_number>, | |
| | | * (such as "customers|##0" for the first column). | |
| | | * Those parameters can be used in any child node (recursively), | |
| | | * and have their value updated for each row of the data model. | |
| | | * For more information about the parameter's syntax, | |
| | | * see the <link linkend="SQL_queries">GDA SQL query syntax</link | |
| | | >. | |
| | | * </para> | |
| | | * </entry> | |
| | | * <entry/> | |
| | | * <entry/> | |
| | | * </row> | |
| | | * <row> | |
| | | * <entry><gda_report_query></entry> | |
| | | * <entry>Specifies the SQL of the SELECT query in a <gda_report | |
| | | _section> section. The SQL should be | |
| | | * in the contents of that node</entry> | |
| | | * <entry><itemizedlist> | |
| | | * <listitem><para>"query_name": name of the query</para></listit | |
| | | em> | |
| | | * <listitem><para>"cnc_name": name of the connection to use (the | |
| | | #GdaConnection object has | |
| | | * already been created and has been declared to the GdaRepor | |
| | | tEngine object with the "cnc_name" name) | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * </entry> | |
| | | * <entry></entry> | |
| | | * </row> | |
| | | * <row> | |
| | | * <entry><gda_report_param_value></entry> | |
| | | * <entry>Replace the node with the value of a parameter. The param | |
| | | eter can either by defined globally | |
| | | * (and declared to the GdaReportEngine), or defined as part of a sec | |
| | | tion</entry> | |
| | | * <entry> | |
| | | * <itemizedlist> | |
| | | * <listitem><para>"param_name" specifies the name of the paramet | |
| | | er</para></listitem> | |
| | | * <listitem><para>"converter" optionnally specifies a conversion | |
| | | to apply to the parameter's | |
| | | * contents (for now only "richtext::docbook" to convert text | |
| | | * in <ulink url="http://txt2tags.org/">rich text format</uli | |
| | | nk> to | |
| | | * the DocBook syntax)</para></listitem> | |
| | | * </itemizedlist> | |
| | | * </entry> | |
| | | * <entry></entry> | |
| | | * </row> | |
| | | * <row> | |
| | | * <entry><gda_report_expr></entry> | |
| | | * <entry>Replace the node with the evaluation of an expression. Th | |
| | | e expression can be any SQLite valid expression, | |
| | | * and can contain any reference to any parameter. For example the no | |
| | | de: | |
| | | * <programlisting><![CDATA[ | |
| | | *<gda_report_expr> | |
| | | *##customers|@col IS NULL | |
| | | *</gda_report_expr>]]></programlisting> | |
| | | * will return a TRUE value if the parameter named "customers| | |
| | | @@col" is not NULL. For more | |
| | | * information about the parameter's syntax, see the <link linkend= | |
| | | "SQL_queries">GDA SQL query syntax</link>. | |
| | | * </entry> | |
| | | * <entry></entry> | |
| | | * <entry></entry> | |
| | | * </row> | |
| | | * <row> | |
| | | * <entry><gda_report_if></entry> | |
| | | * <entry>Creates an "IF THEN ELSE" flow control, based on the eval | |
| | | uation of an expression (in the same way as for the | |
| | | * <gda_report_expr> node). If the expression evaluates as TRUE | |
| | | , then the <gda_report_if> node will | |
| | | * be replaced by the children nodes of the <gda_report_if_true> | |
| | | ; node if it exists, and otherwise by | |
| | | * the children nodes of the <gda_report_if_false> node if it | |
| | | exists.</entry> | |
| | | * <entry>"expr" to define the expression to evaluate</entry> | |
| | | * <entry><gda_report_if_true> and <gda_report_if_false> | |
| | | ;</entry> | |
| | | * </row> | |
| | | * <row> | |
| | | * <entry><gda_report_if_true></entry> | |
| | | * <entry>Defines the contents to use when the expression of a < | |
| | | gda_report_if> is evaluated as TRUE</entry> | |
| | | * <entry></entry> | |
| | | * <entry></entry> | |
| | | * </row> | |
| | | * <row> | |
| | | * <entry><gda_report_if_false></entry> | |
| | | * <entry>Defines the contents to use when the expression of a < | |
| | | gda_report_if> is evaluated as FALSE</entry> | |
| | | * <entry></entry> | |
| | | * <entry></entry> | |
| | | * </row> | |
| | | * </tbody> | |
| | | * </tgroup> | |
| | | * </table> | |
| | | */ | |
| | | | |
| GType gda_report_engine_get_type (void) G_GNUC_CONST; | | GType gda_report_engine_get_type (void) G_GNUC_CONST; | |
| | | | |
| GdaReportEngine *gda_report_engine_new (xmlNodePtr spec_node); | | GdaReportEngine *gda_report_engine_new (xmlNodePtr spec_node); | |
| GdaReportEngine *gda_report_engine_new_from_string (const gchar *spec_strin
g); | | GdaReportEngine *gda_report_engine_new_from_string (const gchar *spec_strin
g); | |
| GdaReportEngine *gda_report_engine_new_from_file (const gchar *spec_file_
name); | | GdaReportEngine *gda_report_engine_new_from_file (const gchar *spec_file_
name); | |
| | | | |
| void gda_report_engine_declare_object (GdaReportEngine *engine
, GObject *object, const gchar *obj_name); | | void gda_report_engine_declare_object (GdaReportEngine *engine
, GObject *object, const gchar *obj_name); | |
| GObject *gda_report_engine_find_declared_object (GdaReportEngine *e
ngine, GType obj_type, const gchar *obj_name); | | GObject *gda_report_engine_find_declared_object (GdaReportEngine *e
ngine, GType obj_type, const gchar *obj_name); | |
| | | | |
| xmlNodePtr gda_report_engine_run_as_node (GdaReportEngine *engine
, GError **error); | | xmlNodePtr gda_report_engine_run_as_node (GdaReportEngine *engine
, GError **error); | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 190 lines changed or added | |
|
| gda-server-operation.h | | gda-server-operation.h | |
| /* | | /* | |
| * Copyright (C) 2006 - 2011 The GNOME Foundation. | | * Copyright (C) 2006 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
|
| | | * Daniel Espinosa <esodan@gmail.com> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 107 | | skipping to change at line 108 | |
| GDA_SERVER_OPERATION_NODE_DATA_MODEL_COLUMN, | | GDA_SERVER_OPERATION_NODE_DATA_MODEL_COLUMN, | |
| GDA_SERVER_OPERATION_NODE_UNKNOWN | | GDA_SERVER_OPERATION_NODE_UNKNOWN | |
| } GdaServerOperationNodeType; | | } GdaServerOperationNodeType; | |
| | | | |
| typedef enum { | | typedef enum { | |
| GDA_SERVER_OPERATION_STATUS_OPTIONAL, | | GDA_SERVER_OPERATION_STATUS_OPTIONAL, | |
| GDA_SERVER_OPERATION_STATUS_REQUIRED, | | GDA_SERVER_OPERATION_STATUS_REQUIRED, | |
| GDA_SERVER_OPERATION_STATUS_UNKNOWN | | GDA_SERVER_OPERATION_STATUS_UNKNOWN | |
| } GdaServerOperationNodeStatus; | | } GdaServerOperationNodeStatus; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-server-operation-sequences | |
| | | * @short_description: Manipulating sequences | |
| | | * @title: GdaServerOperation: sequences | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaServerOperation | |
| | | * | |
| | | * The #GdaServerOperation object can contain sequences of templates. For e | |
| | | xample when creating a table, | |
| | | * one can specify several foreign keys where for each foreign key, one mus | |
| | | t define the column(s) on which the | |
| | | * foreign key applies, the referenced table and the corresponding columns | |
| | | of the referenced table (plus some | |
| | | * additional information). In this case the foreign keys are defined as a | |
| | | sequence of templates (the foreign key | |
| | | * definition): there can be zero or more foreign keys. | |
| | | */ | |
| | | | |
| | | /** | |
| | | * SECTION:gda-server-operation-nodes | |
| | | * @short_description: Getting information about parts (nodes) composing a | |
| | | path | |
| | | * @title: GdaServerOperation: individual nodes | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaServerOperation | |
| | | * | |
| | | * To each part of a path is associated a node (as a #GdaServerOperationNod | |
| | | e structure). For example the | |
| | | * "/TABLE_DEF_P/TABLE_NAME" path has two nodes, one associated to "/TABLE_ | |
| | | DEF_P" and one to | |
| | | * "/TABLE_DEF_P/TABLE_NAME". For more information about the path's format, | |
| | | see the | |
| | | * gda_server_operation_set_value_at()'s documentation. | |
| | | * | |
| | | * This API is designed to get information about all the nodes present in a | |
| | | #GdaServerOperation object (refer to the | |
| | | * gda_server_operation_get_root_nodes() function) and about each node of a | |
| | | path, and allows inspection | |
| | | * of its contents. It is mainly reserved for database provider's implement | |
| | | ations but can have its purpose | |
| | | * outside of this scope. | |
| | | */ | |
| | | | |
| typedef struct _GdaServerOperationNode { | | typedef struct _GdaServerOperationNode { | |
| GdaServerOperationNodeType type; | | GdaServerOperationNodeType type; | |
| GdaServerOperationNodeStatus status; | | GdaServerOperationNodeStatus status; | |
| | | | |
| GdaSet *plist; | | GdaSet *plist; | |
| GdaDataModel *model; | | GdaDataModel *model; | |
| GdaColumn *column; | | GdaColumn *column; | |
| GdaHolder *param; | | GdaHolder *param; | |
| gpointer priv; | | gpointer priv; | |
| } GdaServerOperationNode; | | } GdaServerOperationNode; | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 163 | |
| GdaServerOperationPrivate *priv; | | GdaServerOperationPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaServerOperationClass { | | struct _GdaServerOperationClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /* signals */ | | /* signals */ | |
| void (*seq_item_added) (GdaServerOperation *op,
const gchar *seq_path, gint item_index); | | void (*seq_item_added) (GdaServerOperation *op,
const gchar *seq_path, gint item_index); | |
| void (*seq_item_remove) (GdaServerOperation *op,
const gchar *seq_path, gint item_index); | | void (*seq_item_remove) (GdaServerOperation *op,
const gchar *seq_path, gint item_index); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-server-operation | |
| | | * @short_description: Handles any DDL query in an abstract way | |
| | | * @title: GdaServerOperation | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * This object is basically just a data store: it can store named values, t | |
| | | he values being | |
| | | * organized hierarchically by their name which are similar to a Unix file | |
| | | path. For example a value can be read from its path | |
| | | * using the gda_server_operation_get_value_at() method, or set using the g | |
| | | da_server_operation_set_value_at() method. | |
| | | * | |
| | | * Each #GdaServerOperation contains some structure which is usually define | |
| | | d by a database provider to implement | |
| | | * a specific operation. The structure is composed of the following buildin | |
| | | g blocks: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>Named values (internally represented as a #GdaHolder o | |
| | | bject)</para></listitem> | |
| | | * <listitem><para>Named values in a vector (internally represented as a | |
| | | #GdaSet object)</para></listitem> | |
| | | * <listitem><para>Values in an array (internally represented as a #GdaDa | |
| | | taModel object)</para></listitem> | |
| | | * <listitem><para>Sequences of one or more of the previous blocks. A seq | |
| | | uence can contain any number of | |
| | | * instances of the template block (there may be lower and upper boundari | |
| | | es to the number of instances)</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * <emphasis>Important note:</emphasis> #GdaServerOperation objects are usu | |
| | | ally not created | |
| | | * manually using gda_server_operation_new(), but | |
| | | * using a #GdaServerProvider object with gda_server_provider_create_operat | |
| | | ion(). | |
| | | * See the <link linkend="DDLIntro">global introduction about DDL</link> fo | |
| | | r more information. | |
| | | * Alternatively one can use the <link linkend="libgda-40-Convenience-funct | |
| | | ions">Convenience functions</link> | |
| | | * which internally manipulate #GdaServerOperation objects. | |
| | | */ | |
| | | | |
| GType gda_server_operation_get_type (vo
id) G_GNUC_CONST; | | GType gda_server_operation_get_type (vo
id) G_GNUC_CONST; | |
| GdaServerOperation *gda_server_operation_new (Gd
aServerOperationType op_type, const gchar *xml_file); | | GdaServerOperation *gda_server_operation_new (Gd
aServerOperationType op_type, const gchar *xml_file); | |
| GdaServerOperationType gda_server_operation_get_op_type (Gd
aServerOperation *op); | | GdaServerOperationType gda_server_operation_get_op_type (Gd
aServerOperation *op); | |
| const gchar *gda_server_operation_op_type_to_string (Gd
aServerOperationType type); | | const gchar *gda_server_operation_op_type_to_string (Gd
aServerOperationType type); | |
| GdaServerOperationType gda_server_operation_string_to_op_type (co
nst gchar *str); | | GdaServerOperationType gda_server_operation_string_to_op_type (co
nst gchar *str); | |
| GdaServerOperationNode *gda_server_operation_get_node_info (Gd
aServerOperation *op, const gchar *path_format, ...); | | GdaServerOperationNode *gda_server_operation_get_node_info (Gd
aServerOperation *op, const gchar *path_format, ...); | |
| | | | |
| const GValue *gda_server_operation_get_value_at (Gd
aServerOperation *op, const gchar *path_format, ...); | | const GValue *gda_server_operation_get_value_at (Gd
aServerOperation *op, const gchar *path_format, ...); | |
|
| | | const GValue *gda_server_operation_get_value_at_path (Gd
aServerOperation *op, const gchar *path); | |
| gchar *gda_server_operation_get_sql_identifier_at (Gd
aServerOperation *op, | | gchar *gda_server_operation_get_sql_identifier_at (Gd
aServerOperation *op, | |
| Gda
Connection *cnc, GdaServerProvider *prov, | | Gda
Connection *cnc, GdaServerProvider *prov, | |
| con
st gchar *path_format, ...); | | con
st gchar *path_format, ...); | |
|
| | | gchar *gda_server_operation_get_sql_identifier_at_path | |
| | | (GdaServerOperation *op, | |
| | | | |
| | | GdaConnection *cnc, GdaServerProvider *prov, | |
| | | | |
| | | const gchar *path); | |
| gboolean gda_server_operation_set_value_at (Gd
aServerOperation *op, const gchar *value, | | gboolean gda_server_operation_set_value_at (Gd
aServerOperation *op, const gchar *value, | |
| GEr
ror **error, const gchar *path_format, ...); | | GEr
ror **error, const gchar *path_format, ...); | |
|
| | | gboolean gda_server_operation_set_value_at_path (Gd | |
| | | aServerOperation *op, const gchar *value, | |
| | | con | |
| | | st gchar *path, GError **error); | |
| | | | |
| xmlNodePtr gda_server_operation_save_data_to_xml (Gd
aServerOperation *op, GError **error); | | xmlNodePtr gda_server_operation_save_data_to_xml (Gd
aServerOperation *op, GError **error); | |
| gboolean gda_server_operation_load_data_from_xml (Gd
aServerOperation *op, | | gboolean gda_server_operation_load_data_from_xml (Gd
aServerOperation *op, | |
| xml
NodePtr node, GError **error); | | xml
NodePtr node, GError **error); | |
| | | | |
| gchar** gda_server_operation_get_root_nodes (Gd
aServerOperation *op); | | gchar** gda_server_operation_get_root_nodes (Gd
aServerOperation *op); | |
| GdaServerOperationNodeType gda_server_operation_get_node_type (Gd
aServerOperation *op, const gchar *path, | | GdaServerOperationNodeType gda_server_operation_get_node_type (Gd
aServerOperation *op, const gchar *path, | |
| Gda
ServerOperationNodeStatus *status); | | Gda
ServerOperationNodeStatus *status); | |
| gchar *gda_server_operation_get_node_parent (Gd
aServerOperation *op, const gchar *path); | | gchar *gda_server_operation_get_node_parent (Gd
aServerOperation *op, const gchar *path); | |
| gchar *gda_server_operation_get_node_path_portion (Gd
aServerOperation *op, const gchar *path); | | gchar *gda_server_operation_get_node_path_portion (Gd
aServerOperation *op, const gchar *path); | |
| | | | |
End of changes. 7 change blocks. |
| 0 lines changed or deleted | | 99 lines changed or added | |
|
| gda-server-provider.h | | gda-server-provider.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 1998 - 2009 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * Bas Driessen <bas.driessen@xobas.com> | | * Bas Driessen <bas.driessen@xobas.com> | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| | | | |
| skipping to change at line 69 | | skipping to change at line 69 | |
| GDA_SERVER_PROVIDER_SERVER_VERSION_ERROR, | | GDA_SERVER_PROVIDER_SERVER_VERSION_ERROR, | |
| GDA_SERVER_PROVIDER_DATA_ERROR, | | GDA_SERVER_PROVIDER_DATA_ERROR, | |
| GDA_SERVER_PROVIDER_DEFAULT_VALUE_HANDLING_ERROR | | GDA_SERVER_PROVIDER_DEFAULT_VALUE_HANDLING_ERROR | |
| } GdaServerProviderError; | | } GdaServerProviderError; | |
| | | | |
| struct _GdaServerProvider { | | struct _GdaServerProvider { | |
| GObject object; | | GObject object; | |
| GdaServerProviderPrivate *priv; | | GdaServerProviderPrivate *priv; | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * GdaServerProviderMeta: | |
| | | * @_info: | |
| | | * @_btypes: | |
| | | * @_udt: | |
| | | * @udt: | |
| | | * @_udt_cols: | |
| | | * @udt_cols: | |
| | | * @_enums: | |
| | | * @enums: | |
| | | * @_domains: | |
| | | * @domains: | |
| | | * @_constraints_dom: | |
| | | * @constraints_dom: | |
| | | * @_el_types: | |
| | | * @el_types: | |
| | | * @_collations: | |
| | | * @collations: | |
| | | * @_character_sets: | |
| | | * @character_sets: | |
| | | * @_schemata: | |
| | | * @schemata: | |
| | | * @_tables_views: | |
| | | * @tables_views: | |
| | | * @_columns: | |
| | | * @columns: | |
| | | * @_view_cols: | |
| | | * @view_cols: | |
| | | * @_constraints_tab: | |
| | | * @constraints_tab: | |
| | | * @_constraints_ref: | |
| | | * @constraints_ref: | |
| | | * @_key_columns: | |
| | | * @key_columns: | |
| | | * @_check_columns: | |
| | | * @check_columns: | |
| | | * @_triggers: | |
| | | * @triggers: | |
| | | * @_routines: | |
| | | * @routines: | |
| | | * @_routine_col: | |
| | | * @routine_col: | |
| | | * @_routine_par: | |
| | | * @routine_par: | |
| | | * @_indexes_tab: | |
| | | * @indexes_tab: | |
| | | * @_index_cols: | |
| | | * @index_cols: | |
| | | * | |
| | | * These methods must be implemented by providers to update a connection's | |
| | | associated metadata (in a | |
| | | * #GdaMetaStore object), see the <link linkend="prov-metadata">Virtual met | |
| | | hods for providers/Methods - metadata</link> | |
| | | * for more information. | |
| | | */ | |
| typedef struct { | | typedef struct { | |
| /* _information_schema_catalog_name */ | | /* _information_schema_catalog_name */ | |
| gboolean (*_info) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | | gboolean (*_info) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | |
| | | | |
| /* _builtin_data_types */ | | /* _builtin_data_types */ | |
| gboolean (*_btypes) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | | gboolean (*_btypes) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | |
| | | | |
| /* _udt */ | | /* _udt */ | |
| gboolean (*_udt) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | | gboolean (*_udt) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | |
| gboolean (*udt) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **, | | gboolean (*udt) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **, | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 245 | |
| gboolean (*_indexes_tab) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | | gboolean (*_indexes_tab) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | |
| gboolean (*indexes_tab) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **, | | gboolean (*indexes_tab) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **, | |
| const GValue *table_catalog, const GVa
lue *table_schema, const GValue *table_name, | | const GValue *table_catalog, const GVa
lue *table_schema, const GValue *table_name, | |
| const GValue *index_name_n); | | const GValue *index_name_n); | |
| | | | |
| /* _index_column_usage */ | | /* _index_column_usage */ | |
| gboolean (*_index_cols) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | | gboolean (*_index_cols) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **); | |
| gboolean (*index_cols) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **, | | gboolean (*index_cols) (GdaServerProvider *, GdaConnection *,
GdaMetaStore *, GdaMetaContext *, GError **, | |
| const GValue *table_catalog, const GVa
lue *table_schema, const GValue *table_name, const GValue *index_name); | | const GValue *table_catalog, const GVa
lue *table_schema, const GValue *table_name, const GValue *index_name); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved5) (void); | | void (*_gda_reserved5) (void); | |
| void (*_gda_reserved6) (void); | | void (*_gda_reserved6) (void); | |
| void (*_gda_reserved7) (void); | | void (*_gda_reserved7) (void); | |
| void (*_gda_reserved8) (void); | | void (*_gda_reserved8) (void); | |
| void (*_gda_reserved9) (void); | | void (*_gda_reserved9) (void); | |
| void (*_gda_reserved10) (void); | | void (*_gda_reserved10) (void); | |
| void (*_gda_reserved11) (void); | | void (*_gda_reserved11) (void); | |
| void (*_gda_reserved12) (void); | | void (*_gda_reserved12) (void); | |
| void (*_gda_reserved13) (void); | | void (*_gda_reserved13) (void); | |
| | | | |
| skipping to change at line 221 | | skipping to change at line 275 | |
| | | | |
| gboolean (*xa_end) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | | gboolean (*xa_end) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | |
| gboolean (*xa_prepare) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | | gboolean (*xa_prepare) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | |
| | | | |
| gboolean (*xa_commit) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | | gboolean (*xa_commit) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | |
| gboolean (*xa_rollback) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | | gboolean (*xa_rollback) (GdaServerProvider *, GdaConnection *, const
GdaXaTransactionId *, GError **); | |
| | | | |
| GList *(*xa_recover) (GdaServerProvider *, GdaConnection *, GErro
r **); | | GList *(*xa_recover) (GdaServerProvider *, GdaConnection *, GErro
r **); | |
| } GdaServerProviderXa; | | } GdaServerProviderXa; | |
| | | | |
|
| | | /** | |
| | | * GdaServerProviderAsyncCallback: | |
| | | * @provider: | |
| | | * @cnc: | |
| | | * @task_id: | |
| | | * @result_status: | |
| | | * @error: | |
| | | * @data: | |
| | | * | |
| | | * Function to be called by Libgda when the associated asynchronous method | |
| | | invoked finishes. | |
| | | */ | |
| typedef void (*GdaServerProviderAsyncCallback) (GdaServerProvider *provider
, GdaConnection *cnc, guint task_id, | | typedef void (*GdaServerProviderAsyncCallback) (GdaServerProvider *provider
, GdaConnection *cnc, guint task_id, | |
| gboolean result_status, cons
t GError *error, gpointer data); | | gboolean result_status, cons
t GError *error, gpointer data); | |
|
| | | /** | |
| | | * GdaServerProviderExecCallback: | |
| | | * @provider: | |
| | | * @cnc: | |
| | | * @task_id: | |
| | | * @result_obj: | |
| | | * @error: | |
| | | * @data: | |
| | | * | |
| | | * Function to be called by Libgda when the associated asynchronous method | |
| | | invoked finishes | |
| | | */ | |
| typedef void (*GdaServerProviderExecCallback) (GdaServerProvider *provider,
GdaConnection *cnc, guint task_id, | | typedef void (*GdaServerProviderExecCallback) (GdaServerProvider *provider,
GdaConnection *cnc, guint task_id, | |
| GObject *result_obj, const GE
rror *error, gpointer data); | | GObject *result_obj, const GE
rror *error, gpointer data); | |
| | | | |
| #define GDA_SERVER_PROVIDER_UNDEFINED_LIMITING_THREAD ((gpointer)0x1) | | #define GDA_SERVER_PROVIDER_UNDEFINED_LIMITING_THREAD ((gpointer)0x1) | |
| struct _GdaServerProviderClass { | | struct _GdaServerProviderClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /* provider information */ | | /* provider information */ | |
| GThread * limiting_thread; /* if not NULL, then usin
g the provider will be limited to this thread */ | | GThread * limiting_thread; /* if not NULL, then usin
g the provider will be limited to this thread */ | |
| const gchar *(* get_name) (GdaServerProvider
*provider); | | const gchar *(* get_name) (GdaServerProvider
*provider); | |
| | | | |
| skipping to change at line 325 | | skipping to change at line 401 | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| void (*_gda_reserved5) (void); | | void (*_gda_reserved5) (void); | |
| void (*_gda_reserved6) (void); | | void (*_gda_reserved6) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-server-provider | |
| | | * @short_description: Base class for all the DBMS providers | |
| | | * @title: GdaServerProvider | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaConnection | |
| | | * | |
| | | * The #GdaServerProvider class is a virtual class which all the DBMS provi | |
| | | ders | |
| | | * must inherit, and implement its virtual methods. | |
| | | * | |
| | | * See the <link linkend="libgda-provider-class">Virtual methods for provid | |
| | | ers</link> section for more information | |
| | | * about how to implement the virtual methods. | |
| | | */ | |
| | | | |
| GType gda_server_provider_get_type (void) G_GNUC_CONST; | | GType gda_server_provider_get_type (void) G_GNUC_CONST; | |
| | | | |
| /* provider information */ | | /* provider information */ | |
| const gchar *gda_server_provider_get_name (GdaServerPro
vider *provider); | | const gchar *gda_server_provider_get_name (GdaServerPro
vider *provider); | |
| const gchar *gda_server_provider_get_version (GdaServerPro
vider *provider); | | const gchar *gda_server_provider_get_version (GdaServerPro
vider *provider); | |
| const gchar *gda_server_provider_get_server_version (GdaServerPro
vider *provider, GdaConnection *cnc); | | const gchar *gda_server_provider_get_server_version (GdaServerPro
vider *provider, GdaConnection *cnc); | |
| gboolean gda_server_provider_supports_feature (GdaServerPro
vider *provider, GdaConnection *cnc, | | gboolean gda_server_provider_supports_feature (GdaServerPro
vider *provider, GdaConnection *cnc, | |
| GdaConnection
Feature feature); | | GdaConnection
Feature feature); | |
| | | | |
| /* types and values manipulation */ | | /* types and values manipulation */ | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 98 lines changed or added | |
|
| gda-sql-builder.h | | gda-sql-builder.h | |
|
| /* gda-sql-builder.h | | /* | |
| * | | * Copyright (C) 2009 - 2011 Vivien Malerba | |
| * Copyright (C) 2009 - 2010 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 69 | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
| typedef guint GdaSqlBuilderId; | | typedef guint GdaSqlBuilderId; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-sql-builder | |
| | | * @short_description: Factory object for statements | |
| | | * @title: GdaSqlBuilder | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaSqlParser, #GdaSqlStatement and #GdaStatement | |
| | | * | |
| | | * The #GdaSqlBuilder can be used to build a #GdaStatement from its structu | |
| | | ral description, | |
| | | * much in the same way a #GdaSqlParser can be used to build a #GdaStatemen | |
| | | t from an SQL | |
| | | * string. | |
| | | * | |
| | | * The #GdaSqlBuilder internally constructs a #GdaSqlStatement and uses it | |
| | | when requested to produce | |
| | | * a #GdaStatement (see gda_sql_builder_get_statement()), or a #GdaSqlState | |
| | | ment (see | |
| | | * gda_sql_builder_get_sql_statement()). | |
| | | * | |
| | | * During the building process, some pieces of the statement are constructe | |
| | | d, and assembled into the | |
| | | * final statement. Each of these pieces can be reused anytime in the same | |
| | | #GdaSqlBuilder object, and each | |
| | | * is identified using a single unsigned integer ID. That ID is dynamically | |
| | | allocated by the object. | |
| | | * | |
| | | * The following example builds the equivalent of the <![CDATA["name='joe' | |
| | | AND age >= ##ageparam::int"]]> expression: | |
| | | * <programlisting><![CDATA[ | |
| | | *GdaSqlBuilder *b=... | |
| | | *guint id_field = gda_sql_builder_add_id (b, "name"); // build the "name" | |
| | | SQL identifier | |
| | | *guint id_value = gda_sql_builder_add_expr (b, NULL, G_TYPE_STRING, "joe") | |
| | | ; // 'joe' expression | |
| | | *guint id_cond1 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_EQ, i | |
| | | d_field, id_value, 0); // "name='joe'" | |
| | | * | |
| | | *guint id_cond2 = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_GT, | |
| | | * gda_sql_builder_add_id (b, "age"), // build the "age" SQL identifie | |
| | | r | |
| | | * gda_sql_builder_add_param (b, "ageparam", G_TYPE_INT, FALSE), // pa | |
| | | rameter | |
| | | * 0); | |
| | | *guint id_cond_and = gda_sql_builder_add_cond (b, GDA_SQL_OPERATOR_TYPE_AN | |
| | | D, id_cond1, id_cond2, 0); // whole expression | |
| | | *]]></programlisting> | |
| | | * | |
| | | * For more examples, see the <link linkend="howto-sqlbuilder">Build statem | |
| | | ents without using a parser</link> section. | |
| | | */ | |
| | | | |
| GType gda_sql_builder_get_type (void) G_GNUC_CONST; | | GType gda_sql_builder_get_type (void) G_GNUC_CONST; | |
| GdaSqlBuilder *gda_sql_builder_new (GdaSqlStatementType stmt_
type); | | GdaSqlBuilder *gda_sql_builder_new (GdaSqlStatementType stmt_
type); | |
| GdaStatement *gda_sql_builder_get_statement (GdaSqlBuilder *builder, GE
rror **error); | | GdaStatement *gda_sql_builder_get_statement (GdaSqlBuilder *builder, GE
rror **error); | |
| GdaSqlStatement *gda_sql_builder_get_sql_statement (GdaSqlBuilder *builder
); | | GdaSqlStatement *gda_sql_builder_get_sql_statement (GdaSqlBuilder *builder
); | |
| | | | |
| /* Expression API */ | | /* Expression API */ | |
| GdaSqlBuilderId gda_sql_builder_add_id (GdaSqlBuilder *builder, const gchar
*string); | | GdaSqlBuilderId gda_sql_builder_add_id (GdaSqlBuilder *builder, const gchar
*string); | |
| GdaSqlBuilderId gda_sql_builder_add_field_id (GdaSqlBuilder *builder, const
gchar *field_name, const gchar *table_name); | | GdaSqlBuilderId gda_sql_builder_add_field_id (GdaSqlBuilder *builder, const
gchar *field_name, const gchar *table_name); | |
| GdaSqlBuilderId gda_sql_builder_add_expr (GdaSqlBuilder *builder, GdaDataHa
ndler *dh, GType type, ...); | | GdaSqlBuilderId gda_sql_builder_add_expr (GdaSqlBuilder *builder, GdaDataHa
ndler *dh, GType type, ...); | |
| GdaSqlBuilderId gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, Gda
DataHandler *dh, const GValue *value); | | GdaSqlBuilderId gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, Gda
DataHandler *dh, const GValue *value); | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 53 lines changed or added | |
|
| gda-sql-parser.h | | gda-sql-parser.h | |
|
| /* gda-sql-parser.h | | /* | |
| * | | * Copyright (C) 2007 - 2011 Vivien Malerba | |
| * Copyright (C) 2007 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 74 | | skipping to change at line 73 | |
| GObject object; | | GObject object; | |
| GdaSqlParserPrivate *priv; | | GdaSqlParserPrivate *priv; | |
| }; | | }; | |
| | | | |
| /* interface with the Lemon parser */ | | /* interface with the Lemon parser */ | |
| typedef struct _GdaSqlParserIface | | typedef struct _GdaSqlParserIface | |
| { | | { | |
| GdaSqlParser *parser; | | GdaSqlParser *parser; | |
| GdaSqlStatement *parsed_statement; | | GdaSqlStatement *parsed_statement; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| } GdaSqlParserIface; | | } GdaSqlParserIface; | |
| | | | |
| /* struct for the object's class */ | | /* struct for the object's class */ | |
| struct _GdaSqlParserClass | | struct _GdaSqlParserClass | |
| { | | { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 97 | |
| void (*delim_trace) (void*, char *); | | void (*delim_trace) (void*, char *); | |
| void (*delim_parse) (void*, int, GValue *, GdaSqlParserIface *); | | void (*delim_parse) (void*, int, GValue *, GdaSqlParserIface *); | |
| gint *delim_tokens_trans; | | gint *delim_tokens_trans; | |
| | | | |
| void *(*parser_alloc) (void*(*)(size_t)); | | void *(*parser_alloc) (void*(*)(size_t)); | |
| void (*parser_free) (void*, void(*)(void*)); | | void (*parser_free) (void*, void(*)(void*)); | |
| void (*parser_trace) (void*, char *); | | void (*parser_trace) (void*, char *); | |
| void (*parser_parse) (void*, int, GValue *, GdaSqlParserIface *); | | void (*parser_parse) (void*, int, GValue *, GdaSqlParserIface *); | |
| gint *parser_tokens_trans; | | gint *parser_tokens_trans; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-sql-parser | |
| | | * @short_description: SQL parser | |
| | | * @title: GdaSqlParser | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaSqlBuilder, #GdaSqlStatement and #GdaStatement | |
| | | * | |
| | | * The #GdaSqlParser is an object dedicated to creating #GdaStatement and # | |
| | | GdaBatch objects from SQL strings. The actual contents | |
| | | * of the parsed statements is represented as #GdaSqlStatement structures ( | |
| | | which can be obtained from any #GdaStatement through the | |
| | | * "structure" property). | |
| | | * | |
| | | * #GdaSqlParser parsers can be created by calling gda_server_provider_crea | |
| | | te_parser() for a provider adapted SQL parser, or using | |
| | | * gda_sql_parser_new() for a general purpose SQL parser. | |
| | | * | |
| | | * The #GdaSqlParser can either work in "parse" mode where it will try to p | |
| | | arse the SQL string, or in "delimiter" mode where it will | |
| | | * only attempt at delimiting SQL statements in a string which may contain | |
| | | several SQL statements (usually separated by a semi column). | |
| | | * If operating in "parser" mode, and the parser can't correctly parse the | |
| | | string, then it will switch to the "delimiter" mode | |
| | | * for the next statement in the string to parse (and create a GDA_SQL_STAT | |
| | | EMENT_UNKNOWN statement). | |
| | | * | |
| | | * The #GdaSqlParser object parses and analyzes SQL statements and reports | |
| | | the following statement types: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>SELECT (and COMPOUND select), | |
| | | * INSERT, UPDATE and DELETE SQL statements should be completely parsed | |
| | | . | |
| | | * </para></listitem> | |
| | | * <listitem><para>Transaction related statements (corresponding to the BEG | |
| | | IN, COMMIT, ROLLBACK, | |
| | | * SAVEPOINT, ROLLBACK SAVEPOINT and DELETE SAVEPOINT) are parsed and a min | |
| | | imalist structure is created to | |
| | | * extract some information (that structure is not enough per-se to re-crea | |
| | | te the complete SQL statement). | |
| | | * </para></listitem> | |
| | | * <listitem><para>Any other type of SQL statement (CREATE TABLE, ...) crea | |
| | | tes a #GdaStatement of type | |
| | | * GDA_SQL_STATEMENT_UNKNOWN, and it only able to locate place holders | |
| | | (variables) and end of statement | |
| | | * marks.</para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * NOTE: Any SQL of a type which should be parsed which but which creates a | |
| | | #GdaStatement of type GDA_SQL_STATEMENT_UNKNOWN | |
| | | * (check with gda_statement_get_statement_type()) should be reported as a | |
| | | bug. | |
| | | * | |
| | | * The #GdaSqlParser object recognizes place holders (variables), which can | |
| | | later be queried and valued using | |
| | | * gda_statement_get_parameters(). The following syntax are recognized (oth | |
| | | er syntaxes might be | |
| | | * recognized for specific database providers if the #GdaSqlParser is creat | |
| | | ed using gda_server_provider_create_parser() | |
| | | * but for portability reasons it's better to avoid them): | |
| | | * <itemizedlist> | |
| | | * <listitem><para><programlisting>##NAME[::TYPE[::NULL]]]</programlisting> | |
| | | : | |
| | | * for a variable named NAME with the optional type TYPE (which can be | |
| | | a GType | |
| | | * name or a custom database type name), and with the optional "::NULL" | |
| | | to instruct that the variable can | |
| | | * be NULL. | |
| | | * </para></listitem> | |
| | | * <listitem><para> | |
| | | * <programlisting>## /* name:NAME [type:TYPE] [nullok:[TRUE|FALSE]] [ | |
| | | descr:DESCR] */</programlisting> | |
| | | * for a variable named NAME with the optional type TYPE (which can be | |
| | | a GType | |
| | | * name or a custom database type name), with the optional "nullok" att | |
| | | ribute and an optional | |
| | | * description DESCR. Note that the NAME, TYPE and DESCR literals here | |
| | | must be quoted (simple or double quotes) if | |
| | | * they include non alphanumeric characters, and that there must always | |
| | | be at least a space between the | |
| | | * <![CDATA[##]]> and the opening and closing comments (C style). | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * Note that the type string must be a type recognized by the | |
| | | * <link linkend="gda-g-type-from-string">gda_g_type_from_string()</link> f | |
| | | unction (all valid GType names | |
| | | * plus a few synonyms). Examples of correct place holders definitions are: | |
| | | * <programlisting> | |
| | | *## /* name:"+0" type:gchararray */ | |
| | | *## /* name:'-5' type:string */ | |
| | | *## /*name:myvar type:gint descr:ToBeDefined nullok:FALSE*/ | |
| | | *## /*name:myvar type:int descr:"A long description"*/ | |
| | | *##+0::gchararray | |
| | | *##-5::timestamp | |
| | | *</programlisting> | |
| | | * | |
| | | * Also note that variables should not be used when an SQL identifier is ex | |
| | | pected. For example the following | |
| | | * examples <emphasis>should be avoided</emphasis> because they may not wor | |
| | | k properly (depending on the database being used): | |
| | | *<programlisting> | |
| | | *SELECT * FROM ##tablename::string; | |
| | | *DELETE FROM mytable WHERE ##tcol::string = 5; | |
| | | *ALTER GROUP mygroup ADD USER ##name::gchararray; | |
| | | *</programlisting> | |
| | | * | |
| | | * The #GdaSqlParser object internally uses a LEMON generated parser (the s | |
| | | ame as the one used by SQLite). | |
| | | * | |
| | | * The #GdaSqlParser object implements its own locking mechanism so it is t | |
| | | hread-safe. | |
| | | */ | |
| | | | |
| GType gda_sql_parser_get_type (void) G_GNUC_CON
ST; | | GType gda_sql_parser_get_type (void) G_GNUC_CON
ST; | |
| GdaSqlParser *gda_sql_parser_new (void); | | GdaSqlParser *gda_sql_parser_new (void); | |
| | | | |
| GdaStatement *gda_sql_parser_parse_string (GdaSqlParser *pa
rser, | | GdaStatement *gda_sql_parser_parse_string (GdaSqlParser *pa
rser, | |
| const gchar *sql,
const gchar **remain, | | const gchar *sql,
const gchar **remain, | |
| GError **error); | | GError **error); | |
| GdaBatch *gda_sql_parser_parse_string_as_batch (GdaSqlParser *pa
rser, | | GdaBatch *gda_sql_parser_parse_string_as_batch (GdaSqlParser *pa
rser, | |
| const gchar *sql,
const gchar **remain, | | const gchar *sql,
const gchar **remain, | |
| GError **error); | | GError **error); | |
| GdaBatch *gda_sql_parser_parse_file_as_batch (GdaSqlParser *pa
rser, | | GdaBatch *gda_sql_parser_parse_file_as_batch (GdaSqlParser *pa
rser, | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 116 lines changed or added | |
|
| gda-sql-statement.h | | gda-sql-statement.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 2008 The GNOME Foundation. | | * Copyright (C) 2008 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| * License along with this Library; see the file COPYING.LIB. If not, | | * License along with this Library; see the file COPYING.LIB. If not, | |
| * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330
, | | * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330
, | |
| * Boston, MA 02111-1307, USA. | | * Boston, MA 02111-1307, USA. | |
| */ | | */ | |
| | | | |
| #ifndef __GDA_SQL_STATEMENT_H__ | | #ifndef __GDA_SQL_STATEMENT_H__ | |
| #define __GDA_SQL_STATEMENT_H__ | | #define __GDA_SQL_STATEMENT_H__ | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-sql-statement | |
| | | * @short_description: SQL parser | |
| | | * @title: GdaSqlParser | |
| | | * @stability: Stable | |
| | | * @see_also: The #GdaSqlBuilder object which features some easy to use API | |
| | | to build #GdaSqlStatement structures or #GdaStatement objects without havi | |
| | | ng to worry about the details of #GdaSqlStatement's contents. | |
| | | * | |
| | | * Please note that it is not advised to build #GdaSqlStatement structures | |
| | | directly, but rather | |
| | | * it is recommended to use the #GdaSqlBuilder object and its associated AP | |
| | | I. | |
| | | * | |
| | | * Every SQL statement can be decomposed in a #GdaSqlStatement structure. T | |
| | | his is not a #GObject, but rather just a C structure | |
| | | * which can be manipulated directly. The structure is a tree composed of s | |
| | | everal key structures which are show in the following diagram | |
| | | * (even though it does not show, all structures "inherit" the #GdaSqlAnyPa | |
| | | rt structure which holds some basic information). | |
| | | *<mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="parts.png" format="PNG"/> | |
| | | * </imageobject> | |
| | | * <caption> | |
| | | * <para> | |
| | | * Main parts of the #GdaSqlStatement structure. | |
| | | * </para> | |
| | | * </caption> | |
| | | *</mediaobject> | |
| | | * | |
| | | * The samples/SqlParserConsole directory of &LIBGDA;'s sources contains a | |
| | | small utility | |
| | | * to display statements' structures as a graph (using the GraphViz languag | |
| | | e). It has been used to | |
| | | * provide the examples in this section of the documentation. | |
| | | */ | |
| | | | |
| #include <sql-parser/gda-statement-struct-select.h> | | #include <sql-parser/gda-statement-struct-select.h> | |
| #include <sql-parser/gda-statement-struct-insert.h> | | #include <sql-parser/gda-statement-struct-insert.h> | |
| #include <sql-parser/gda-statement-struct-update.h> | | #include <sql-parser/gda-statement-struct-update.h> | |
| #include <sql-parser/gda-statement-struct-delete.h> | | #include <sql-parser/gda-statement-struct-delete.h> | |
| #include <sql-parser/gda-statement-struct-compound.h> | | #include <sql-parser/gda-statement-struct-compound.h> | |
| #include <sql-parser/gda-statement-struct-trans.h> | | #include <sql-parser/gda-statement-struct-trans.h> | |
| #include <sql-parser/gda-statement-struct-unknown.h> | | #include <sql-parser/gda-statement-struct-unknown.h> | |
| #include <sql-parser/gda-statement-struct-parts.h> | | #include <sql-parser/gda-statement-struct-parts.h> | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 40 lines changed or added | |
|
| gda-statement-extra.h | | gda-statement-extra.h | |
|
| /* gda-statement-extra.h | | /* | |
| * | | * Copyright (C) 2005 - 2011 Vivien Malerba | |
| * Copyright (C) 2005 - 2009 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 30 | |
| #ifndef __GDA_STATEMENT_EXTRA__ | | #ifndef __GDA_STATEMENT_EXTRA__ | |
| #define __GDA_STATEMENT_EXTRA__ | | #define __GDA_STATEMENT_EXTRA__ | |
| | | | |
| #include <sql-parser/gda-sql-statement.h> | | #include <sql-parser/gda-sql-statement.h> | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
| /* private information to implement custom | | /* private information to implement custom | |
| * SQL renderers for GdaStatement objects | | * SQL renderers for GdaStatement objects | |
| */ | | */ | |
|
| | | | |
| typedef struct _GdaSqlRenderingContext GdaSqlRenderingContext; | | typedef struct _GdaSqlRenderingContext GdaSqlRenderingContext; | |
|
| | | | |
| | | /** | |
| | | * GdaSqlRenderingFunc: | |
| | | * @node: a #GdaSqlAnyPart pointer, to be cast to the correct type dependin | |
| | | g on which part the function has to render | |
| | | * @context: the rendering context | |
| | | * @error: a place to store errors, or %NULL | |
| | | * @Returns: a new string, or %NULL if an error occurred | |
| | | * | |
| | | * Function to render any #GdaSqlAnyPart. | |
| | | */ | |
| typedef gchar *(*GdaSqlRenderingFunc) (GdaSqlAnyPart *node, GdaSqlRend
eringContext *context, GError **error); | | typedef gchar *(*GdaSqlRenderingFunc) (GdaSqlAnyPart *node, GdaSqlRend
eringContext *context, GError **error); | |
|
| | | | |
| | | /** | |
| | | * GdaSqlRenderingExpr: | |
| | | * @expr: #GdaSqlExpr to render | |
| | | * @context: the rendering context | |
| | | * @is_default: pointer to a #gboolean which is set to TRUE if value should | |
| | | be considered as a default value | |
| | | * @is_null: pointer to a #gboolean which is set to TRUE if value should be | |
| | | considered as NULL | |
| | | * @error: a place to store errors, or %NULL | |
| | | * @Returns: a new string, or %NULL if an error occurred | |
| | | * | |
| | | * Rendering function type to render a #GdaSqlExpr | |
| | | */ | |
| typedef gchar *(*GdaSqlRenderingExpr) (GdaSqlExpr *expr, GdaSqlRenderi
ngContext *context, | | typedef gchar *(*GdaSqlRenderingExpr) (GdaSqlExpr *expr, GdaSqlRenderi
ngContext *context, | |
| gboolean *is_default, gboolean *
is_null, | | gboolean *is_default, gboolean *
is_null, | |
| GError **error); | | GError **error); | |
|
| | | | |
| | | /** | |
| | | * GdaSqlRenderingPSpecFunc: | |
| | | * @pspec: #GdaSqlParamSpec to render | |
| | | * @expr: #GdaSqlExpr which may hold the default value for the parameter, o | |
| | | r %NULL | |
| | | * @context: the rendering context | |
| | | * @is_default: pointer to a #gboolean which is set to TRUE if value should | |
| | | be considered as a default value | |
| | | * @is_null: pointer to a #gboolean which is set to TRUE if value should be | |
| | | considered as NULL | |
| | | * @error: a place to store errors, or %NULL | |
| | | * @Returns: a new string, or %NULL if an error occurred | |
| | | * | |
| | | * Rendering function type to render a #GdaSqlParamSpec | |
| | | */ | |
| typedef gchar *(*GdaSqlRenderingPSpecFunc) (GdaSqlParamSpec *pspec, GdaSqlE
xpr *expr, GdaSqlRenderingContext *context, | | typedef gchar *(*GdaSqlRenderingPSpecFunc) (GdaSqlParamSpec *pspec, GdaSqlE
xpr *expr, GdaSqlRenderingContext *context, | |
| gboolean *is_default, gboolean *
is_null, | | gboolean *is_default, gboolean *
is_null, | |
| GError **error); | | GError **error); | |
|
| | | | |
| | | /** | |
| | | * GdaSqlRenderingValue: | |
| | | * @value: the #GValue to render | |
| | | * @context: the rendering context | |
| | | * @error: a place to store errors, or %NULL | |
| | | * @Returns: a new string, or %NULL if an error occurred | |
| | | * | |
| | | * Rendering function type to render a #GValue | |
| | | */ | |
| typedef gchar *(*GdaSqlRenderingValue) (const GValue *value, GdaSqlRend
eringContext *context, GError **error); | | typedef gchar *(*GdaSqlRenderingValue) (const GValue *value, GdaSqlRend
eringContext *context, GError **error); | |
| | | | |
|
| | | /** | |
| | | * GdaSqlRenderingContext: | |
| | | * @flags: Global rendering options | |
| | | * @params: Parameters to be used while doing the rendering | |
| | | * @params_used: When rendering is complete, contains the ordered list of p | |
| | | arameters which have been used while doing the rendering | |
| | | * @provider: Pointer to the server provider to be used | |
| | | * @cnc: Pointer to the connection to be used | |
| | | * @render_value: function to render a #GValue | |
| | | * @render_param_spec: function to render a #GdaSqlParamSpec | |
| | | * @render_expr: function to render a #GdaSqlExpr | |
| | | * @render_unknown: function to render a #GdaSqlStatementUnknown | |
| | | * @render_begin: function to render a BEGIN #GdaSqlStatementTransaction | |
| | | * @render_rollback: function to render a ROLLBACK #GdaSqlStatementTransact | |
| | | ion | |
| | | * @render_commit: function to render a COMMIT #GdaSqlStatementTransaction | |
| | | * @render_savepoint: function to render a ADD SAVEPOINT #GdaSqlStatementTr | |
| | | ansaction | |
| | | * @render_rollback_savepoint: function to render a ROLBACK SAVEPOINT #GdaS | |
| | | qlStatementTransaction | |
| | | * @render_delete_savepoint: function to render a DELETE SAVEPOINT #GdaSqlS | |
| | | tatementTransaction | |
| | | * @render_select: function to render a #GdaSqlStatementSelect | |
| | | * @render_insert: function to render a #GdaSqlStatementInsert | |
| | | * @render_delete: function to render a #GdaSqlStatementDelete | |
| | | * @render_update: function to render a #GdaSqlStatementUpdate | |
| | | * @render_compound: function to render a #GdaSqlStatementCompound | |
| | | * @render_field: function to render a #GdaSqlField | |
| | | * @render_table: function to render a #GdaSqlTable | |
| | | * @render_function: function to render a #GdaSqlFunction | |
| | | * @render_operation: function to render a #GdaSqlOperation | |
| | | * @render_case: function to render a #GdaSqlCase | |
| | | * @render_select_field: function to render a #GdaSqlSelectField | |
| | | * @render_select_target: function to render a #GdaSqlSelectTarget | |
| | | * @render_select_join: function to render a #GdaSqlSelectJoin | |
| | | * @render_select_from: function to render a #GdaSqlSelectFrom | |
| | | * @render_select_order: function to render a #GdaSqlSelectOrder | |
| | | */ | |
| struct _GdaSqlRenderingContext { | | struct _GdaSqlRenderingContext { | |
| GdaStatementSqlFlag flags; | | GdaStatementSqlFlag flags; | |
| GdaSet *params; | | GdaSet *params; | |
| GSList *params_used; | | GSList *params_used; | |
| GdaServerProvider *provider; /* may be NULL */ | | GdaServerProvider *provider; /* may be NULL */ | |
| GdaConnection *cnc; /* may be NULL */ | | GdaConnection *cnc; /* may be NULL */ | |
| | | | |
| /* rendering functions */ | | /* rendering functions */ | |
| GdaSqlRenderingValue render_value; | | GdaSqlRenderingValue render_value; | |
| GdaSqlRenderingPSpecFunc render_param_spec; | | GdaSqlRenderingPSpecFunc render_param_spec; | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 156 | |
| GdaSqlRenderingFunc render_table; | | GdaSqlRenderingFunc render_table; | |
| GdaSqlRenderingFunc render_function; | | GdaSqlRenderingFunc render_function; | |
| GdaSqlRenderingFunc render_operation; | | GdaSqlRenderingFunc render_operation; | |
| GdaSqlRenderingFunc render_case; | | GdaSqlRenderingFunc render_case; | |
| GdaSqlRenderingFunc render_select_field; | | GdaSqlRenderingFunc render_select_field; | |
| GdaSqlRenderingFunc render_select_target; | | GdaSqlRenderingFunc render_select_target; | |
| GdaSqlRenderingFunc render_select_join; | | GdaSqlRenderingFunc render_select_join; | |
| GdaSqlRenderingFunc render_select_from; | | GdaSqlRenderingFunc render_select_from; | |
| GdaSqlRenderingFunc render_select_order; | | GdaSqlRenderingFunc render_select_order; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| void (*_gda_reserved5) (void); | | void (*_gda_reserved5) (void); | |
| void (*_gda_reserved6) (void); | | void (*_gda_reserved6) (void); | |
| void (*_gda_reserved7) (void); | | void (*_gda_reserved7) (void); | |
| void (*_gda_reserved8) (void); | | void (*_gda_reserved8) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:provider-support-sql | |
| | | * @short_description: Adapting the SQL to the database's own SQL dialect | |
| | | * @title: SQL rendering API | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * &LIBGDA; is able to render a #GdaStatement statement to SQL in a generic | |
| | | way (as close as possible to the SQL | |
| | | * standard). However as each database has ultimately its own SQL dialect, | |
| | | some parts of the rendering has | |
| | | * to be specialized. | |
| | | * | |
| | | * Customization is achieved by providing custom implementations of SQL ren | |
| | | dering functions for each kind of | |
| | | * part in a #GdaSqlStatement structure, all packed in a #GdaSqlRenderingCo | |
| | | ntext context structure. Functions | |
| | | * which are not customized will be implemented by the default ones. | |
| | | */ | |
| | | | |
| gchar *gda_statement_to_sql_real (GdaStatement *stmt, GdaSqlRenderingContex
t *context, GError **error); | | gchar *gda_statement_to_sql_real (GdaStatement *stmt, GdaSqlRenderingContex
t *context, GError **error); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 9 change blocks. |
| 4 lines changed or deleted | | 112 lines changed or added | |
|
| gda-statement-struct-decl.h | | gda-statement-struct-decl.h | |
| /* | | /* | |
|
| * Copyright (C) 2007 - 2008 Vivien Malerba | | * Copyright (C) 2007 - 2011 Vivien Malerba | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 59 | | skipping to change at line 59 | |
| typedef struct _GdaSqlStatementTransaction GdaSqlStatementTransaction; | | typedef struct _GdaSqlStatementTransaction GdaSqlStatementTransaction; | |
| typedef struct _GdaSqlStatementSelect GdaSqlStatementSelect; | | typedef struct _GdaSqlStatementSelect GdaSqlStatementSelect; | |
| typedef struct _GdaSqlStatementInsert GdaSqlStatementInsert; | | typedef struct _GdaSqlStatementInsert GdaSqlStatementInsert; | |
| typedef struct _GdaSqlStatementDelete GdaSqlStatementDelete; | | typedef struct _GdaSqlStatementDelete GdaSqlStatementDelete; | |
| typedef struct _GdaSqlStatementUpdate GdaSqlStatementUpdate; | | typedef struct _GdaSqlStatementUpdate GdaSqlStatementUpdate; | |
| typedef struct _GdaSqlStatementCompound GdaSqlStatementCompound; | | typedef struct _GdaSqlStatementCompound GdaSqlStatementCompound; | |
| | | | |
| /* | | /* | |
| * Statement type | | * Statement type | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlStatementType: | |
| | | * @GDA_SQL_STATEMENT_SELECT: a SELECT statement | |
| | | * @GDA_SQL_STATEMENT_INSERT: an INSERT statement | |
| | | * @GDA_SQL_STATEMENT_UPDATE: an UPDATE statement | |
| | | * @GDA_SQL_STATEMENT_DELETE: a DELETE statement | |
| | | * @GDA_SQL_STATEMENT_COMPOUND: a compound statement: multiple SELECT state | |
| | | ments grouped together using an operator | |
| | | * @GDA_SQL_STATEMENT_BEGIN: start of transaction statement | |
| | | * @GDA_SQL_STATEMENT_ROLLBACK: transaction abort statement | |
| | | * @GDA_SQL_STATEMENT_COMMIT: transaction commit statement | |
| | | * @GDA_SQL_STATEMENT_SAVEPOINT: new savepoint definition statement | |
| | | * @GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT: return to savepoint statement | |
| | | * @GDA_SQL_STATEMENT_DELETE_SAVEPOINT: savepoint deletion statement | |
| | | * @GDA_SQL_STATEMENT_UNKNOWN: unknown statement, only identifies variables | |
| | | * @GDA_SQL_STATEMENT_NONE: not used | |
| | | * | |
| | | * Known types of statements | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_SQL_STATEMENT_SELECT, | | GDA_SQL_STATEMENT_SELECT, | |
| GDA_SQL_STATEMENT_INSERT, | | GDA_SQL_STATEMENT_INSERT, | |
| GDA_SQL_STATEMENT_UPDATE, | | GDA_SQL_STATEMENT_UPDATE, | |
| GDA_SQL_STATEMENT_DELETE, | | GDA_SQL_STATEMENT_DELETE, | |
| GDA_SQL_STATEMENT_COMPOUND, | | GDA_SQL_STATEMENT_COMPOUND, | |
| | | | |
| GDA_SQL_STATEMENT_BEGIN, | | GDA_SQL_STATEMENT_BEGIN, | |
| GDA_SQL_STATEMENT_ROLLBACK, | | GDA_SQL_STATEMENT_ROLLBACK, | |
| GDA_SQL_STATEMENT_COMMIT, | | GDA_SQL_STATEMENT_COMMIT, | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 99 | |
| GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT, | | GDA_SQL_STATEMENT_ROLLBACK_SAVEPOINT, | |
| GDA_SQL_STATEMENT_DELETE_SAVEPOINT, | | GDA_SQL_STATEMENT_DELETE_SAVEPOINT, | |
| | | | |
| GDA_SQL_STATEMENT_UNKNOWN, | | GDA_SQL_STATEMENT_UNKNOWN, | |
| GDA_SQL_STATEMENT_NONE | | GDA_SQL_STATEMENT_NONE | |
| } GdaSqlStatementType; | | } GdaSqlStatementType; | |
| | | | |
| /* | | /* | |
| * Structures identification | | * Structures identification | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlAnyPartType: | |
| | | * @GDA_SQL_ANY_STMT_SELECT: structure is a #GdaSqlStatementSelect | |
| | | * @GDA_SQL_ANY_STMT_INSERT: structure is a #GdaSqlStatementInsert | |
| | | * @GDA_SQL_ANY_STMT_UPDATE: structure is a #GdaSqlStatementUpdate | |
| | | * @GDA_SQL_ANY_STMT_DELETE: structure is a #GdaSqlStatementDelete | |
| | | * @GDA_SQL_ANY_STMT_COMPOUND: structure is a #GdaSqlStatementCompound | |
| | | * @GDA_SQL_ANY_STMT_BEGIN: structure is a #GdaSqlStatementTransaction | |
| | | * @GDA_SQL_ANY_STMT_ROLLBACK: structure is a #GdaSqlStatementTransaction | |
| | | * @GDA_SQL_ANY_STMT_COMMIT: structure is a #GdaSqlStatementTransaction | |
| | | * @GDA_SQL_ANY_STMT_SAVEPOINT: structure is a #GdaSqlStatementTransaction | |
| | | * @GDA_SQL_ANY_STMT_ROLLBACK_SAVEPOINT: structure is a #GdaSqlStatementTra | |
| | | nsaction | |
| | | * @GDA_SQL_ANY_STMT_DELETE_SAVEPOINT: structure is a #GdaSqlStatementTrans | |
| | | action | |
| | | * @GDA_SQL_ANY_STMT_UNKNOWN: structure is a #GdaSqlStatementUnknown | |
| | | * @GDA_SQL_ANY_EXPR: structure is a #GdaSqlExpr | |
| | | * @GDA_SQL_ANY_SQL_FIELD: structure is a #GdaSqlField | |
| | | * @GDA_SQL_ANY_SQL_TABLE: structure is a #GdaSqlTable | |
| | | * @GDA_SQL_ANY_SQL_FUNCTION: structure is a #GdaSqlFunction | |
| | | * @GDA_SQL_ANY_SQL_OPERATION: structure is a #GdaSqlOperation | |
| | | * @GDA_SQL_ANY_SQL_CASE: structure is a #GdaSqlCase | |
| | | * @GDA_SQL_ANY_SQL_SELECT_FIELD: structure is a #GdaSqlSelectField | |
| | | * @GDA_SQL_ANY_SQL_SELECT_TARGET: structure is a #GdaSqlSelectTarget | |
| | | * @GDA_SQL_ANY_SQL_SELECT_JOIN: structure is a #GdaSqlSelectJoin | |
| | | * @GDA_SQL_ANY_SQL_SELECT_FROM: structure is a #GdaSqlSelectFrom | |
| | | * @GDA_SQL_ANY_SQL_SELECT_ORDER: structure is a #GdaSqlSelectOrder | |
| | | * | |
| | | * Type of part. | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| /* complete statements */ | | /* complete statements */ | |
| GDA_SQL_ANY_STMT_SELECT = GDA_SQL_STATEMENT_SELECT, | | GDA_SQL_ANY_STMT_SELECT = GDA_SQL_STATEMENT_SELECT, | |
| GDA_SQL_ANY_STMT_INSERT = GDA_SQL_STATEMENT_INSERT, | | GDA_SQL_ANY_STMT_INSERT = GDA_SQL_STATEMENT_INSERT, | |
| GDA_SQL_ANY_STMT_UPDATE = GDA_SQL_STATEMENT_UPDATE, | | GDA_SQL_ANY_STMT_UPDATE = GDA_SQL_STATEMENT_UPDATE, | |
| GDA_SQL_ANY_STMT_DELETE = GDA_SQL_STATEMENT_DELETE, | | GDA_SQL_ANY_STMT_DELETE = GDA_SQL_STATEMENT_DELETE, | |
| GDA_SQL_ANY_STMT_COMPOUND = GDA_SQL_STATEMENT_COMPOUND, | | GDA_SQL_ANY_STMT_COMPOUND = GDA_SQL_STATEMENT_COMPOUND, | |
| GDA_SQL_ANY_STMT_BEGIN = GDA_SQL_STATEMENT_BEGIN, | | GDA_SQL_ANY_STMT_BEGIN = GDA_SQL_STATEMENT_BEGIN, | |
| GDA_SQL_ANY_STMT_ROLLBACK = GDA_SQL_STATEMENT_ROLLBACK, | | GDA_SQL_ANY_STMT_ROLLBACK = GDA_SQL_STATEMENT_ROLLBACK, | |
| GDA_SQL_ANY_STMT_COMMIT = GDA_SQL_STATEMENT_COMMIT, | | GDA_SQL_ANY_STMT_COMMIT = GDA_SQL_STATEMENT_COMMIT, | |
| | | | |
| skipping to change at line 110 | | skipping to change at line 156 | |
| GDA_SQL_ANY_SQL_FUNCTION, | | GDA_SQL_ANY_SQL_FUNCTION, | |
| GDA_SQL_ANY_SQL_OPERATION, | | GDA_SQL_ANY_SQL_OPERATION, | |
| GDA_SQL_ANY_SQL_CASE, | | GDA_SQL_ANY_SQL_CASE, | |
| GDA_SQL_ANY_SQL_SELECT_FIELD, | | GDA_SQL_ANY_SQL_SELECT_FIELD, | |
| GDA_SQL_ANY_SQL_SELECT_TARGET, | | GDA_SQL_ANY_SQL_SELECT_TARGET, | |
| GDA_SQL_ANY_SQL_SELECT_JOIN, | | GDA_SQL_ANY_SQL_SELECT_JOIN, | |
| GDA_SQL_ANY_SQL_SELECT_FROM, | | GDA_SQL_ANY_SQL_SELECT_FROM, | |
| GDA_SQL_ANY_SQL_SELECT_ORDER | | GDA_SQL_ANY_SQL_SELECT_ORDER | |
| } GdaSqlAnyPartType; | | } GdaSqlAnyPartType; | |
| | | | |
|
| | | /** | |
| | | * GdaSqlAnyPart: | |
| | | * @type: type of structure, as a #GdaSqlAnyPartType enum. | |
| | | * @parent: pointer to the parent #GdaSqlAnyPart structure | |
| | | * | |
| | | * Base structure of which all structures (except #GdaSqlStatement) "inheri | |
| | | t". It identifies, for each structure, | |
| | | * its type and its parent in the structure hierarchy. | |
| | | */ | |
| struct _GdaSqlAnyPart { | | struct _GdaSqlAnyPart { | |
| GdaSqlAnyPartType type; | | GdaSqlAnyPartType type; | |
| GdaSqlAnyPart *parent; | | GdaSqlAnyPart *parent; | |
| }; | | }; | |
| | | | |
| #define GDA_SQL_ANY_PART(x) ((GdaSqlAnyPart*)(x)) | | #define GDA_SQL_ANY_PART(x) ((GdaSqlAnyPart*)(x)) | |
| #define gda_sql_any_part_set_parent(a,p) \ | | #define gda_sql_any_part_set_parent(a,p) \ | |
| if (a) GDA_SQL_ANY_PART(a)->parent = GDA_SQL_ANY_PART(p) | | if (a) GDA_SQL_ANY_PART(a)->parent = GDA_SQL_ANY_PART(p) | |
| | | | |
| /* | | /* | |
| * Iteration | | * Iteration | |
| */ | | */ | |
| | | | |
| /* returns FALSE if a recursive walking should be stopped (mandatory is @er
ror is set) */ | | /* returns FALSE if a recursive walking should be stopped (mandatory is @er
ror is set) */ | |
|
| | | /** | |
| | | * GdaSqlForeachFunc: | |
| | | * @Param1: the current #GdaSqlAnyPart node | |
| | | * @Param2: user data passed to gda_sql_any_part_foreach(). | |
| | | * @Param3: pointer to a place to store errors | |
| | | * @Returns: FALSE if the gda_sql_any_part_foreach() should stop at this po | |
| | | int and fail | |
| | | * | |
| | | * Specifies the type of functions passed to gda_sql_any_part_foreach(). | |
| | | */ | |
| typedef gboolean (*GdaSqlForeachFunc) (GdaSqlAnyPart *, gpointer, GError **
); | | typedef gboolean (*GdaSqlForeachFunc) (GdaSqlAnyPart *, gpointer, GError **
); | |
| | | | |
| gboolean gda_sql_any_part_foreach (GdaSqlAnyPart *node, GdaSqlForeachFunc f
unc, gpointer data, GError **error); | | gboolean gda_sql_any_part_foreach (GdaSqlAnyPart *node, GdaSqlForeachFunc f
unc, gpointer data, GError **error); | |
| | | | |
| /* | | /* | |
| * Structure validation | | * Structure validation | |
| */ | | */ | |
| gboolean gda_sql_any_part_check_structure (GdaSqlAnyPart *node, GError **er
ror); | | gboolean gda_sql_any_part_check_structure (GdaSqlAnyPart *node, GError **er
ror); | |
| | | | |
| /* | | /* | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 211 | |
| gchar *name; | | gchar *name; | |
| gpointer (*construct) (void); | | gpointer (*construct) (void); | |
| void (*free) (gpointer); | | void (*free) (gpointer); | |
| gpointer (*copy) (gpointer); | | gpointer (*copy) (gpointer); | |
| gchar *(*serialize) (gpointer); | | gchar *(*serialize) (gpointer); | |
| | | | |
| /* augmenting information precision using a dictionary */ | | /* augmenting information precision using a dictionary */ | |
| GdaSqlForeachFunc check_structure_func; | | GdaSqlForeachFunc check_structure_func; | |
| GdaSqlForeachFunc check_validity_func; | | GdaSqlForeachFunc check_validity_func; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| gpointer _gda_reserved3; | | gpointer _gda_reserved3; | |
| gpointer _gda_reserved4; | | gpointer _gda_reserved4; | |
| } GdaSqlStatementContentsInfo; | | } GdaSqlStatementContentsInfo; | |
| | | | |
| /* | | /* | |
| * Validation against a dictionary | | * Validation against a dictionary | |
| */ | | */ | |
| | | | |
| skipping to change at line 158 | | skipping to change at line 222 | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| gpointer _gda_reserved3; | | gpointer _gda_reserved3; | |
| gpointer _gda_reserved4; | | gpointer _gda_reserved4; | |
| } GdaSqlStatementContentsInfo; | | } GdaSqlStatementContentsInfo; | |
| | | | |
| /* | | /* | |
| * Validation against a dictionary | | * Validation against a dictionary | |
| */ | | */ | |
|
| | | | |
| typedef struct { | | typedef struct { | |
| GdaConnection *cnc; | | GdaConnection *cnc; | |
| GdaMetaStore *store; | | GdaMetaStore *store; | |
| GdaMetaStruct *mstruct; | | GdaMetaStruct *mstruct; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| gpointer _gda_reserved3; | | gpointer _gda_reserved3; | |
| gpointer _gda_reserved4; | | gpointer _gda_reserved4; | |
| } GdaSqlStatementCheckValidityData; | | } GdaSqlStatementCheckValidityData; | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 8 change blocks. |
| 2 lines changed or deleted | | 71 lines changed or added | |
|
| gda-statement-struct-parts.h | | gda-statement-struct-parts.h | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 111 | |
| void gda_sql_expr_free (GdaSqlExpr *expr); | | void gda_sql_expr_free (GdaSqlExpr *expr); | |
| GdaSqlExpr *gda_sql_expr_copy (GdaSqlExpr *expr); | | GdaSqlExpr *gda_sql_expr_copy (GdaSqlExpr *expr); | |
| gchar *gda_sql_expr_serialize (GdaSqlExpr *expr); | | gchar *gda_sql_expr_serialize (GdaSqlExpr *expr); | |
| void _gda_sql_expr_check_clean (GdaSqlExpr *expr); | | void _gda_sql_expr_check_clean (GdaSqlExpr *expr); | |
| | | | |
| void gda_sql_expr_take_select (GdaSqlExpr *expr, GdaSqlState
ment *stmt); | | void gda_sql_expr_take_select (GdaSqlExpr *expr, GdaSqlState
ment *stmt); | |
| | | | |
| /* | | /* | |
| * Any Table's field | | * Any Table's field | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlField: | |
| | | * any: | |
| | | * @field_name: | |
| | | * @validity_meta_table_column: | |
| | | * | |
| | | * This structure represents the name of a table's field. | |
| | | */ | |
| struct _GdaSqlField { | | struct _GdaSqlField { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| gchar *field_name; | | gchar *field_name; | |
| | | | |
| /* validity check with a connection */ | | /* validity check with a connection */ | |
| GdaMetaTableColumn *validity_meta_table_column; | | GdaMetaTableColumn *validity_meta_table_column; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| | | | |
| skipping to change at line 135 | | skipping to change at line 143 | |
| void gda_sql_field_free (GdaSqlField *field); | | void gda_sql_field_free (GdaSqlField *field); | |
| GdaSqlField *gda_sql_field_copy (GdaSqlField *field); | | GdaSqlField *gda_sql_field_copy (GdaSqlField *field); | |
| gchar *gda_sql_field_serialize (GdaSqlField *field); | | gchar *gda_sql_field_serialize (GdaSqlField *field); | |
| void _gda_sql_field_check_clean (GdaSqlField *field); | | void _gda_sql_field_check_clean (GdaSqlField *field); | |
| | | | |
| void gda_sql_field_take_name (GdaSqlField *field, GValue *
value); | | void gda_sql_field_take_name (GdaSqlField *field, GValue *
value); | |
| | | | |
| /* | | /* | |
| * Any table | | * Any table | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlTable: | |
| | | * @any: | |
| | | * @table_name: | |
| | | * @validity_meta_object: | |
| | | * | |
| | | * This structure represents the name of a table. | |
| | | */ | |
| struct _GdaSqlTable | | struct _GdaSqlTable | |
| { | | { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| gchar *table_name; | | gchar *table_name; | |
| | | | |
| /* validity check with a connection */ | | /* validity check with a connection */ | |
| GdaMetaDbObject *validity_meta_object; | | GdaMetaDbObject *validity_meta_object; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 176 | |
| void gda_sql_table_free (GdaSqlTable *table); | | void gda_sql_table_free (GdaSqlTable *table); | |
| GdaSqlTable *gda_sql_table_copy (GdaSqlTable *table); | | GdaSqlTable *gda_sql_table_copy (GdaSqlTable *table); | |
| gchar *gda_sql_table_serialize (GdaSqlTable *table); | | gchar *gda_sql_table_serialize (GdaSqlTable *table); | |
| void _gda_sql_table_check_clean (GdaSqlTable *table); | | void _gda_sql_table_check_clean (GdaSqlTable *table); | |
| | | | |
| void gda_sql_table_take_name (GdaSqlTable *table, GValue *
value); | | void gda_sql_table_take_name (GdaSqlTable *table, GValue *
value); | |
| | | | |
| /* | | /* | |
| * A function with any number of arguments | | * A function with any number of arguments | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlFunction: | |
| | | * @any: inheritance structure | |
| | | * @function_name: name of the function , in the form [[catalog.]schema.]fu | |
| | | nction_name | |
| | | * @args_list: list of #GdaSqlExpr expressions, one for each argument | |
| | | * | |
| | | * This structure represents a function or an aggregate with zero or more a | |
| | | rguments. | |
| | | */ | |
| struct _GdaSqlFunction { | | struct _GdaSqlFunction { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| gchar *function_name; | | gchar *function_name; | |
| GSList *args_list; | | GSList *args_list; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| }; | | }; | |
| | | | |
| skipping to change at line 183 | | skipping to change at line 207 | |
| GdaSqlFunction *gda_sql_function_copy (GdaSqlFunction *function)
; | | GdaSqlFunction *gda_sql_function_copy (GdaSqlFunction *function)
; | |
| gchar *gda_sql_function_serialize (GdaSqlFunction *function)
; | | gchar *gda_sql_function_serialize (GdaSqlFunction *function)
; | |
| void gda_sql_function_check_clean (GdaSqlFunction *function)
; | | void gda_sql_function_check_clean (GdaSqlFunction *function)
; | |
| | | | |
| void gda_sql_function_take_name (GdaSqlFunction *function,
GValue *value); | | void gda_sql_function_take_name (GdaSqlFunction *function,
GValue *value); | |
| void gda_sql_function_take_args_list (GdaSqlFunction *function,
GSList *args); | | void gda_sql_function_take_args_list (GdaSqlFunction *function,
GSList *args); | |
| | | | |
| /* | | /* | |
| * An operation on one or more expressions | | * An operation on one or more expressions | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlOperatorType: | |
| | | * @GDA_SQL_OPERATOR_TYPE_AND: | |
| | | * @GDA_SQL_OPERATOR_TYPE_OR: | |
| | | * @GDA_SQL_OPERATOR_TYPE_EQ: | |
| | | * @GDA_SQL_OPERATOR_TYPE_IS: | |
| | | * @GDA_SQL_OPERATOR_TYPE_LIKE: | |
| | | * @GDA_SQL_OPERATOR_TYPE_BETWEEN: | |
| | | * @GDA_SQL_OPERATOR_TYPE_GT: | |
| | | * @GDA_SQL_OPERATOR_TYPE_LT: | |
| | | * @GDA_SQL_OPERATOR_TYPE_GEQ: | |
| | | * @GDA_SQL_OPERATOR_TYPE_LEQ: | |
| | | * @GDA_SQL_OPERATOR_TYPE_DIFF: | |
| | | * @GDA_SQL_OPERATOR_TYPE_REGEXP: | |
| | | * @GDA_SQL_OPERATOR_TYPE_REGEXP_CI: | |
| | | * @GDA_SQL_OPERATOR_TYPE_NOT_REGEXP: | |
| | | * @GDA_SQL_OPERATOR_TYPE_NOT_REGEXP_CI: | |
| | | * @GDA_SQL_OPERATOR_TYPE_SIMILAR: | |
| | | * @GDA_SQL_OPERATOR_TYPE_ISNULL: | |
| | | * @GDA_SQL_OPERATOR_TYPE_ISNOTNULL: | |
| | | * @GDA_SQL_OPERATOR_TYPE_NOT: | |
| | | * @GDA_SQL_OPERATOR_TYPE_IN: | |
| | | * @GDA_SQL_OPERATOR_TYPE_NOTIN: | |
| | | * @GDA_SQL_OPERATOR_TYPE_CONCAT: | |
| | | * @GDA_SQL_OPERATOR_TYPE_PLUS: | |
| | | * @GDA_SQL_OPERATOR_TYPE_MINUS: | |
| | | * @GDA_SQL_OPERATOR_TYPE_STAR: | |
| | | * @GDA_SQL_OPERATOR_TYPE_DIV: | |
| | | * @GDA_SQL_OPERATOR_TYPE_REM: | |
| | | * @GDA_SQL_OPERATOR_TYPE_BITAND: | |
| | | * @GDA_SQL_OPERATOR_TYPE_BITOR: | |
| | | * @GDA_SQL_OPERATOR_TYPE_BITNOT: | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_SQL_OPERATOR_TYPE_AND, | | GDA_SQL_OPERATOR_TYPE_AND, | |
| GDA_SQL_OPERATOR_TYPE_OR, | | GDA_SQL_OPERATOR_TYPE_OR, | |
| | | | |
| GDA_SQL_OPERATOR_TYPE_EQ, | | GDA_SQL_OPERATOR_TYPE_EQ, | |
| GDA_SQL_OPERATOR_TYPE_IS, | | GDA_SQL_OPERATOR_TYPE_IS, | |
| GDA_SQL_OPERATOR_TYPE_LIKE, | | GDA_SQL_OPERATOR_TYPE_LIKE, | |
| GDA_SQL_OPERATOR_TYPE_BETWEEN, | | GDA_SQL_OPERATOR_TYPE_BETWEEN, | |
| GDA_SQL_OPERATOR_TYPE_GT, | | GDA_SQL_OPERATOR_TYPE_GT, | |
| GDA_SQL_OPERATOR_TYPE_LT, | | GDA_SQL_OPERATOR_TYPE_LT, | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 275 | |
| GDA_SQL_OPERATOR_TYPE_PLUS, | | GDA_SQL_OPERATOR_TYPE_PLUS, | |
| GDA_SQL_OPERATOR_TYPE_MINUS, | | GDA_SQL_OPERATOR_TYPE_MINUS, | |
| GDA_SQL_OPERATOR_TYPE_STAR, | | GDA_SQL_OPERATOR_TYPE_STAR, | |
| GDA_SQL_OPERATOR_TYPE_DIV, | | GDA_SQL_OPERATOR_TYPE_DIV, | |
| GDA_SQL_OPERATOR_TYPE_REM, | | GDA_SQL_OPERATOR_TYPE_REM, | |
| GDA_SQL_OPERATOR_TYPE_BITAND, | | GDA_SQL_OPERATOR_TYPE_BITAND, | |
| GDA_SQL_OPERATOR_TYPE_BITOR, | | GDA_SQL_OPERATOR_TYPE_BITOR, | |
| GDA_SQL_OPERATOR_TYPE_BITNOT | | GDA_SQL_OPERATOR_TYPE_BITNOT | |
| } GdaSqlOperatorType; | | } GdaSqlOperatorType; | |
| | | | |
|
| | | /** | |
| | | * GdaSqlOperation: | |
| | | * @any: inheritance structure | |
| | | * @operator_type: | |
| | | * @operands: list of #GdaSqlExpr operands | |
| | | * | |
| | | * This structure represents an operation between one or more operands. | |
| | | */ | |
| struct _GdaSqlOperation { | | struct _GdaSqlOperation { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| GdaSqlOperatorType operator_type; | | GdaSqlOperatorType operator_type; | |
| GSList *operands; | | GSList *operands; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| }; | | }; | |
| | | | |
| skipping to change at line 239 | | skipping to change at line 304 | |
| GdaSqlOperation *gda_sql_operation_new (GdaSqlAnyPart *parent); | | GdaSqlOperation *gda_sql_operation_new (GdaSqlAnyPart *parent); | |
| void gda_sql_operation_free (GdaSqlOperation *operat
ion); | | void gda_sql_operation_free (GdaSqlOperation *operat
ion); | |
| GdaSqlOperation *gda_sql_operation_copy (GdaSqlOperation *operat
ion); | | GdaSqlOperation *gda_sql_operation_copy (GdaSqlOperation *operat
ion); | |
| gchar *gda_sql_operation_serialize (GdaSqlOperation *operat
ion); | | gchar *gda_sql_operation_serialize (GdaSqlOperation *operat
ion); | |
| const gchar *gda_sql_operation_operator_to_string (GdaSqlOperatorType
op); | | const gchar *gda_sql_operation_operator_to_string (GdaSqlOperatorType
op); | |
| GdaSqlOperatorType gda_sql_operation_operator_from_string (const gchar *
op); | | GdaSqlOperatorType gda_sql_operation_operator_from_string (const gchar *
op); | |
| | | | |
| /* | | /* | |
| * A CASE expression | | * A CASE expression | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlCase: | |
| | | * @any: inheritance structure | |
| | | * @base_expr: expression to test | |
| | | * @when_expr_list: list of #GdaSqlExpr, one for each WHEN clause | |
| | | * @then_expr_list: list of #GdaSqlExpr, one for each THEN clause | |
| | | * @else_expr: default expression for the CASE | |
| | | * | |
| | | * This structure represents a CASE WHEN... construct | |
| | | */ | |
| struct _GdaSqlCase | | struct _GdaSqlCase | |
| { | | { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| GdaSqlExpr *base_expr; | | GdaSqlExpr *base_expr; | |
| GSList *when_expr_list; | | GSList *when_expr_list; | |
| GSList *then_expr_list; | | GSList *then_expr_list; | |
| GdaSqlExpr *else_expr; | | GdaSqlExpr *else_expr; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| | | | |
| skipping to change at line 261 | | skipping to change at line 336 | |
| }; | | }; | |
| | | | |
| GdaSqlCase *gda_sql_case_new (GdaSqlAnyPart *parent); | | GdaSqlCase *gda_sql_case_new (GdaSqlAnyPart *parent); | |
| void gda_sql_case_free (GdaSqlCase *sc); | | void gda_sql_case_free (GdaSqlCase *sc); | |
| GdaSqlCase *gda_sql_case_copy (GdaSqlCase *sc); | | GdaSqlCase *gda_sql_case_copy (GdaSqlCase *sc); | |
| gchar *gda_sql_case_serialize (GdaSqlCase *sc); | | gchar *gda_sql_case_serialize (GdaSqlCase *sc); | |
| | | | |
| /* | | /* | |
| * Any expression in a SELECT ... before the FROM clause | | * Any expression in a SELECT ... before the FROM clause | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlSelectField: | |
| | | * @any: inheritance structure | |
| | | * @expr: expression | |
| | | * @field_name: field name part of @expr if @expr represents a field | |
| | | * @table_name: table name part of @expr if @expr represents a field | |
| | | * @as: alias | |
| | | * @validity_meta_object: | |
| | | * @validity_meta_table_column: | |
| | | * | |
| | | * This structure represents a selected item in a SELECT statement (when ex | |
| | | ecuted, the returned data set | |
| | | * will have one column per selected item). Note that the @table_name and | |
| | | * @field_name field parts <emphasis>will be</emphasis> overwritten by &LIB | |
| | | GDA;, | |
| | | * set the value of @expr->value instead. | |
| | | */ | |
| struct _GdaSqlSelectField | | struct _GdaSqlSelectField | |
| { | | { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| GdaSqlExpr *expr; | | GdaSqlExpr *expr; | |
| gchar *field_name; /* may be NULL if expr does not refe
r to a table.field, can also be "*" */ | | gchar *field_name; /* may be NULL if expr does not refe
r to a table.field, can also be "*" */ | |
| gchar *table_name; /* may be NULL if expr does not refe
r to a table.field */ | | gchar *table_name; /* may be NULL if expr does not refe
r to a table.field */ | |
| gchar *as; | | gchar *as; | |
| | | | |
| /* validity check with a connection */ | | /* validity check with a connection */ | |
| GdaMetaDbObject *validity_meta_object; | | GdaMetaDbObject *validity_meta_object; | |
| | | | |
| skipping to change at line 292 | | skipping to change at line 382 | |
| gchar *gda_sql_select_field_serialize (GdaSqlSelectField *
field); | | gchar *gda_sql_select_field_serialize (GdaSqlSelectField *
field); | |
| void _gda_sql_select_field_check_clean (GdaSqlSelectField *
field); | | void _gda_sql_select_field_check_clean (GdaSqlSelectField *
field); | |
| | | | |
| void gda_sql_select_field_take_star_value(GdaSqlSelectField *
field, GValue *value); | | void gda_sql_select_field_take_star_value(GdaSqlSelectField *
field, GValue *value); | |
| void gda_sql_select_field_take_expr (GdaSqlSelectField *
field, GdaSqlExpr *expr); | | void gda_sql_select_field_take_expr (GdaSqlSelectField *
field, GdaSqlExpr *expr); | |
| void gda_sql_select_field_take_alias (GdaSqlSelectField *
field, GValue *alias); | | void gda_sql_select_field_take_alias (GdaSqlSelectField *
field, GValue *alias); | |
| | | | |
| /* | | /* | |
| * Any TARGET ... in a SELECT statement | | * Any TARGET ... in a SELECT statement | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlSelectTarget: | |
| | | * @any: inheritance structure | |
| | | * @expr: expression | |
| | | * @table_name: table name part of @expr if @expr represents a table | |
| | | * @as: alias | |
| | | * @validity_meta_object: | |
| | | * | |
| | | * This structure represents a target used to fetch data from in a SELECT s | |
| | | tatement; it can represent a table or | |
| | | * a sub select. Note that the @table_name | |
| | | * part <emphasis>will be</emphasis> overwritten by &LIBGDA;, | |
| | | * set the value of @expr->value instead. | |
| | | */ | |
| struct _GdaSqlSelectTarget | | struct _GdaSqlSelectTarget | |
| { | | { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| GdaSqlExpr *expr; | | GdaSqlExpr *expr; | |
| gchar *table_name; /* may be NULL if expr does not refe
r to a table */ | | gchar *table_name; /* may be NULL if expr does not refe
r to a table */ | |
| gchar *as; | | gchar *as; | |
| | | | |
| /* validity check with a connection */ | | /* validity check with a connection */ | |
| GdaMetaDbObject *validity_meta_object; | | GdaMetaDbObject *validity_meta_object; | |
| | | | |
| | | | |
| skipping to change at line 321 | | skipping to change at line 424 | |
| gchar *gda_sql_select_target_serialize (GdaSqlSelectTarge
t *target); | | gchar *gda_sql_select_target_serialize (GdaSqlSelectTarge
t *target); | |
| void _gda_sql_select_target_check_clean (GdaSqlSelectTarge
t *target); | | void _gda_sql_select_target_check_clean (GdaSqlSelectTarge
t *target); | |
| | | | |
| void gda_sql_select_target_take_table_name (GdaSqlSelectTarg
et *target, GValue *value); | | void gda_sql_select_target_take_table_name (GdaSqlSelectTarg
et *target, GValue *value); | |
| void gda_sql_select_target_take_select (GdaSqlSelectTarget *
target, GdaSqlStatement *stmt); | | void gda_sql_select_target_take_select (GdaSqlSelectTarget *
target, GdaSqlStatement *stmt); | |
| void gda_sql_select_target_take_alias (GdaSqlSelectTarget *t
arget, GValue *alias); | | void gda_sql_select_target_take_alias (GdaSqlSelectTarget *t
arget, GValue *alias); | |
| | | | |
| /* | | /* | |
| * Any JOIN ... in a SELECT statement | | * Any JOIN ... in a SELECT statement | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlSelectJoinType: | |
| | | * @GDA_SQL_SELECT_JOIN_CROSS: | |
| | | * @GDA_SQL_SELECT_JOIN_NATURAL: | |
| | | * @GDA_SQL_SELECT_JOIN_INNER: | |
| | | * @GDA_SQL_SELECT_JOIN_LEFT: | |
| | | * @GDA_SQL_SELECT_JOIN_RIGHT: | |
| | | * @GDA_SQL_SELECT_JOIN_FULL: | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_SQL_SELECT_JOIN_CROSS, | | GDA_SQL_SELECT_JOIN_CROSS, | |
| GDA_SQL_SELECT_JOIN_NATURAL, | | GDA_SQL_SELECT_JOIN_NATURAL, | |
| GDA_SQL_SELECT_JOIN_INNER, | | GDA_SQL_SELECT_JOIN_INNER, | |
| GDA_SQL_SELECT_JOIN_LEFT, | | GDA_SQL_SELECT_JOIN_LEFT, | |
| GDA_SQL_SELECT_JOIN_RIGHT, | | GDA_SQL_SELECT_JOIN_RIGHT, | |
| GDA_SQL_SELECT_JOIN_FULL | | GDA_SQL_SELECT_JOIN_FULL | |
| } GdaSqlSelectJoinType; | | } GdaSqlSelectJoinType; | |
|
| | | | |
| | | /** | |
| | | * GdaSqlSelectJoin: | |
| | | * @any: inheritance structure | |
| | | * @type: type of join | |
| | | * @position: represents a join between a target at (pos < @position) an | |
| | | d the one at @position | |
| | | * @expr: joining expression, or %NULL | |
| | | * @use: list of #GdaSqlField pointers to use when joining, or %NULL | |
| | | * | |
| | | * This structure represents a join between two targets in a SELECT stateme | |
| | | nt. | |
| | | */ | |
| struct _GdaSqlSelectJoin | | struct _GdaSqlSelectJoin | |
| { | | { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| GdaSqlSelectJoinType type; | | GdaSqlSelectJoinType type; | |
| gint position; /* between a target at (pos < @posit
ion) and the one @position */ | | gint position; /* between a target at (pos < @posit
ion) and the one @position */ | |
| GdaSqlExpr *expr; | | GdaSqlExpr *expr; | |
| GSList *use; /* list of GdaSqlField pointers */ | | GSList *use; /* list of GdaSqlField pointers */ | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| | | | |
| skipping to change at line 353 | | skipping to change at line 476 | |
| GdaSqlSelectJoin *gda_sql_select_join_new (GdaSqlAnyPart *paren
t); | | GdaSqlSelectJoin *gda_sql_select_join_new (GdaSqlAnyPart *paren
t); | |
| void gda_sql_select_join_free (GdaSqlSelectJoin *jo
in); | | void gda_sql_select_join_free (GdaSqlSelectJoin *jo
in); | |
| GdaSqlSelectJoin *gda_sql_select_join_copy (GdaSqlSelectJoin *jo
in); | | GdaSqlSelectJoin *gda_sql_select_join_copy (GdaSqlSelectJoin *jo
in); | |
| gchar *gda_sql_select_join_serialize (GdaSqlSelectJoin *jo
in); | | gchar *gda_sql_select_join_serialize (GdaSqlSelectJoin *jo
in); | |
| | | | |
| const gchar *gda_sql_select_join_type_to_string (GdaSqlSelectJoinType
type); | | const gchar *gda_sql_select_join_type_to_string (GdaSqlSelectJoinType
type); | |
| | | | |
| /* | | /* | |
| * Any FROM ... in a SELECT statement | | * Any FROM ... in a SELECT statement | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlSelectFrom: | |
| | | * @any: inheritance structure | |
| | | * @targets: list of #GdaSqlSelectTarget | |
| | | * @joins: list of #GdaSqlSelectJoin | |
| | | * | |
| | | * This structure represents the FROM clause of a SELECT statement, it list | |
| | | s targets and joins | |
| | | */ | |
| struct _GdaSqlSelectFrom | | struct _GdaSqlSelectFrom | |
| { | | { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| GSList *targets; | | GSList *targets; | |
| GSList *joins; | | GSList *joins; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| | | | |
| skipping to change at line 376 | | skipping to change at line 507 | |
| void gda_sql_select_from_free (GdaSqlSelectFrom *fr
om); | | void gda_sql_select_from_free (GdaSqlSelectFrom *fr
om); | |
| GdaSqlSelectFrom *gda_sql_select_from_copy (GdaSqlSelectFrom *fr
om); | | GdaSqlSelectFrom *gda_sql_select_from_copy (GdaSqlSelectFrom *fr
om); | |
| gchar *gda_sql_select_from_serialize (GdaSqlSelectFrom *fr
om); | | gchar *gda_sql_select_from_serialize (GdaSqlSelectFrom *fr
om); | |
| | | | |
| void gda_sql_select_from_take_new_target(GdaSqlSelectFrom *fr
om, GdaSqlSelectTarget *target); | | void gda_sql_select_from_take_new_target(GdaSqlSelectFrom *fr
om, GdaSqlSelectTarget *target); | |
| void gda_sql_select_from_take_new_join (GdaSqlSelectFrom *fr
om, GdaSqlSelectJoin *join); | | void gda_sql_select_from_take_new_join (GdaSqlSelectFrom *fr
om, GdaSqlSelectJoin *join); | |
| | | | |
| /* | | /* | |
| * Any expression in a SELECT ... after the ORDER BY | | * Any expression in a SELECT ... after the ORDER BY | |
| */ | | */ | |
|
| | | /** | |
| | | * GdaSqlSelectOrder: | |
| | | * @any: inheritance structure | |
| | | * @expr: expression to order on | |
| | | * @asc: TRUE is ordering is ascending | |
| | | * @collation_name: name of the collation to use for ordering | |
| | | * | |
| | | * This structure represents the ordering of a SELECT statement. | |
| | | */ | |
| struct _GdaSqlSelectOrder | | struct _GdaSqlSelectOrder | |
| { | | { | |
| GdaSqlAnyPart any; | | GdaSqlAnyPart any; | |
| GdaSqlExpr *expr; | | GdaSqlExpr *expr; | |
| gboolean asc; | | gboolean asc; | |
| gchar *collation_name; | | gchar *collation_name; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| | | | |
End of changes. 12 change blocks. |
| 0 lines changed or deleted | | 148 lines changed or added | |
|
| gda-statement.h | | gda-statement.h | |
|
| /* gda-statement.h | | /* | |
| * | | * Copyright (C) 2007 - 2011 Vivien Malerba | |
| * Copyright (C) 2007 - 2009 Vivien Malerba | | | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 37 | |
| | | | |
| #define GDA_TYPE_STATEMENT (gda_statement_get_type()) | | #define GDA_TYPE_STATEMENT (gda_statement_get_type()) | |
| #define GDA_STATEMENT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gda_st
atement_get_type(), GdaStatement) | | #define GDA_STATEMENT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gda_st
atement_get_type(), GdaStatement) | |
| #define GDA_STATEMENT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gda_sta
tement_get_type (), GdaStatementClass) | | #define GDA_STATEMENT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gda_sta
tement_get_type (), GdaStatementClass) | |
| #define GDA_IS_STATEMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gda_st
atement_get_type ()) | | #define GDA_IS_STATEMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gda_st
atement_get_type ()) | |
| | | | |
| /* error reporting */ | | /* error reporting */ | |
| extern GQuark gda_statement_error_quark (void); | | extern GQuark gda_statement_error_quark (void); | |
| #define GDA_STATEMENT_ERROR gda_statement_error_quark () | | #define GDA_STATEMENT_ERROR gda_statement_error_quark () | |
| | | | |
|
| | | /** | |
| | | * GdaStatementError: | |
| | | * @GDA_STATEMENT_PARSE_ERROR: | |
| | | * @GDA_STATEMENT_SYNTAX_ERROR: | |
| | | * @GDA_STATEMENT_NO_CNC_ERROR: | |
| | | * @GDA_STATEMENT_CNC_CLOSED_ERROR: | |
| | | * @GDA_STATEMENT_EXEC_ERROR: | |
| | | * @GDA_STATEMENT_PARAM_TYPE_ERROR: | |
| | | * @GDA_STATEMENT_PARAM_ERROR: | |
| | | */ | |
| typedef enum | | typedef enum | |
| { | | { | |
| GDA_STATEMENT_PARSE_ERROR, | | GDA_STATEMENT_PARSE_ERROR, | |
| GDA_STATEMENT_SYNTAX_ERROR, | | GDA_STATEMENT_SYNTAX_ERROR, | |
| GDA_STATEMENT_NO_CNC_ERROR, | | GDA_STATEMENT_NO_CNC_ERROR, | |
| GDA_STATEMENT_CNC_CLOSED_ERROR, | | GDA_STATEMENT_CNC_CLOSED_ERROR, | |
| GDA_STATEMENT_EXEC_ERROR, | | GDA_STATEMENT_EXEC_ERROR, | |
| GDA_STATEMENT_PARAM_TYPE_ERROR, | | GDA_STATEMENT_PARAM_TYPE_ERROR, | |
| GDA_STATEMENT_PARAM_ERROR | | GDA_STATEMENT_PARAM_ERROR | |
| } GdaStatementError; | | } GdaStatementError; | |
| | | | |
|
| | | /** | |
| | | * GdaStatementModelUsage: | |
| | | * @GDA_STATEMENT_MODEL_RANDOM_ACCESS: access to the data model will be ran | |
| | | dom (usually this will result in a data model completely stored in memory) | |
| | | * @GDA_STATEMENT_MODEL_CURSOR_FORWARD: access to the data model will be do | |
| | | ne using a cursor moving forward | |
| | | * @GDA_STATEMENT_MODEL_CURSOR_BACKWARD: access to the data model will be d | |
| | | one using a cursor moving backward | |
| | | * @GDA_STATEMENT_MODEL_CURSOR: access to the data model will be done using | |
| | | a cursor (moving both forward and backward) | |
| | | * @GDA_STATEMENT_MODEL_ALLOW_NOPARAM: specifies that the data model should | |
| | | be executed even if some parameters required to execute it are invalid (in | |
| | | this case the data model will have no row, and will automatically be re-ru | |
| | | n when the missing parameters are once again valid) | |
| | | * | |
| | | * These flags specify how the #GdaDataModel returned when executing a #Gda | |
| | | Statement will be used | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_STATEMENT_MODEL_RANDOM_ACCESS = 1 << 0, | | GDA_STATEMENT_MODEL_RANDOM_ACCESS = 1 << 0, | |
| GDA_STATEMENT_MODEL_CURSOR_FORWARD = 1 << 1, | | GDA_STATEMENT_MODEL_CURSOR_FORWARD = 1 << 1, | |
| GDA_STATEMENT_MODEL_CURSOR_BACKWARD = 1 << 2, | | GDA_STATEMENT_MODEL_CURSOR_BACKWARD = 1 << 2, | |
| GDA_STATEMENT_MODEL_CURSOR = GDA_STATEMENT_MODEL_CURSOR_FOR
WARD | GDA_STATEMENT_MODEL_CURSOR_BACKWARD, | | GDA_STATEMENT_MODEL_CURSOR = GDA_STATEMENT_MODEL_CURSOR_FOR
WARD | GDA_STATEMENT_MODEL_CURSOR_BACKWARD, | |
| GDA_STATEMENT_MODEL_ALLOW_NOPARAM = 1 << 3 | | GDA_STATEMENT_MODEL_ALLOW_NOPARAM = 1 << 3 | |
| } GdaStatementModelUsage; | | } GdaStatementModelUsage; | |
| | | | |
|
| | | /** | |
| | | * GdaStatementSqlFlag: | |
| | | * @GDA_STATEMENT_SQL_PARAMS_AS_VALUES: rendering will replace parameters w | |
| | | ith their values | |
| | | * @GDA_STATEMENT_SQL_PRETTY: rendering will include newlines and indentati | |
| | | on to make it easy to read | |
| | | * @GDA_STATEMENT_SQL_PARAMS_LONG: parameters will be rendered using the "/ | |
| | | * name:<param_name> ... */" syntax | |
| | | * @GDA_STATEMENT_SQL_PARAMS_SHORT: parameters will be rendered using the " | |
| | | ##<param_name>..." syntax | |
| | | * @GDA_STATEMENT_SQL_PARAMS_AS_COLON: parameters will be rendered using th | |
| | | e ":<param_name>" syntax | |
| | | * @GDA_STATEMENT_SQL_PARAMS_AS_DOLLAR: parameters will be rendered using t | |
| | | he "$<param_number>" syntax where parameters are numbered starting fr | |
| | | om 1 | |
| | | * @GDA_STATEMENT_SQL_PARAMS_AS_QMARK: parameters will be rendered using th | |
| | | e "?<param_number>" syntax where parameters are numbered starting fro | |
| | | m 1 | |
| | | * @GDA_STATEMENT_SQL_PARAMS_AS_UQMARK: parameters will be rendered using t | |
| | | he "?" syntax | |
| | | * | |
| | | * Specifies rendering options | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_STATEMENT_SQL_PARAMS_AS_VALUES = 0, | | GDA_STATEMENT_SQL_PARAMS_AS_VALUES = 0, | |
| GDA_STATEMENT_SQL_PRETTY = 1 << 0, | | GDA_STATEMENT_SQL_PRETTY = 1 << 0, | |
| GDA_STATEMENT_SQL_PARAMS_LONG = 1 << 1, | | GDA_STATEMENT_SQL_PARAMS_LONG = 1 << 1, | |
| GDA_STATEMENT_SQL_PARAMS_SHORT = 1 << 2, | | GDA_STATEMENT_SQL_PARAMS_SHORT = 1 << 2, | |
| GDA_STATEMENT_SQL_PARAMS_AS_COLON = 1 << 3, | | GDA_STATEMENT_SQL_PARAMS_AS_COLON = 1 << 3, | |
| GDA_STATEMENT_SQL_PARAMS_AS_DOLLAR = 1 << 4, | | GDA_STATEMENT_SQL_PARAMS_AS_DOLLAR = 1 << 4, | |
| GDA_STATEMENT_SQL_PARAMS_AS_QMARK = 1 << 5, | | GDA_STATEMENT_SQL_PARAMS_AS_QMARK = 1 << 5, | |
| GDA_STATEMENT_SQL_PARAMS_AS_UQMARK = 1 << 6 | | GDA_STATEMENT_SQL_PARAMS_AS_UQMARK = 1 << 6 | |
| } GdaStatementSqlFlag; | | } GdaStatementSqlFlag; | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 116 | |
| | | | |
| /* struct for the object's class */ | | /* struct for the object's class */ | |
| struct _GdaStatementClass | | struct _GdaStatementClass | |
| { | | { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /* signals */ | | /* signals */ | |
| void (*checked) (GdaStatement *stmt, GdaConnection *cnc, gboolea
n checked); | | void (*checked) (GdaStatement *stmt, GdaConnection *cnc, gboolea
n checked); | |
| void (*reset) (GdaStatement *stmt); | | void (*reset) (GdaStatement *stmt); | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-statement | |
| | | * @short_description: Single SQL statement | |
| | | * @title: GdaStatement | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaBatch | |
| | | * | |
| | | * The #GdaStatement represents a single SQL statement (multiple statements | |
| | | can be grouped in a #GdaBatch object). | |
| | | * | |
| | | * A #GdaStatement can either be built by describing its constituing parts | |
| | | using a #GdaSqlBuilder object, | |
| | | * or from an SQL statement using a #GdaSqlParser object. | |
| | | * | |
| | | * A #GdaConnection can use a #GdaStatement to: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>prepare it for a future execution, the preparation st | |
| | | ep involves converting the #GdaStatement | |
| | | * object into a structure used by the database's own API, see gda_conn | |
| | | ection_statement_prepare()</para></listitem> | |
| | | * <listitem><para>execute it using gda_connection_statement_execute_sel | |
| | | ect() if it is known that the statement is a | |
| | | * selection statement, gda_connection_statement_execute_non_select() i | |
| | | f it is not a selection statement, or | |
| | | * gda_connection_statement_execute() when the type of expected result | |
| | | is unknown.</para></listitem> | |
| | | * </itemizedlist> | |
| | | * Note that it is possible to use the same #GdaStatement object at the sa | |
| | | me time with several #GdaConnection objects. | |
| | | */ | |
| | | | |
| GType gda_statement_get_type (void) G_GNUC_CONS
T; | | GType gda_statement_get_type (void) G_GNUC_CONS
T; | |
| GdaStatement *gda_statement_new (void); | | GdaStatement *gda_statement_new (void); | |
| GdaStatement *gda_statement_copy (GdaStatement *ori
g); | | GdaStatement *gda_statement_copy (GdaStatement *ori
g); | |
| | | | |
| gchar *gda_statement_serialize (GdaStatement *stm
t); | | gchar *gda_statement_serialize (GdaStatement *stm
t); | |
| | | | |
| gboolean gda_statement_get_parameters (GdaStatement *stm
t, GdaSet **out_params, GError **error); | | gboolean gda_statement_get_parameters (GdaStatement *stm
t, GdaSet **out_params, GError **error); | |
| #define gda_statement_to_sql(stmt,params,error) gda_statement_t
o_sql_extended ((stmt), NULL, (params), GDA_STATEMENT_SQL_PARAMS_SHORT, NUL
L, (error)) | | #define gda_statement_to_sql(stmt,params,error) gda_statement_t
o_sql_extended ((stmt), NULL, (params), GDA_STATEMENT_SQL_PARAMS_SHORT, NUL
L, (error)) | |
| gchar *gda_statement_to_sql_extended (GdaStatement *stm
t, GdaConnection *cnc, | | gchar *gda_statement_to_sql_extended (GdaStatement *stm
t, GdaConnection *cnc, | |
| GdaSet *params, Gd
aStatementSqlFlag flags, | | GdaSet *params, Gd
aStatementSqlFlag flags, | |
| | | | |
End of changes. 6 change blocks. |
| 3 lines changed or deleted | | 85 lines changed or added | |
|
| gda-thread-wrapper.h | | gda-thread-wrapper.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 2009 The GNOME Foundation. | | * Copyright (C) 2009 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| GObjectClass object_class; | | GObjectClass object_class; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * GdaThreadWrapperFunc: | |
| | | * @arg: pointer to the data (which is the @arg argument passed to gda_thre | |
| | | ad_wrapper_execute_void()) | |
| | | * @error: a place to store errors | |
| | | * @Returns: a pointer to some data which will be returned by gda_thread_wr | |
| | | apper_fetch_result() | |
| | | * | |
| | | * Specifies the type of function to be passed to gda_thread_wrapper_execut | |
| | | e(). | |
| | | */ | |
| typedef gpointer (*GdaThreadWrapperFunc) (gpointer arg, GError **error); | | typedef gpointer (*GdaThreadWrapperFunc) (gpointer arg, GError **error); | |
|
| | | | |
| | | /** | |
| | | * GdaThreadWrapperVoidFunc: | |
| | | * @arg: a pointer to the data (which is the @arg argument passed to gda_th | |
| | | read_wrapper_execute_void()) | |
| | | * @error: a place to store errors | |
| | | * | |
| | | * Specifies the type of function to be passed to gda_thread_wrapper_execut | |
| | | e_void(). | |
| | | */ | |
| typedef void (*GdaThreadWrapperVoidFunc) (gpointer arg, GError **error); | | typedef void (*GdaThreadWrapperVoidFunc) (gpointer arg, GError **error); | |
|
| | | | |
| | | /** | |
| | | * GdaThreadWrapperCallback: | |
| | | * @wrapper: the #GdaThreadWrapper | |
| | | * @instance: a pointer to the instance which emitted the signal | |
| | | * @signame: the name of the signal being emitted | |
| | | * @n_param_values: number of GValue in @param_values | |
| | | * @param_values: array of @n_param_values GValue | |
| | | * @gda_reserved: reserved | |
| | | * @data: a pointer to the data (which is the @data argument passed to gda_ | |
| | | thread_wrapper_connect_raw()) | |
| | | * | |
| | | * Specifies the type of function to be passed to gda_thread_wrapper_connec | |
| | | t_raw() | |
| | | */ | |
| typedef void (*GdaThreadWrapperCallback) (GdaThreadWrapper *wrapper, gpoint
er instance, const gchar *signame, | | typedef void (*GdaThreadWrapperCallback) (GdaThreadWrapper *wrapper, gpoint
er instance, const gchar *signame, | |
| gint n_param_values, const GValue
*param_values, gpointer gda_reserved, | | gint n_param_values, const GValue
*param_values, gpointer gda_reserved, | |
| gpointer data); | | gpointer data); | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-thread-wrapper | |
| | | * @short_description: Execute functions in a sub thread | |
| | | * @title: GdaThreadWrapper | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * The purpose of the #GdaThreadWrapper object is to execute functions in a | |
| | | n isolated sub thread. As the | |
| | | * #GdaThreadWrapper is thread safe, one is able to isolate some code's exe | |
| | | cution is a <emphasis>private</emphasis> | |
| | | * <emphasis>worker</emphasis> thread, and make a non thread safe code thre | |
| | | ad safe. | |
| | | * | |
| | | * The downside of this is that the actual execution of the code will be sl | |
| | | ower as it requires | |
| | | * threads to be synchronized. | |
| | | * | |
| | | * The #GdaThreadWrapper implements its own locking mechanism and can safel | |
| | | y be used from multiple | |
| | | * threads at once without needing further locking. | |
| | | * | |
| | | * Each thread using a #GdaThreadWrapper object can use it as if it was the | |
| | | only user: the #GdaThreadWrapper will | |
| | | * simply dispatch all the execution requests to its private <emphasis>work | |
| | | er</emphasis> thread and report the | |
| | | * execution's status only to the thread which made the request. | |
| | | * | |
| | | * The user can also specify a callback function to be called when an objec | |
| | | t exmits a signal while being | |
| | | * used by the worker thread, see the gda_thread_wrapper_connect_raw() meth | |
| | | od. | |
| | | * | |
| | | * The following diagram illustrates the conceptual working of the #GdaThre | |
| | | adWrapper object: here two user threads | |
| | | * are represented (assigned a red and green colors), both using a single # | |
| | | GdaThreadWrapper, so in this diagram, 3 threads | |
| | | * are present. The communication between the threads are handled by some # | |
| | | GAsyncQueue objects (in a transparent way for | |
| | | * the user, presented here only for illustration purposes). The queue repr | |
| | | esented in yellow is where jobs are | |
| | | * pushed by each user thread (step 1), and popped by the worker thread (st | |
| | | ep 2). Once the user thread has finished | |
| | | * with a job, it stores the result along with the job and pushes it to the | |
| | | queue dedicated to the user thread | |
| | | * (step 3) in this example the red queue (because the job was issued from | |
| | | the thread represented in red). The last | |
| | | * step is when the user fetches the result (in its user thread), step 4. | |
| | | * | |
| | | * If, when the worker thread is busy with a job, a signal is emitted, and | |
| | | if the user has set up a signal handler | |
| | | * using gda_thread_wrapper_connect_raw(), | |
| | | * then a "job as signal" is created by the worker thread and pushed to the | |
| | | user thread as illustrated | |
| | | * at the bottom of the diagram. | |
| | | * <mediaobject> | |
| | | * <imageobject role="html"> | |
| | | * <imagedata fileref="thread-wrapper.png" format="PNG" contentwidth="1 | |
| | | 70mm"/> | |
| | | * </imageobject> | |
| | | * <textobject> | |
| | | * <phrase>GdaThreadWrapper's conceptual working</phrase> | |
| | | * </textobject> | |
| | | * </mediaobject> | |
| | | */ | |
| | | | |
| GType gda_thread_wrapper_get_type (void) G_GNUC_C
ONST; | | GType gda_thread_wrapper_get_type (void) G_GNUC_C
ONST; | |
| GdaThreadWrapper *gda_thread_wrapper_new (void); | | GdaThreadWrapper *gda_thread_wrapper_new (void); | |
| | | | |
| guint gda_thread_wrapper_execute (GdaThreadWrapp
er *wrapper, GdaThreadWrapperFunc func, | | guint gda_thread_wrapper_execute (GdaThreadWrapp
er *wrapper, GdaThreadWrapperFunc func, | |
| gpointer arg, G
DestroyNotify arg_destroy_func, GError **error); | | gpointer arg, G
DestroyNotify arg_destroy_func, GError **error); | |
| guint gda_thread_wrapper_execute_void (GdaThreadWrapp
er *wrapper, GdaThreadWrapperVoidFunc func, | | guint gda_thread_wrapper_execute_void (GdaThreadWrapp
er *wrapper, GdaThreadWrapperVoidFunc func, | |
| gpointer arg, G
DestroyNotify arg_destroy_func, GError **error); | | gpointer arg, G
DestroyNotify arg_destroy_func, GError **error); | |
| gboolean gda_thread_wrapper_cancel (GdaThreadWrapp
er *wrapper, guint id); | | gboolean gda_thread_wrapper_cancel (GdaThreadWrapp
er *wrapper, guint id); | |
| void gda_thread_wrapper_iterate (GdaThreadWrapp
er *wrapper, gboolean may_block); | | void gda_thread_wrapper_iterate (GdaThreadWrapp
er *wrapper, gboolean may_block); | |
| gpointer gda_thread_wrapper_fetch_result (GdaThreadWrapp
er *wrapper, gboolean may_lock, | | gpointer gda_thread_wrapper_fetch_result (GdaThreadWrapp
er *wrapper, gboolean may_lock, | |
| | | | |
End of changes. 5 change blocks. |
| 2 lines changed or deleted | | 104 lines changed or added | |
|
| gda-transaction-status.h | | gda-transaction-status.h | |
|
| /* GDA client library | | /* | |
| * Copyright (C) 1998 - 2006 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Michael Lausch <michael@lausch.at> | | * Michael Lausch <michael@lausch.at> | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| #define GDA_TYPE_TRANSACTION_STATUS (gda_transaction_status_get_
type()) | | #define GDA_TYPE_TRANSACTION_STATUS (gda_transaction_status_get_
type()) | |
| #define GDA_TRANSACTION_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST
(obj, GDA_TYPE_TRANSACTION_STATUS, GdaTransactionStatus)) | | #define GDA_TRANSACTION_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST
(obj, GDA_TYPE_TRANSACTION_STATUS, GdaTransactionStatus)) | |
| #define GDA_TRANSACTION_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (kl
ass, GDA_TYPE_TRANSACTION_STATUS, GdaTransactionStatusClass)) | | #define GDA_TRANSACTION_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (kl
ass, GDA_TYPE_TRANSACTION_STATUS, GdaTransactionStatusClass)) | |
| #define GDA_IS_TRANSACTION_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE(
obj, GDA_TYPE_TRANSACTION_STATUS)) | | #define GDA_IS_TRANSACTION_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE(
obj, GDA_TYPE_TRANSACTION_STATUS)) | |
| #define GDA_IS_TRANSACTION_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((kl
ass), GDA_TYPE_TRANSACTION_STATUS)) | | #define GDA_IS_TRANSACTION_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((kl
ass), GDA_TYPE_TRANSACTION_STATUS)) | |
| | | | |
| typedef struct _GdaTransactionStatus GdaTransactionStatus; | | typedef struct _GdaTransactionStatus GdaTransactionStatus; | |
| typedef struct _GdaTransactionStatusClass GdaTransactionStatusClass; | | typedef struct _GdaTransactionStatusClass GdaTransactionStatusClass; | |
| typedef struct _GdaTransactionStatusEvent GdaTransactionStatusEvent; | | typedef struct _GdaTransactionStatusEvent GdaTransactionStatusEvent; | |
| | | | |
|
| | | /** | |
| | | * GdaTransactionStatusEventType: | |
| | | * @GDA_TRANSACTION_STATUS_EVENT_SAVEPOINT: | |
| | | * @GDA_TRANSACTION_STATUS_EVENT_SQL: | |
| | | * @GDA_TRANSACTION_STATUS_EVENT_SUB_TRANSACTION: | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_TRANSACTION_STATUS_EVENT_SAVEPOINT, | | GDA_TRANSACTION_STATUS_EVENT_SAVEPOINT, | |
| GDA_TRANSACTION_STATUS_EVENT_SQL, | | GDA_TRANSACTION_STATUS_EVENT_SQL, | |
| GDA_TRANSACTION_STATUS_EVENT_SUB_TRANSACTION | | GDA_TRANSACTION_STATUS_EVENT_SUB_TRANSACTION | |
| } GdaTransactionStatusEventType; | | } GdaTransactionStatusEventType; | |
| | | | |
|
| | | /** | |
| | | * GdaTransactionStatusState: | |
| | | * @GDA_TRANSACTION_STATUS_STATE_OK: | |
| | | * @GDA_TRANSACTION_STATUS_STATE_FAILED: | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| GDA_TRANSACTION_STATUS_STATE_OK, | | GDA_TRANSACTION_STATUS_STATE_OK, | |
| GDA_TRANSACTION_STATUS_STATE_FAILED | | GDA_TRANSACTION_STATUS_STATE_FAILED | |
| } GdaTransactionStatusState; | | } GdaTransactionStatusState; | |
| | | | |
|
| | | /** | |
| | | * GdaTransactionStatusEvent: | |
| | | * @trans: | |
| | | * @type: | |
| | | * @conn_event: | |
| | | */ | |
| struct _GdaTransactionStatusEvent { | | struct _GdaTransactionStatusEvent { | |
| GdaTransactionStatus *trans; | | GdaTransactionStatus *trans; | |
| GdaTransactionStatusEventType type; | | GdaTransactionStatusEventType type; | |
| union { | | union { | |
| gchar *svp_name; /* save point name if this e
vent corresponds to a new save point */ | | gchar *svp_name; /* save point name if this e
vent corresponds to a new save point */ | |
| gchar *sql; /* SQL to store SQL queries
in transactions */ | | gchar *sql; /* SQL to store SQL queries
in transactions */ | |
| GdaTransactionStatus *sub_trans;/* sub transaction event */ | | GdaTransactionStatus *sub_trans;/* sub transaction event */ | |
| } pl; | | } pl; | |
| GdaConnectionEvent *conn_event; | | GdaConnectionEvent *conn_event; | |
| | | | |
|
| | | /*< private >*/ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| }; | | }; | |
| | | | |
| struct _GdaTransactionStatus { | | struct _GdaTransactionStatus { | |
| GObject object; | | GObject object; | |
| | | | |
| gchar *name; | | gchar *name; | |
| GdaTransactionIsolation isolation_level; | | GdaTransactionIsolation isolation_level; | |
| GdaTransactionStatusState state; | | GdaTransactionStatusState state; | |
| GList *events; | | GList *events; | |
| | | | |
|
| | | /*< private >*/ | |
| gpointer _gda_reserved1; | | gpointer _gda_reserved1; | |
| gpointer _gda_reserved2; | | gpointer _gda_reserved2; | |
| }; | | }; | |
| | | | |
| struct _GdaTransactionStatusClass { | | struct _GdaTransactionStatusClass { | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-transaction-status | |
| | | * @short_description: Keeps track of the transaction status of a connectio | |
| | | n | |
| | | * @title: GdaTransactionStatus | |
| | | * @stability: Stable | |
| | | * @see_also: #GdaConnection | |
| | | * | |
| | | * On any connection (as a #GdaConnection object), if the database provider | |
| | | used by the connection | |
| | | * supports it, transactions may be started, committed or rolledback, or sa | |
| | | vepoints added, removed or rolledback. | |
| | | * These operations can be performed using Libgda's API (such as gda_connec | |
| | | tion_begin_transaction()), or directly | |
| | | * using some SQL on the connection (usually a "BEGIN;" command). The #GdaT | |
| | | ransactionStatus's aim is to | |
| | | * make it easy to keep track of all the commands which have been issued on | |
| | | a connection regarding transactions. | |
| | | * | |
| | | * One #GdaTransactionStatus object is automatically attached to a #GdaConn | |
| | | ection when a transaction is started, and | |
| | | * is destroyed when the transaction is finished. A pointer to this object | |
| | | can be fetched using | |
| | | * gda_connection_get_transaction_status() (beware that it should then not | |
| | | be modified). The end user is not | |
| | | * supposed to instantiate #GdaTransactionStatus objects | |
| | | * | |
| | | * #GdaTransactionStatus's attributes are directly accessible using the pub | |
| | | lic members of the object. | |
| | | */ | |
| | | | |
| GType gda_transaction_status_get_type (void) G_GNUC_CONST; | | GType gda_transaction_status_get_type (void) G_GNUC_CONST; | |
| GdaTransactionStatus *gda_transaction_status_new (const gchar *name); | | GdaTransactionStatus *gda_transaction_status_new (const gchar *name); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 8 change blocks. |
| 2 lines changed or deleted | | 53 lines changed or added | |
|
| gda-tree.h | | gda-tree.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 2009 The GNOME Foundation. | | * Copyright (C) 2009 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 69 | | skipping to change at line 69 | |
| void (* node_deleted) (GdaTree *tree, const gchar
*node_path); | | void (* node_deleted) (GdaTree *tree, const gchar
*node_path); | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-tree | |
| | | * @short_description: A tree-structure | |
| | | * @title: GdaTree | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * The #GdaTree is the top level object representing hierarchically structu | |
| | | red data. From this object it | |
| | | * is also possible (depending on the tree managers it uses), to clean (rem | |
| | | ove all the nodes) the whole tree, | |
| | | * or to request a complete or partial update of the nodes. | |
| | | * | |
| | | * It is also possible to set attributes to the tree itself (as it is possi | |
| | | ble to do for tree nodes), | |
| | | * or to dump the whole or part of a tree in an indented and easy to read f | |
| | | ashion. | |
| | | */ | |
| | | | |
| GType gda_tree_get_type (void) G_GNUC_CONST; | | GType gda_tree_get_type (void) G_GNUC_CONST; | |
| GdaTree* gda_tree_new (void); | | GdaTree* gda_tree_new (void); | |
| void gda_tree_add_manager (GdaTree *tree, GdaTreeManager *m
anager); | | void gda_tree_add_manager (GdaTree *tree, GdaTreeManager *m
anager); | |
| | | | |
| void gda_tree_clean (GdaTree *tree); | | void gda_tree_clean (GdaTree *tree); | |
| gboolean gda_tree_update_all (GdaTree *tree, GError **error); | | gboolean gda_tree_update_all (GdaTree *tree, GError **error); | |
| gboolean gda_tree_update_part (GdaTree *tree, GdaTreeNode *node
, GError **error); | | gboolean gda_tree_update_part (GdaTree *tree, GdaTreeNode *node
, GError **error); | |
|
| | | gboolean gda_tree_update_children (GdaTree *tree, GdaTreeNode *no
de, GError **error); | |
| | | | |
| GSList *gda_tree_get_nodes_in_path (GdaTree *tree, const gchar *
tree_path, gboolean use_names); | | GSList *gda_tree_get_nodes_in_path (GdaTree *tree, const gchar *
tree_path, gboolean use_names); | |
| GdaTreeNode *gda_tree_get_node (GdaTree *tree, const gchar *tree
_path, gboolean use_names); | | GdaTreeNode *gda_tree_get_node (GdaTree *tree, const gchar *tree
_path, gboolean use_names); | |
| gchar *gda_tree_get_node_path (GdaTree *tree, GdaTreeNode *node
); | | gchar *gda_tree_get_node_path (GdaTree *tree, GdaTreeNode *node
); | |
| GdaTreeManager *gda_tree_get_node_manager (GdaTree *tree, GdaTreeNode *n
ode); | | GdaTreeManager *gda_tree_get_node_manager (GdaTree *tree, GdaTreeNode *n
ode); | |
| | | | |
| void gda_tree_set_attribute (GdaTree *tree, const gchar *attr
ibute, const GValue *value, | | void gda_tree_set_attribute (GdaTree *tree, const gchar *attr
ibute, const GValue *value, | |
| GDestroyNotify destroy); | | GDestroyNotify destroy); | |
| | | | |
| void gda_tree_dump (GdaTree *tree, GdaTreeNode *node
, FILE *stream); | | void gda_tree_dump (GdaTree *tree, GdaTreeNode *node
, FILE *stream); | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 22 lines changed or added | |
|
| gda-util.h | | gda-util.h | |
|
| /* GDA common library | | /* | |
| * Copyright (C) 1998 - 2010 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
|
| | | * Daniel Espinosa <esodan@gmail.com> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Library General Public License for more details. | | * Library General Public License for more details. | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 37 | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| #include "gda-holder.h" | | #include "gda-holder.h" | |
| #include "gda-row.h" | | #include "gda-row.h" | |
| #include "gda-connection.h" | | #include "gda-connection.h" | |
| #include <sql-parser/gda-sql-statement.h> | | #include <sql-parser/gda-sql-statement.h> | |
| #include <libgda/gda-data-select.h> | | #include <libgda/gda-data-select.h> | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-util | |
| | | * @short_description: Utility functions | |
| | | * @title: Utility functions | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * Some useful functions. | |
| | | */ | |
| | | | |
| /* | | /* | |
| * Type utilities | | * Type utilities | |
| */ | | */ | |
| const gchar *gda_g_type_to_string (GType type); | | const gchar *gda_g_type_to_string (GType type); | |
| GType gda_g_type_from_string (const gchar *str); | | GType gda_g_type_from_string (const gchar *str); | |
| | | | |
| /* | | /* | |
| * SQL escaping | | * SQL escaping | |
| */ | | */ | |
| gchar *gda_default_escape_string (const gchar *string); | | gchar *gda_default_escape_string (const gchar *string); | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 69 | |
| gboolean gda_identifier_equal (const gchar *id1, const gchar *id2); | | gboolean gda_identifier_equal (const gchar *id1, const gchar *id2); | |
| gchar **gda_completion_list_get (GdaConnection *cnc, const gchar *sql,
gint start, gint end); | | gchar **gda_completion_list_get (GdaConnection *cnc, const gchar *sql,
gint start, gint end); | |
| gchar **gda_sql_identifier_split (const gchar *id); | | gchar **gda_sql_identifier_split (const gchar *id); | |
| gchar *gda_sql_identifier_quote (const gchar *id, GdaConnection *cnc,
GdaServerProvider *prov, | | gchar *gda_sql_identifier_quote (const gchar *id, GdaConnection *cnc,
GdaServerProvider *prov, | |
| gboolean meta_store_convention, gbool
ean force_quotes); | | gboolean meta_store_convention, gbool
ean force_quotes); | |
| | | | |
| /* | | /* | |
| * Param & model utilities | | * Param & model utilities | |
| */ | | */ | |
| gboolean gda_utility_check_data_model (GdaDataModel *model, gint nbcols
, ...); | | gboolean gda_utility_check_data_model (GdaDataModel *model, gint nbcols
, ...); | |
|
| | | gboolean gda_utility_check_data_model_v (GdaDataModel *model, gint nbco
ls, GType* types); | |
| gboolean gda_utility_data_model_dump_data_to_xml (GdaDataModel *model,
xmlNodePtr parent, | | gboolean gda_utility_data_model_dump_data_to_xml (GdaDataModel *model,
xmlNodePtr parent, | |
| const gint *cols, gint nb_cols
, const gint *rows, gint nb_rows, | | const gint *cols, gint nb_cols
, const gint *rows, gint nb_rows, | |
| gboolean use_col_ids); | | gboolean use_col_ids); | |
| const gchar *gda_utility_data_model_find_column_description (GdaDataSelect
*model, const gchar *field_name); | | const gchar *gda_utility_data_model_find_column_description (GdaDataSelect
*model, const gchar *field_name); | |
| gboolean gda_utility_holder_load_attributes (GdaHolder *holder, xmlNode
Ptr node, GSList *sources, GError **error); | | gboolean gda_utility_holder_load_attributes (GdaHolder *holder, xmlNode
Ptr node, GSList *sources, GError **error); | |
| | | | |
| GdaSqlStatement *gda_statement_rewrite_for_default_values (GdaStatement *st
mt, GdaSet *params, | | GdaSqlStatement *gda_statement_rewrite_for_default_values (GdaStatement *st
mt, GdaSet *params, | |
| gboolean remove,
GError **error); | | gboolean remove,
GError **error); | |
| | | | |
| /* | | /* | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 14 lines changed or added | |
|
| gda-value.h | | gda-value.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 1998 - 2009 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Michael Lausch <michael@lausch.at> | | * Michael Lausch <michael@lausch.at> | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * Juan-Mariano de Goyeneche <jmseyas@dit.upm.es> (BLOB issues) | | * Juan-Mariano de Goyeneche <jmseyas@dit.upm.es> (BLOB issues) | |
| * Daniel Espinosa Ortiz <esodan@gmail.com> (Port to GValue) | | * Daniel Espinosa Ortiz <esodan@gmail.com> (Port to GValue) | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| /* Definition of the GDA_VALUE_HOLDS macros */ | | /* Definition of the GDA_VALUE_HOLDS macros */ | |
| #define GDA_VALUE_HOLDS_BINARY(value) G_VALUE_HOLDS(value, GDA_TYP
E_BINARY) | | #define GDA_VALUE_HOLDS_BINARY(value) G_VALUE_HOLDS(value, GDA_TYP
E_BINARY) | |
| #define GDA_VALUE_HOLDS_BLOB(value) G_VALUE_HOLDS(value, GDA_TYP
E_BLOB) | | #define GDA_VALUE_HOLDS_BLOB(value) G_VALUE_HOLDS(value, GDA_TYP
E_BLOB) | |
| #define GDA_VALUE_HOLDS_GEOMETRIC_POINT(value) G_VALUE_HOLDS(value, GDA_TYP
E_GEOMETRIC_POINT) | | #define GDA_VALUE_HOLDS_GEOMETRIC_POINT(value) G_VALUE_HOLDS(value, GDA_TYP
E_GEOMETRIC_POINT) | |
| #define GDA_VALUE_HOLDS_NUMERIC(value) G_VALUE_HOLDS(value, GDA_TYP
E_NUMERIC) | | #define GDA_VALUE_HOLDS_NUMERIC(value) G_VALUE_HOLDS(value, GDA_TYP
E_NUMERIC) | |
| #define GDA_VALUE_HOLDS_SHORT(value) G_VALUE_HOLDS(value, GDA_TYP
E_SHORT) | | #define GDA_VALUE_HOLDS_SHORT(value) G_VALUE_HOLDS(value, GDA_TYP
E_SHORT) | |
| #define GDA_VALUE_HOLDS_USHORT(value) G_VALUE_HOLDS(value, GDA_TYP
E_USHORT) | | #define GDA_VALUE_HOLDS_USHORT(value) G_VALUE_HOLDS(value, GDA_TYP
E_USHORT) | |
| #define GDA_VALUE_HOLDS_TIME(value) G_VALUE_HOLDS(value, GDA_TYP
E_TIME) | | #define GDA_VALUE_HOLDS_TIME(value) G_VALUE_HOLDS(value, GDA_TYP
E_TIME) | |
| #define GDA_VALUE_HOLDS_TIMESTAMP(value) G_VALUE_HOLDS(value, GDA_TYP
E_TIMESTAMP) | | #define GDA_VALUE_HOLDS_TIMESTAMP(value) G_VALUE_HOLDS(value, GDA_TYP
E_TIMESTAMP) | |
| | | | |
|
| | | /** | |
| | | * GdaGeometricPoint: | |
| | | * @x: | |
| | | * @y: | |
| | | */ | |
| typedef struct { | | typedef struct { | |
| gdouble x; | | gdouble x; | |
| gdouble y; | | gdouble y; | |
| } GdaGeometricPoint; | | } GdaGeometricPoint; | |
| | | | |
|
| | | /** | |
| | | * GdaNumeric: | |
| | | * @number: | |
| | | * @precision: | |
| | | * @width: | |
| | | */ | |
| typedef struct { | | typedef struct { | |
| gchar *number; | | gchar *number; | |
| glong precision; | | glong precision; | |
| glong width; | | glong width; | |
|
| | | | |
| | | /*< private >*/ | |
| gpointer reserved; /* reserved for future usage with GMP (http://gmp
lib.org/) */ | | gpointer reserved; /* reserved for future usage with GMP (http://gmp
lib.org/) */ | |
| } GdaNumeric; | | } GdaNumeric; | |
| | | | |
|
| | | /** | |
| | | * GdaTime: | |
| | | * @hour: | |
| | | * @minute: | |
| | | * @second: | |
| | | * @fraction: | |
| | | * @timezone: | |
| | | */ | |
| typedef struct { | | typedef struct { | |
| gushort hour; | | gushort hour; | |
| gushort minute; | | gushort minute; | |
| gushort second; | | gushort second; | |
| gulong fraction; | | gulong fraction; | |
| glong timezone; /* # of seconds to the east UTC */ | | glong timezone; /* # of seconds to the east UTC */ | |
| } GdaTime; | | } GdaTime; | |
| | | | |
|
| | | /** | |
| | | * GdaTimestamp: | |
| | | * @year: representation of the date | |
| | | * @month: month representation of the date, as a number between 1 and 12 | |
| | | * @day: day representation of the date, as a number between 1 and 31 | |
| | | * @hour: | |
| | | * @minute: | |
| | | * @second: | |
| | | * @fraction: | |
| | | * @timezone: | |
| | | */ | |
| typedef struct { | | typedef struct { | |
| gshort year; | | gshort year; | |
| gushort month; | | gushort month; | |
| gushort day; | | gushort day; | |
| gushort hour; | | gushort hour; | |
| gushort minute; | | gushort minute; | |
| gushort second; | | gushort second; | |
| gulong fraction; | | gulong fraction; | |
| glong timezone; /* # of seconds to the east UTC */ | | glong timezone; /* # of seconds to the east UTC */ | |
| } GdaTimestamp; | | } GdaTimestamp; | |
| | | | |
|
| | | /** | |
| | | * GdaBinary: | |
| | | * @data: | |
| | | * @binary_length: | |
| | | */ | |
| typedef struct { | | typedef struct { | |
| guchar *data; | | guchar *data; | |
| glong binary_length; | | glong binary_length; | |
| } GdaBinary; | | } GdaBinary; | |
| | | | |
| /** | | /** | |
| * GdaBlob | | * GdaBlob | |
| * @data: data buffer, as a #GdaBinary | | * @data: data buffer, as a #GdaBinary | |
| * @op: a pointer to a #GdaBlopOp, or %NULL | | * @op: a pointer to a #GdaBlopOp, or %NULL | |
| * | | * | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 149 | |
| * @op is generally set up by database providers when giving access to an e
xisting BLOB in | | * @op is generally set up by database providers when giving access to an e
xisting BLOB in | |
| * a database, but can be modified if needed using gda_blob_set_op(). | | * a database, but can be modified if needed using gda_blob_set_op(). | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| GdaBinary data; | | GdaBinary data; | |
| GdaBlobOp *op; | | GdaBlobOp *op; | |
| } GdaBlob; | | } GdaBlob; | |
| | | | |
| #define gda_value_isa(value, type) (G_VALUE_HOLDS(value, type)) | | #define gda_value_isa(value, type) (G_VALUE_HOLDS(value, type)) | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-value | |
| | | * @short_description: Assorted functions for dealing with #GValue values | |
| | | * @title: A single Value | |
| | | * @stability: Stable | |
| | | * @see_also: #GValue and #GdaBlobOp | |
| | | * | |
| | | * &LIBGDA; manages each individual value within an opaque #GValue structur | |
| | | e. Any GValue type can be used, | |
| | | * and &LIBGDA; adds a few more data types usually found in DBMS such as NU | |
| | | MERIC, TIME, TIMESTAMP, GEOMETRIC POINT, BINARY and BLOB. | |
| | | * | |
| | | * Libgda makes a distinction between binary and blob types | |
| | | * <itemizedlist> | |
| | | * <listitem><para>binary data can be inserted into an SQL statement usin | |
| | | g a | |
| | | * (DBMS dependent) syntax, such as "X'ABCD'" syntax for SQLite or the | |
| | | binary strings syntax for PostgreSQL. Binary data | |
| | | * is manipulated using a #GdaBinary structure (which is basically a by | |
| | | tes buffer and a length attribute). | |
| | | * </para></listitem> | |
| | | * <listitem><para>blob data are a special feature that some DBMS have wh | |
| | | ich requires some non SQL code to manipulate them. | |
| | | * Usually only a reference is stored in each table containing a blob, | |
| | | and the actual blob data resides somewhere on the disk | |
| | | * (while still being managed transparently by the database). For examp | |
| | | le PotsgreSQL stores blobs as files on the disk and | |
| | | * references them using object identifiers (Oid). Blob data | |
| | | * is manipulated using a #GdaBlob structure which encapsulates a #GdaB | |
| | | inary structure and adds a reference to a | |
| | | * #GdaBlobOp object used to read and write data from and to the blob. | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * Please note that is distinction between binary data and blobs is Libgda | |
| | | only and does not reflect the DBMS's documentations; | |
| | | * for instance MySQL has several BLOB types but Libgda interprets them as | |
| | | binary types. | |
| | | * | |
| | | * Each provider or connection can be queried about its blob support using | |
| | | the gda_server_provider_supports_feature() or | |
| | | * gda_connection_supports_feature() methods. | |
| | | * | |
| | | * The NULL value is a special case value: it is represented by to a zero-f | |
| | | illed (uninitialized) #GValue and has a type equal | |
| | | * to %GDA_TYPE_NULL. | |
| | | */ | |
| | | | |
| GValue *gda_value_new (GType type); | | GValue *gda_value_new (GType type); | |
| | | | |
| GValue *gda_value_new_binary (const guchar *val,
glong size); | | GValue *gda_value_new_binary (const guchar *val,
glong size); | |
| GValue *gda_value_new_blob (const guchar *val, gl
ong size); | | GValue *gda_value_new_blob (const guchar *val, gl
ong size); | |
| GValue *gda_value_new_blob_from_file (const gchar
*filename); | | GValue *gda_value_new_blob_from_file (const gchar
*filename); | |
| GValue *gda_value_new_timestamp_from_timet (time_
t val); | | GValue *gda_value_new_timestamp_from_timet (time_
t val); | |
| | | | |
| GValue *gda_value_new_from_string (const gchar *a
s_string, GType type); | | GValue *gda_value_new_from_string (const gchar *a
s_string, GType type); | |
| GValue *gda_value_new_from_xml (const xmlNodePtr
node); | | GValue *gda_value_new_from_xml (const xmlNodePtr
node); | |
| | | | |
| | | | |
| skipping to change at line 200 | | skipping to change at line 271 | |
| | | | |
| GType gda_blob_get_type (void) G_GNUC_CONST; | | GType gda_blob_get_type (void) G_GNUC_CONST; | |
| gpointer gda_blob_copy (gpointer boxed); | | gpointer gda_blob_copy (gpointer boxed); | |
| void gda_blob_free (gpointer boxed); | | void gda_blob_free (gpointer boxed); | |
| void gda_blob_set_op (GdaBlob *blob, GdaBlobOp
*op); | | void gda_blob_set_op (GdaBlob *blob, GdaBlobOp
*op); | |
| | | | |
| GType gda_short_get_type (void) G_GNUC_CONST; | | GType gda_short_get_type (void) G_GNUC_CONST; | |
| GType gda_ushort_get_type (void) G_GNUC_CONST; | | GType gda_ushort_get_type (void) G_GNUC_CONST; | |
| | | | |
| /* Helper macros */ | | /* Helper macros */ | |
|
| | | /** | |
| | | * gda_value_new_null: | |
| | | * | |
| | | * Creates a new #GValue of type %GDA_TYPE_NULL representing a NULL value | |
| | | * | |
| | | * Returns: (transfer full): a new #GValue | |
| | | */ | |
| #define gda_value_new_null() (g_new0 (GValue, 1)) | | #define gda_value_new_null() (g_new0 (GValue, 1)) | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 9 change blocks. |
| 2 lines changed or deleted | | 93 lines changed or added | |
|
| gda-vconnection-data-model.h | | gda-vconnection-data-model.h | |
| /* | | /* | |
|
| * Copyright (C) 2007 - 2010 The GNOME Foundation. | | * Copyright (C) 2007 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| #define GDA_IS_VCONNECTION_DATA_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE
((klass), GDA_TYPE_VCONNECTION_DATA_MODEL)) | | #define GDA_IS_VCONNECTION_DATA_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE
((klass), GDA_TYPE_VCONNECTION_DATA_MODEL)) | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
| typedef struct _GdaVconnectionDataModel GdaVconnectionDataModel; | | typedef struct _GdaVconnectionDataModel GdaVconnectionDataModel; | |
| typedef struct _GdaVconnectionDataModelClass GdaVconnectionDataModelClass; | | typedef struct _GdaVconnectionDataModelClass GdaVconnectionDataModelClass; | |
| typedef struct _GdaVconnectionDataModelPrivate GdaVconnectionDataModelPriva
te; | | typedef struct _GdaVconnectionDataModelPrivate GdaVconnectionDataModelPriva
te; | |
| typedef struct _GdaVconnectionDataModelSpec GdaVconnectionDataModelSpec; | | typedef struct _GdaVconnectionDataModelSpec GdaVconnectionDataModelSpec; | |
| typedef struct _GdaVconnectionDataModelFilter GdaVconnectionDataModelFilter
; | | typedef struct _GdaVconnectionDataModelFilter GdaVconnectionDataModelFilter
; | |
| | | | |
|
| typedef GList *(*GdaVconnectionDataModelCreateColumnsFunc) (GdaVconn | | /** | |
| ectionDataModelSpec *, GError **); | | * GdaVconnectionDataModelCreateColumnsFunc: | |
| typedef GdaDataModel *(*GdaVconnectionDataModelCreateModelFunc) (GdaVconn | | * @Param1: a pointer to a #GdaVconnectionDataModelSpec structure | |
| ectionDataModelSpec *); | | * @Param2: a place to store errors, or %NULL | |
| | | * @Returns: (element-type GdaColumn) (transfer full): a new list of #GdaCo | |
| | | lumn objects | |
| | | * | |
| | | * Function called to create the virtual table's columns, as #GdaColumn obj | |
| | | ects. | |
| | | */ | |
| | | typedef GList *(*GdaVconnectionDataModelCreateColumnsFunc) (GdaVconnectionD | |
| | | ataModelSpec *, GError **); | |
| | | | |
| | | /** | |
| | | * GdaVconnectionDataModelCreateModelFunc: | |
| | | * @Param1: a pointer to a #GdaVconnectionDataModelSpec structure | |
| | | * @Returns: (transfer full): a new #GdaDataModel | |
| | | * | |
| | | * Function called to create a #GdaDataModel object, called when a virtual | |
| | | table's data need to | |
| | | * be accessed, and when optimization is not handled. | |
| | | */ | |
| | | typedef GdaDataModel *(*GdaVconnectionDataModelCreateModelFunc) (GdaVconnec | |
| | | tionDataModelSpec *); | |
| | | | |
| | | /** | |
| | | * GdaVconnectionDataModelFunc: | |
| | | * @Param1: a pointer to a #GdaDataModel | |
| | | * @Param2: the name of the table represented by @Param1 | |
| | | * @Param3: a data pointer, passed as last ergument to gda_vconnection_data | |
| | | _model_foreach() | |
| | | * | |
| | | * This function is called for every #GdaDataModel representing a table in | |
| | | a #GdaVconnectionDataModel | |
| | | * connection, when using the gda_vconnection_data_model_foreach() method. | |
| | | */ | |
| typedef void (*GdaVconnectionDataModelFunc) (GdaDataModel *, const gchar *,
gpointer ); | | typedef void (*GdaVconnectionDataModelFunc) (GdaDataModel *, const gchar *,
gpointer ); | |
| | | | |
|
| /* | | /** | |
| * Enabling pre-filtering when creating a data model to be used as a table, | | * GdaVconnectionDataModelFilter: | |
| * (structure closely mapped with SQLite's sqlite3_index_info type), to ena | | | |
| ble | | | |
| * the data model to perform some filter tasks itself. | | | |
| * | | * | |
|
| * A pointer to this structure is passed to the GdaVconnectionDataModelPars | | * This structure contains data which should be analysed to produce a data | |
| eFilterFunc function | | model (used as data | |
| * and the function has to modify the variables in the *Outputs* section (a | | * for a virtual table) when a #GdaVconnectionDataModelCreateFModelFunc is | |
| nd nowhere else) | | called. The structure | |
| | | * contains an input part (which should not be modified) and and output par | |
| | | t (it is | |
| | | * closely mapped with SQLite's sqlite3_index_info type). | |
| * | | * | |
|
| * The @idxNum and @idxPointer are passed to the GdaVconnectionDataModelCre | | * A pointer to this structure is passed to the #GdaVconnectionDataModelPar | |
| ateFModelFunc function call | | seFilterFunc function | |
| | | * and the function has to modify the variables in the output part (marked | |
| | | as *Outputs*). | |
| | | * | |
| | | * The @idxNum and @idxPointer are passed to the #GdaVconnectionDataModelCr | |
| | | eateFModelFunc function call | |
| * and they represent nothing specific except that the GdaVconnectionDataMo
delParseFilterFunc and | | * and they represent nothing specific except that the GdaVconnectionDataMo
delParseFilterFunc and | |
| * GdaVconnectionDataModelCreateFModelFunc functions need to agree on their
meaning. | | * GdaVconnectionDataModelCreateFModelFunc functions need to agree on their
meaning. | |
| * | | * | |
| * See the gda-vconnection-hub.c file for an usage example. | | * See the gda-vconnection-hub.c file for an usage example. | |
| */ | | */ | |
| struct _GdaVconnectionDataModelFilter { | | struct _GdaVconnectionDataModelFilter { | |
| /* Inputs */ | | /* Inputs */ | |
| int nConstraint; /* Number of entries in aConstraint */ | | int nConstraint; /* Number of entries in aConstraint */ | |
| struct GdaVirtualConstraint { | | struct GdaVirtualConstraint { | |
| int iColumn; /* Column on left-hand side of constraint
*/ | | int iColumn; /* Column on left-hand side of constraint
*/ | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 115 | |
| struct GdaVirtualConstraintUsage { | | struct GdaVirtualConstraintUsage { | |
| int argvIndex; /* if >0, constraint is part of argv to x
Filter */ | | int argvIndex; /* if >0, constraint is part of argv to x
Filter */ | |
| gboolean omit; /* Do not code a test for this constraint
if TRUE */ | | gboolean omit; /* Do not code a test for this constraint
if TRUE */ | |
| } *aConstraintUsage; | | } *aConstraintUsage; | |
| int idxNum; /* Number used to identify the index */ | | int idxNum; /* Number used to identify the index */ | |
| gpointer idxPointer; /* Pointer used to identify the index */ | | gpointer idxPointer; /* Pointer used to identify the index */ | |
| gboolean orderByConsumed; /* TRUE if output is already ordered */ | | gboolean orderByConsumed; /* TRUE if output is already ordered */ | |
| double estimatedCost; /* Estimated cost of using this index */ | | double estimatedCost; /* Estimated cost of using this index */ | |
| }; | | }; | |
| | | | |
|
| typedef void (*GdaVconnectionDataModelParseFilterFunc) (GdaVconn | | /** | |
| ectionDataModelSpec *, GdaVconnectionDataModelFilter *); | | * GdaVconnectionDataModelParseFilterFunc: | |
| typedef GdaDataModel *(*GdaVconnectionDataModelCreateFModelFunc) (GdaVconn | | * @Param1: a pointer to a #GdaVconnectionDataModelSpec structure | |
| ectionDataModelSpec *, | | * @Param2: a pointer to a #GdaVconnectionDataModelFilter structure | |
| int, cons | | * | |
| t char *, int, GValue **); | | * This function actually analyses the proposed optimization and modified @ | |
| | | Param2 to tell the database | |
| | | * engine how (if applicable) it implements the optimization. | |
| | | */ | |
| | | typedef void (*GdaVconnectionDataModelParseFilterFunc) (GdaVconnectionDataM | |
| | | odelSpec *, GdaVconnectionDataModelFilter *); | |
| | | | |
|
| | | /** | |
| | | * GdaVconnectionDataModelCreateFModelFunc: | |
| | | * @Param1: a pointer to a #GdaVconnectionDataModelSpec structure | |
| | | * @Param2: the index number chosen to actually execute the optimization (f | |
| | | rom #GdaVconnectionDataModelFilter's #idxNum attribute) | |
| | | * @Param3: corresponds to the #GdaVconnectionDataModelFilter's #idxPointer | |
| | | attribute | |
| | | * @Param4: size of @Param5 | |
| | | * @Param5: an array of #GValue, as specified by the #GdaVconnectionDataMod | |
| | | elFilter's #aConstraintUsage's #argvIndex value | |
| | | * @Returns: (transfer full): a new #GdaDataModel | |
| | | * | |
| | | * Function called to create a #GdaDataModel object, called when a virtual | |
| | | table's data need to | |
| | | * be accessed, and when optimization is handled. | |
| | | */ | |
| | | typedef GdaDataModel *(*GdaVconnectionDataModelCreateFModelFunc) (GdaVconne | |
| | | ctionDataModelSpec *, int, const char *, int, GValue **); | |
| | | | |
| | | /** | |
| | | * GdaVconnectionDataModelSpec: | |
| | | * @data_model: a #GdaDataModel, or %NULL | |
| | | * @create_columns_func: a pointer to a #GdaVconnectionDataModelCreateColum | |
| | | nsFunc function, or %NULL | |
| | | * @create_model_func: a pointer to a #GdaVconnectionDataModelCreateModelFu | |
| | | nc function, or %NULL | |
| | | * @create_filter_func: a pointer to a #GdaVconnectionDataModelParseFilterF | |
| | | unc function, or %NULL | |
| | | * @create_filtered_model_func: a pointer to a #GdaVconnectionDataModelCrea | |
| | | teFModelFunc function, or %NULL | |
| | | * | |
| | | * This structure holds all the information supplied to declare a virtual t | |
| | | able using | |
| | | * gda_vconnection_data_model_add(). You don't need to provider pointers fo | |
| | | r all the functions and | |
| | | * for @data_model, but the following rules have to be respected: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>@data_model is not %NULL and all the function pointers | |
| | | are %NULL: this is the situation | |
| | | * when the virtual table's contents is defined once by @data_model</para | |
| | | ></listitem> | |
| | | * <listitem><para>@data_model is %NULL and @create_columns_func is not %N | |
| | | ULL: | |
| | | * <itemizedlist> | |
| | | * <listitem><para>@create_filtered_model_func is not %NULL: this is | |
| | | the situation where the | |
| | | * virtual table's associated data model handles fil | |
| | | ter optimizations. | |
| | | * @create_model_func is ignored in this case. | |
| | | * </para></listitem> | |
| | | * <listitem><para>@create_model_func is not %NULL: this is the situ | |
| | | ation where the | |
| | | * virtual table's associated data model does not ha | |
| | | ndle filter optimizations | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * </para></listitem> | |
| | | * </itemizedlist> | |
| | | * | |
| | | * Note that if specifying a @create_filtered_model_func, you should also s | |
| | | pecifiy a @create_filter_func | |
| | | * function which is actually responsible for analysing the optimization. | |
| | | */ | |
| struct _GdaVconnectionDataModelSpec { | | struct _GdaVconnectionDataModelSpec { | |
| GdaDataModel *data_model; | | GdaDataModel *data_model; | |
| GdaVconnectionDataModelCreateColumnsFunc create_columns_func; | | GdaVconnectionDataModelCreateColumnsFunc create_columns_func; | |
| GdaVconnectionDataModelCreateModelFunc create_model_func; | | GdaVconnectionDataModelCreateModelFunc create_model_func; | |
| | | | |
| GdaVconnectionDataModelParseFilterFunc create_filter_func; | | GdaVconnectionDataModelParseFilterFunc create_filter_func; | |
| GdaVconnectionDataModelCreateFModelFunc create_filtered_model_func
; | | GdaVconnectionDataModelCreateFModelFunc create_filtered_model_func
; | |
| }; | | }; | |
| #define GDA_VCONNECTION_DATA_MODEL_SPEC(x) ((GdaVconnectionDataModelSpec*)(
x)) | | #define GDA_VCONNECTION_DATA_MODEL_SPEC(x) ((GdaVconnectionDataModelSpec*)(
x)) | |
| | | | |
| struct _GdaVconnectionDataModel { | | struct _GdaVconnectionDataModel { | |
| GdaVirtualConnection connection; | | GdaVirtualConnection connection; | |
| GdaVconnectionDataModelPrivate *priv; | | GdaVconnectionDataModelPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaVconnectionDataModelClass { | | struct _GdaVconnectionDataModelClass { | |
| GdaVirtualConnectionClass parent_class; | | GdaVirtualConnectionClass parent_class; | |
| | | | |
|
| | | void (*vtable_created) (GdaVconnectionDataM | |
| | | odel *cnc, | |
| | | const gchar *table | |
| | | _name); | |
| | | void (*vtable_dropped) (GdaVconnectionDataM | |
| | | odel *cnc, | |
| | | const gchar *tab | |
| | | le_name); | |
| | | | |
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-vconnection-data-model | |
| | | * @short_description: Virtual connection based on a list of GdaDataModel | |
| | | * @title: GdaVconnectionDataModel | |
| | | * @stability: Stable | |
| | | * @see_also: The #GdaVproviderDataModel provider to use to create such con | |
| | | nection objects. | |
| | | * | |
| | | * The #GdaVconnectionDataModel is a virtual connection in which #GdaDataMo | |
| | | del data models can be added | |
| | | * or removed, each representing a table in the connection, the gda_vconnec | |
| | | tion_data_model_add_model() | |
| | | * and gda_vconnection_data_model_remove() methods. | |
| | | * | |
| | | * Furthermore it is possible to declare tables without any associated data | |
| | | model yet, | |
| | | * the real data model being automatically created when the | |
| | | * table's data is needed. This allows more dynamic table's contents and fi | |
| | | ltering optimizations. | |
| | | * See the gda_vconnection_data_model_add() and gda_vconnection_data_model_ | |
| | | remove() methods. The | |
| | | * filtering optimizations are based on SQLite's virtual table optimisation | |
| | | s see | |
| | | * <ulink url="http://www.sqlite.org/cvstrac/wiki?p=VirtualTableBestIndexMe | |
| | | thod">SQLite's documentation</ulink> | |
| | | * for some background information. | |
| | | */ | |
| | | | |
| GType gda_vconnection_data_model_get_type (void) G_GNUC_CONS
T; | | GType gda_vconnection_data_model_get_type (void) G_GNUC_CONS
T; | |
| | | | |
| gboolean gda_vconnection_data_model_add (GdaVconnectionDat
aModel *cnc, GdaVconnectionDataModelSpec *spec, | | gboolean gda_vconnection_data_model_add (GdaVconnectionDat
aModel *cnc, GdaVconnectionDataModelSpec *spec, | |
| GDestroyNotify spe
c_free_func, | | GDestroyNotify spe
c_free_func, | |
| const gchar *table
_name, GError **error); | | const gchar *table
_name, GError **error); | |
| gboolean gda_vconnection_data_model_add_model (GdaVconnectionDat
aModel *cnc, | | gboolean gda_vconnection_data_model_add_model (GdaVconnectionDat
aModel *cnc, | |
| GdaDataModel *mode
l, const gchar *table_name, GError **error); | | GdaDataModel *mode
l, const gchar *table_name, GError **error); | |
| gboolean gda_vconnection_data_model_remove (GdaVconnectionDat
aModel *cnc, const gchar *table_name, GError **error); | | gboolean gda_vconnection_data_model_remove (GdaVconnectionDat
aModel *cnc, const gchar *table_name, GError **error); | |
| | | | |
|
| | | GdaVconnectionDataModelSpec *gda_vconnection_data_model_get (GdaVconnection
DataModel *cnc, const gchar *table_name); | |
| const gchar *gda_vconnection_data_model_get_table_name (GdaVconnecti
onDataModel *cnc, GdaDataModel *model); | | const gchar *gda_vconnection_data_model_get_table_name (GdaVconnecti
onDataModel *cnc, GdaDataModel *model); | |
| GdaDataModel *gda_vconnection_data_model_get_model (GdaVconnectionDat
aModel *cnc, const gchar *table_name); | | GdaDataModel *gda_vconnection_data_model_get_model (GdaVconnectionDat
aModel *cnc, const gchar *table_name); | |
| | | | |
| void gda_vconnection_data_model_foreach (GdaVconnectionDat
aModel *cnc, | | void gda_vconnection_data_model_foreach (GdaVconnectionDat
aModel *cnc, | |
| GdaVconnectionData
ModelFunc func, gpointer data); | | GdaVconnectionData
ModelFunc func, gpointer data); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 10 change blocks. |
| 22 lines changed or deleted | | 166 lines changed or added | |
|
| gda-vconnection-hub.h | | gda-vconnection-hub.h | |
|
| /* GDA | | /* | |
| * Copyright (C) 2007 - 2009 The GNOME Foundation. | | * Copyright (C) 2007 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| typedef void (*GdaVConnectionHubFunc) (GdaConnection *cnc, const gchar *ns,
gpointer data); | | typedef void (*GdaVConnectionHubFunc) (GdaConnection *cnc, const gchar *ns,
gpointer data); | |
| | | | |
| struct _GdaVconnectionHub { | | struct _GdaVconnectionHub { | |
| GdaVconnectionDataModel parent; | | GdaVconnectionDataModel parent; | |
| GdaVconnectionHubPrivate *priv; | | GdaVconnectionHubPrivate *priv; | |
| }; | | }; | |
| | | | |
| struct _GdaVconnectionHubClass { | | struct _GdaVconnectionHubClass { | |
| GdaVconnectionDataModelClass parent_class; | | GdaVconnectionDataModelClass parent_class; | |
| | | | |
|
| | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-vconnection-hub | |
| | | * @short_description: Virtual connection which bind together connections | |
| | | * @title: GdaVconnectionHub | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * The #GdaVconnectionHub object "binds" together the tables from other (op | |
| | | ened) connections to make it possible to run | |
| | | * SQL queries on data from several connections at once. | |
| | | * | |
| | | * A #GdaVconnectionHub connection can bind several other connections, each | |
| | | separated in its own namespace (which is specified | |
| | | * when adding a connection using gda_vconnection_hub_add()). | |
| | | * | |
| | | * For example if a connection A has two tables 'table_1' and 'table_2', th | |
| | | en after gda_vconnection_hub_add() has been called | |
| | | * with A as connection argument and with a "c1" namespace, then in the cor | |
| | | responding #GdaVconnectionHub connection, table | |
| | | * 'table_1' must be referred to as 'c1.table_1' and 'table_2' must be refe | |
| | | rred to as 'c1.table_2'. | |
| | | */ | |
| | | | |
| GType gda_vconnection_hub_get_type (void) G_GNUC_CONST; | | GType gda_vconnection_hub_get_type (void) G_GNUC_CONST; | |
| | | | |
| gboolean gda_vconnection_hub_add (GdaVconnectionHub *
hub, | | gboolean gda_vconnection_hub_add (GdaVconnectionHub *
hub, | |
| GdaConnection *cnc,
const gchar *ns, GError **error); | | GdaConnection *cnc,
const gchar *ns, GError **error); | |
| gboolean gda_vconnection_hub_remove (GdaVconnectionHub *
hub, GdaConnection *cnc, GError **error); | | gboolean gda_vconnection_hub_remove (GdaVconnectionHub *
hub, GdaConnection *cnc, GError **error); | |
| GdaConnection *gda_vconnection_hub_get_connection (GdaVconnectionHub *
hub, const gchar *ns); | | GdaConnection *gda_vconnection_hub_get_connection (GdaVconnectionHub *
hub, const gchar *ns); | |
| void gda_vconnection_hub_foreach (GdaVconnectionHub *
hub, | | void gda_vconnection_hub_foreach (GdaVconnectionHub *
hub, | |
| GdaVConnectionHubFun
c func, gpointer data); | | GdaVConnectionHubFun
c func, gpointer data); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 26 lines changed or added | |
|
| gda-xa-transaction.h | | gda-xa-transaction.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 2008 - 2009 The GNOME Foundation. | | * Copyright (C) 2008 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| * License, or (at your option) any later version. | | * License, or (at your option) any later version. | |
| * | | * | |
| * This Library is distributed in the hope that it will be useful, | | * This Library is distributed in the hope that it will be useful, | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| GObjectClass parent_class; | | GObjectClass parent_class; | |
| | | | |
| /*< private >*/ | | /*< private >*/ | |
| /* Padding for future expansion */ | | /* Padding for future expansion */ | |
| void (*_gda_reserved1) (void); | | void (*_gda_reserved1) (void); | |
| void (*_gda_reserved2) (void); | | void (*_gda_reserved2) (void); | |
| void (*_gda_reserved3) (void); | | void (*_gda_reserved3) (void); | |
| void (*_gda_reserved4) (void); | | void (*_gda_reserved4) (void); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * GdaXaTransactionId: | |
| | | * @format: any number | |
| | | * @gtrid_length: number between 1 and 64 | |
| | | * @bqual_length: number between 1 and 64 | |
| | | * @data: | |
| | | */ | |
| struct _GdaXaTransactionId { | | struct _GdaXaTransactionId { | |
|
| guint32 format; /* any number */ | | guint32 format; | |
| gushort gtrid_length; /* 1-64 */ | | gushort gtrid_length; | |
| gushort bqual_length; /* 1-64 */ | | gushort bqual_length; | |
| char data [128]; | | char data [128]; | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * SECTION:gda-xa-transaction | |
| | | * @short_description: Distributed transaction manager | |
| | | * @title: GdaXaTransaction | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | * | |
| | | * The #GdaXaTransaction object acts as a distributed transaction manager: | |
| | | to make sure local transactions on several | |
| | | * connections (to possibly different databases and database types) either | |
| | | all succeed or all fail. For more information, | |
| | | * see the X/Open CAE document Distributed Transaction Processing: The XA S | |
| | | pecification. | |
| | | * This document is published by The Open Group and available at | |
| | | * <ulink url="http://www.opengroup.org/public/pubs/catalog/c193.htm">http: | |
| | | //www.opengroup.org/public/pubs/catalog/c193.htm</ulink>. | |
| | | * | |
| | | * The two phases commit protocol is implemented during the execution of a | |
| | | distributed transaction: modifications | |
| | | * made on any connection are first <emphasis>prepared</emphasis> (which me | |
| | | ans that they are store in the database), and | |
| | | * if that phase succeeded for all the involved connections, then the <emph | |
| | | asis>commit</emphasis> phase is executed | |
| | | * (where all the data previously stored during the <emphasis>prepare</emph | |
| | | asis> phase are actually committed). | |
| | | * That second phase may actually fail, but the distributed transaction wil | |
| | | l still be considered as sucessfull | |
| | | * as the data stored during the <emphasis>prepare</emphasis> phase can be | |
| | | committed afterwards. | |
| | | * | |
| | | * A distributed transaction involves the following steps: | |
| | | * <orderedlist> | |
| | | * <listitem><para>Create a #GdaXaTransaction object</para></listitem> | |
| | | * <listitem><para>Register the connections which will be part of the dis | |
| | | tributed transaction with that object | |
| | | * using gda_xa_transaction_register_connection()</para></listitem> | |
| | | * <listitem><para>Beging the distributed transaction using gda_xa_transa | |
| | | ction_begin()</para></listitem> | |
| | | * <listitem><para>Work individually on each connection as normally (make | |
| | | modifications)</para></listitem> | |
| | | * <listitem><para>Commit the distributed transaction using gda_xa_transa | |
| | | ction_commit()</para></listitem> | |
| | | * <listitem><para>Discard the #GdaXaTransaction object using g_object_un | |
| | | ref()</para></listitem> | |
| | | * </orderedlist> | |
| | | */ | |
| | | | |
| GType gda_xa_transaction_get_type (void) G_
GNUC_CONST; | | GType gda_xa_transaction_get_type (void) G_
GNUC_CONST; | |
| GdaXaTransaction *gda_xa_transaction_new (guint32
format, const gchar *global_transaction_id); | | GdaXaTransaction *gda_xa_transaction_new (guint32
format, const gchar *global_transaction_id); | |
| | | | |
| gboolean gda_xa_transaction_register_connection (GdaXaTra
nsaction *xa_trans, GdaConnection *cnc, | | gboolean gda_xa_transaction_register_connection (GdaXaTra
nsaction *xa_trans, GdaConnection *cnc, | |
| const gch
ar *branch, GError **error); | | const gch
ar *branch, GError **error); | |
| void gda_xa_transaction_unregister_connection (GdaXaTr
ansaction *xa_trans, GdaConnection *cnc); | | void gda_xa_transaction_unregister_connection (GdaXaTr
ansaction *xa_trans, GdaConnection *cnc); | |
| | | | |
| gboolean gda_xa_transaction_begin (GdaXaTransaction *xa_t
rans, GError **error); | | gboolean gda_xa_transaction_begin (GdaXaTransaction *xa_t
rans, GError **error); | |
| gboolean gda_xa_transaction_commit (GdaXaTransaction *xa_t
rans, GSList **cnc_to_recover, GError **error); | | gboolean gda_xa_transaction_commit (GdaXaTransaction *xa_t
rans, GSList **cnc_to_recover, GError **error); | |
| gboolean gda_xa_transaction_rollback (GdaXaTransaction *xa
_trans, GError **error); | | gboolean gda_xa_transaction_rollback (GdaXaTransaction *xa
_trans, GError **error); | |
| | | | |
End of changes. 4 change blocks. |
| 5 lines changed or deleted | | 59 lines changed or added | |
|
| libgda.h | | libgda.h | |
|
| /* GDA library | | /* | |
| * Copyright (C) 1998 - 2008 The GNOME Foundation. | | * Copyright (C) 1998 - 2011 The GNOME Foundation. | |
| * | | * | |
| * AUTHORS: | | * AUTHORS: | |
| * Michael Lausch <michael@lausch.at> | | * Michael Lausch <michael@lausch.at> | |
| * Rodrigo Moya <rodrigo@gnome-db.org> | | * Rodrigo Moya <rodrigo@gnome-db.org> | |
| * Bas Driessen <bas.driessen@xobas.com> | | * Bas Driessen <bas.driessen@xobas.com> | |
| * Vivien Malerba <malerba@gnome-db.org> | | * Vivien Malerba <malerba@gnome-db.org> | |
| * | | * | |
| * This Library is free software; you can redistribute it and/or | | * This Library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Library General Public License as | | * modify it under the terms of the GNU Library General Public License as | |
| * published by the Free Software Foundation; either version 2 of the | | * published by the Free Software Foundation; either version 2 of the | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| | | | |
| #include <libgda/gda-attributes-manager.h> | | #include <libgda/gda-attributes-manager.h> | |
| #include <libgda/gda-column.h> | | #include <libgda/gda-column.h> | |
| #include <libgda/gda-config.h> | | #include <libgda/gda-config.h> | |
| #include <libgda/gda-connection-event.h> | | #include <libgda/gda-connection-event.h> | |
| #include <libgda/gda-connection.h> | | #include <libgda/gda-connection.h> | |
| #include <libgda/gda-connection-private.h> | | #include <libgda/gda-connection-private.h> | |
| #include <libgda/gda-data-comparator.h> | | #include <libgda/gda-data-comparator.h> | |
| #include <libgda/gda-data-model-array.h> | | #include <libgda/gda-data-model-array.h> | |
| #include <libgda/gda-data-model-bdb.h> | | #include <libgda/gda-data-model-bdb.h> | |
|
| | | #include <libgda/gda-data-model-ldap.h> | |
| | | #include <libgda/gda-tree-mgr-ldap.h> | |
| #include <libgda/gda-data-model.h> | | #include <libgda/gda-data-model.h> | |
| #include <libgda/gda-data-model-iter.h> | | #include <libgda/gda-data-model-iter.h> | |
| #include <libgda/gda-data-model-import.h> | | #include <libgda/gda-data-model-import.h> | |
| #include <libgda/gda-data-model-dir.h> | | #include <libgda/gda-data-model-dir.h> | |
| #include <libgda/gda-data-access-wrapper.h> | | #include <libgda/gda-data-access-wrapper.h> | |
| #include <libgda/gda-data-proxy.h> | | #include <libgda/gda-data-proxy.h> | |
| #include <libgda/gda-data-select.h> | | #include <libgda/gda-data-select.h> | |
| #include <libgda/gda-lockable.h> | | #include <libgda/gda-lockable.h> | |
| #include <libgda/gda-log.h> | | #include <libgda/gda-log.h> | |
| #include <libgda/gda-quark-list.h> | | #include <libgda/gda-quark-list.h> | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 92 | |
| #include <libgda/gda-tree-node.h> | | #include <libgda/gda-tree-node.h> | |
| | | | |
| #include <libgda/gda-sql-builder.h> | | #include <libgda/gda-sql-builder.h> | |
| | | | |
| #include <libgda/gda-meta-store.h> | | #include <libgda/gda-meta-store.h> | |
| | | | |
| #include <libgda/gda-mutex.h> | | #include <libgda/gda-mutex.h> | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
|
| | | /** | |
| | | * SECTION:libgda | |
| | | * @short_description: Library initialization and information | |
| | | * @title: Library initialization | |
| | | * @stability: Stable | |
| | | * @see_also: | |
| | | */ | |
| | | | |
| void gda_init (void); | | void gda_init (void); | |
| void gda_locale_changed (void); | | void gda_locale_changed (void); | |
| gchar *gda_get_application_exec_path (const gchar *app_name); | | gchar *gda_get_application_exec_path (const gchar *app_name); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 12 lines changed or added | |
|