[libgda] server-operation: moved methods related to GdaConnection
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] server-operation: moved methods related to GdaConnection
- Date: Wed, 12 Sep 2018 11:54:33 +0000 (UTC)
commit 6955bda12ae05ad3dbbd44270257b60f3038fac9
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Sep 3 12:16:41 2018 -0500
server-operation: moved methods related to GdaConnection
libgda/gda-connection.c | 421 +++++++++++++++++-
libgda/gda-connection.h | 11 +-
libgda/gda-server-operation.c | 508 ----------------------
libgda/gda-server-operation.h | 9 +-
libgda/sqlite/gda-sqlite-ddl.c | 28 +-
providers/mysql/gda-mysql-ddl.c | 56 +--
providers/postgres/gda-postgres-ddl.c | 60 +--
providers/skel-implementation/capi/gda-capi-ddl.c | 6 +-
8 files changed, 504 insertions(+), 595 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index e7a0ab5c2..c253025d2 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -20,7 +20,7 @@
* Copyright (C) 2008 Johannes Schmid <jschmid openismus com>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2010 Jonh Wendell <jwendell gnome org>
- * Copyright (C) 2011 Daniel Espinosa <despinosa src gnome org>
+ * Copyright (C) 2011, 2018 Daniel Espinosa <esodan gmail com>
* Copyright (C) 2013 Miguel Angel Cabrera Moya <madmac2501 gmail com>
* Copyright (C) 2014 Anders Jonsson <anders jonsson norsjovallen se>
*
@@ -6606,3 +6606,422 @@ gda_server_provider_connection_data_free (GdaServerProviderConnectionData *obj)
}
G_DEFINE_BOXED_TYPE(GdaServerProviderConnectionData, gda_server_provider_connection_data,
gda_server_provider_connection_data_copy, gda_server_provider_connection_data_free)
+
+/**
+ * gda_connection_prepare_operation_create_table_v:
+ * @cnc: an opened connection
+ * @table_name: name of the table to create
+ * @error: a place to store errors, or %NULL
+ * @...: group of three arguments for column's name, column's #GType
+ * and a #GdaServerOperationCreateTableFlag flag, finished with %NULL
+ *
+ * Convenient funtion for table creation.
+ *
+ * For details about arguments see #gda_server_operation_prepare_create_table_v().
+ *
+ * Returns: (transfer full) (nullable): a #GdaServerOperation if no errors; NULL and set @error otherwise
+ *
+ * Since: 6.0
+ */
+G_GNUC_NULL_TERMINATED
+GdaServerOperation*
+gda_connection_prepare_operation_create_table_v (GdaConnection *cnc, const gchar *table_name, GError
**error, ...)
+{
+ GdaServerOperation *op;
+
+ g_return_val_if_fail (gda_connection_is_opened (cnc), NULL);
+
+ va_list args;
+ gchar *arg;
+ GType type;
+ GdaServerOperationCreateTableFlag flag;
+ gint refs;
+ GList *arguments = NULL;
+ GdaServerOperationCreateTableArg* argument;
+
+ va_start (args, error);
+ type = 0;
+ arg = NULL;
+ refs = -1;
+
+ while ((arg = va_arg (args, gchar*))) {
+ argument = gda_server_operation_create_table_arg_new ();
+ /* First argument for Column's name */
+ gda_server_operation_create_table_arg_set_column_name (argument, (const gchar*) arg);
+
+ /* Second to Define column's type */
+ type = va_arg (args, GType);
+ gda_server_operation_create_table_arg_set_column_type (argument, type);
+
+ /* Third for column's flags */
+ flag = va_arg (args, GdaServerOperationCreateTableFlag);
+ gda_server_operation_create_table_arg_set_flags (argument, flag);
+ if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG) {
+ gint j;
+ gint fields;
+ gchar *fkey_table;
+ gchar *fkey_ondelete;
+ gchar *fkey_onupdate;
+
+ refs++;
+ GList *lfields = NULL;
+
+ fkey_table = va_arg (args, gchar*);
+ gda_server_operation_create_table_arg_set_fkey_table (argument, fkey_table);
+ /* Get number of referenced fields */
+ fields = va_arg (args, gint);
+
+ for (j = 0; j < fields; j++) {
+ gchar *field;
+ GdaServerOperationCreateTableArgFKeyRefField *rfields;
+
+ /* First pair arguments give local field and referenced field */
+ field = va_arg (args, gchar*);
+ rfields = gda_server_operation_create_table_arg_fkey_ref_field_new ();
+ gda_server_operation_create_table_arg_fkey_ref_field_set_local_field
(rfields, field);
+ gda_server_operation_create_table_arg_fkey_ref_field_set_referenced_field
(rfields, field);
+ lfields = g_list_append (lfields, rfields);
+ }
+ gda_server_operation_create_table_arg_set_fkey_refs (argument, lfields);
+
+ /* ON DELETE and ON UPDATE events constraints */
+ fkey_ondelete = va_arg (args, gchar*);
+ gda_server_operation_create_table_arg_set_fkey_ondelete (argument, fkey_ondelete);
+
+ fkey_onupdate = va_arg (args, gchar*);
+ gda_server_operation_create_table_arg_set_fkey_ondupdate (argument, fkey_onupdate);
+ }
+
+ arguments = g_list_append (arguments, argument);
+ }
+
+ va_end (args);
+
+ op = gda_connection_prepare_operation_create_table (cnc, table_name, arguments, error);
+ g_list_free_full (arguments, (GDestroyNotify) gda_server_operation_create_table_arg_free);
+ return op;
+}
+
+/**
+ * gda_connection_prepare_operation_create_table:
+ * @cnc: an opened connection
+ * @table_name: name of the table to create
+ * @arguments: (element-type GdaServerOperationCreateTableArg): list of arguments as
#GdaServerOperationPrepareCreateTableArg containing column's name,
+ * column's #GType and a #GdaServerOperationCreateTableFlag flag
+ * @error: a place to store errors, or %NULL
+ *
+ * Add more arguments if the flag needs them:
+ *
+ * GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG:
+ * <itemizedlist>
+ * <listitem><para>string with the table's name referenced</para></listitem>
+ * <listitem><para>an integer with the number pairs "local_field", "referenced_field"
+ * used in the reference</para></listitem>
+ * <listitem><para>Pairs of "local_field", "referenced_field" to use, must match
+ * the number specified above.</para></listitem>
+ * <listitem><para>a string with the action for ON DELETE; can be: "RESTRICT", "CASCADE",
+ * "NO ACTION", "SET NULL" and "SET DEFAULT". Example: "ON UPDATE CASCADE".</para></listitem>
+ * <listitem><para>a string with the action for ON UPDATE (see above).</para></listitem>
+ * </itemizedlist>
+ *
+ * Create a #GdaServerOperation object using an opened connection, taking three
+ * arguments, a column's name the column's GType and #GdaServerOperationCreateTableFlag
+ * flag, you need to finish the list using %NULL.
+ *
+ * You'll be able to modify the #GdaServerOperation object to add custom options
+ * to the operation. When finished call #gda_server_operation_perform_create_table
+ * or #gda_server_provider_perform_operation
+ * in order to execute the operation.
+ *
+ * Returns: (transfer full) (nullable): a #GdaServerOperation if no errors; NULL and set @error otherwise
+ *
+ * Since: 6.0
+ */
+GdaServerOperation*
+gda_connection_prepare_operation_create_table (GdaConnection *cnc, const gchar *table_name, GList
*arguments, GError **error)
+{
+ GdaServerOperation *op;
+ GdaServerProvider *server;
+
+ g_return_val_if_fail (gda_connection_is_opened (cnc), NULL);
+
+ server = gda_connection_get_provider (cnc);
+
+ if (!table_name) {
+ g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
+ "%s", _("Unspecified table name"));
+ return NULL;
+ }
+
+ if (gda_server_provider_supports_operation (server, cnc, GDA_SERVER_OPERATION_CREATE_TABLE, NULL)) {
+ gchar *cname;
+ GType type;
+ gchar *dbms_type;
+ GdaServerOperationCreateTableFlag flag;
+ gint i;
+ gint refs;
+
+ op = gda_server_provider_create_operation (server, cnc,
+ GDA_SERVER_OPERATION_CREATE_TABLE, NULL, error);
+ if (!GDA_IS_SERVER_OPERATION(op))
+ return NULL;
+ if(!gda_server_operation_set_value_at (op, table_name, error, "/TABLE_DEF_P/TABLE_NAME")) {
+ g_object_unref (op);
+ return NULL;
+ }
+
+ type = 0;
+ cname = NULL;
+ i = 0;
+ refs = -1;
+
+ GList *l = arguments;
+ while (l != NULL) {
+ GdaServerOperationCreateTableArg *argument;
+ argument = (GdaServerOperationCreateTableArg*) l->data;
+ cname = gda_server_operation_create_table_arg_get_column_name (argument);
+ /* First argument for Column's name */
+ if(!gda_server_operation_set_value_at (op, cname, error, "/FIELDS_A/@COLUMN_NAME/%d",
i)) {
+ g_object_unref (op);
+ return NULL;
+ }
+ g_free (cname);
+
+ /* Second to Define column's type */
+ type = gda_server_operation_create_table_arg_get_column_type (argument);
+ if (type == 0) {
+ g_set_error (error, GDA_SERVER_OPERATION_ERROR,
GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+ "%s", _("Invalid type"));
+ g_object_unref (op);
+ return NULL;
+ }
+ dbms_type = (gchar *) gda_server_provider_get_default_dbms_type (server,
+ cnc, type);
+ if (!gda_server_operation_set_value_at (op, dbms_type, error,
"/FIELDS_A/@COLUMN_TYPE/%d", i)){
+ g_object_unref (op);
+ return NULL;
+ }
+
+ /* Third for column's flags */
+ flag = gda_server_operation_create_table_arg_get_flags (argument);
+ if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_FLAG)
+ if(!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_PKEY/%d", i)){
+ g_object_unref (op);
+ return NULL;
+ }
+ if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_NOT_NULL_FLAG)
+ if(!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_NNUL/%d", i)){
+ g_object_unref (op);
+ return NULL;
+ }
+ if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_AUTOINC_FLAG)
+ if (!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_AUTOINC/%d", i)){
+ g_object_unref (op);
+ return NULL;
+ }
+ if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_UNIQUE_FLAG)
+ if(!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_UNIQUE/%d", i)){
+ g_object_unref (op);
+ return NULL;
+ }
+ if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG) {
+ gint j;
+ gchar *fkey_table;
+ gchar *fkey_ondelete;
+ gchar *fkey_onupdate;
+
+ fkey_table = gda_server_operation_create_table_arg_get_column_name (argument);
+ if (!gda_server_operation_set_value_at (op, fkey_table, error,
+ "/FKEY_S/%d/FKEY_REF_TABLE", refs)){
+ g_object_unref (op);
+ return NULL;
+ }
+
+ refs++;
+ GList* lr = gda_server_operation_create_table_arg_get_fkey_refs (argument);
+ j = 0;
+
+ while (lr) {
+ gchar *field, *rfield;
+ GdaServerOperationCreateTableArgFKeyRefField *ref;
+ ref = (GdaServerOperationCreateTableArgFKeyRefField*) l->data;
+
+ field =
gda_server_operation_create_table_arg_fkey_ref_field_get_local_field (ref);
+ if(!gda_server_operation_set_value_at (op, field, error,
+
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_FIELD/%d", refs, j)){
+ g_object_unref (op);
+ return NULL;
+ }
+
+ rfield =
gda_server_operation_create_table_arg_fkey_ref_field_get_referenced_field (ref);
+ if(!gda_server_operation_set_value_at (op, rfield, error,
+
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_REF_PK_FIELD/%d", refs, j)){
+ g_object_unref (op);
+ return NULL;
+ }
+ j++;
+ lr = g_list_next (lr);
+ }
+
+ fkey_ondelete = gda_server_operation_create_table_arg_get_fkey_ondelete
(argument);
+ if (!gda_server_operation_set_value_at (op, fkey_ondelete, error,
+ "/FKEY_S/%d/FKEY_ONDELETE", refs)){
+ g_object_unref (op);
+ return NULL;
+ }
+ fkey_onupdate = gda_server_operation_create_table_arg_get_fkey_onupdate
(argument);
+ if(!gda_server_operation_set_value_at (op, fkey_onupdate, error,
+ "/FKEY_S/%d/FKEY_ONUPDATE", refs)){
+ g_object_unref (op);
+ return NULL;
+ }
+ }
+
+ l = g_list_next (l);
+ i++;
+ }
+
+ g_object_set_data_full (G_OBJECT (op), "_gda_connection", g_object_ref (cnc), g_object_unref);
+
+ return op;
+ }
+ else {
+ g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
+ "%s", _("CREATE TABLE operation is not supported by the database server"));
+ return NULL;
+ }
+}
+
+/**
+ * gda_connection_prepare_operation_drop_table:
+ * @cnc: an opened connection
+ * @table_name: name of the table to drop
+ * @error: a place to store errors, or %NULL
+ *
+ * This is just a convenient function to create a #GdaServerOperation to drop a
+ * table in an opened connection.
+ *
+ * Returns: (transfer full) (nullable): a new #GdaServerOperation or %NULL if couldn't create the
opereration.
+ *
+ * Since: 6.0
+ */
+GdaServerOperation*
+gda_server_operation_prepare_drop_table (GdaConnection *cnc, const gchar *table_name, GError **error)
+{
+ GdaServerOperation *op;
+ GdaServerProvider *server;
+
+ server = gda_connection_get_provider (cnc);
+
+ op = gda_server_provider_create_operation (server, cnc,
+ GDA_SERVER_OPERATION_DROP_TABLE, NULL, error);
+
+ if (GDA_IS_SERVER_OPERATION (op)) {
+ g_return_val_if_fail (table_name != NULL
+ || GDA_IS_CONNECTION (cnc)
+ || !gda_connection_is_opened (cnc), NULL);
+
+ if (gda_server_operation_set_value_at (op, table_name,
+ error, "/TABLE_DESC_P/TABLE_NAME")) {
+ g_object_set_data_full (G_OBJECT (op), "_gda_connection", g_object_ref (cnc),
g_object_unref);
+ return op;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+
+/**
+ * gda_connection_operation_get_sql_identifier_at:
+ * @cnc: a #GdaConnection
+ * @op: a #GdaServerOperation object
+ * @path_format: a complete path to a node (starting with "/")
+ * @error: (nullable): a place to store errors, or %NULL
+ * @...: arguments to use with @path_format to make a complete path
+ *
+ * This method is similar to gda_server_operation_get_value_at(), but for SQL identifiers: a new string
+ * is returned instead of a #GValue. Also the returned string is assumed to represents an SQL identifier
+ * and will correctly be quoted to be used with @cnc.
+ *
+ * Returns: (transfer full) (nullable): a new string, or %NULL if the value is undefined or
+ * if the @path is not defined or @path does not hold any value, or if the value held is not a string
+ * (in that last case a warning is shown).
+ *
+ * Since: 6.0
+ */
+gchar *
+gda_connection_operation_get_sql_identifier_at (GdaConnection *cnc, GdaServerOperation *op,
+ const gchar *path_format, GError **error, ...)
+{
+ g_return_val_if_fail (cnc != NULL, NULL);
+ g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), NULL);
+
+ gchar *path, *ret;
+ va_list args;
+
+ /* build path */
+ va_start (args, error);
+ path = g_strdup_vprintf (path_format, args);
+ va_end (args);
+
+ ret = gda_connection_operation_get_sql_identifier_at_path (cnc, op, path, error);
+ g_free (path);
+
+ return ret;
+}
+
+
+
+/**
+ * gda_connection_operation_get_sql_identifier_at_path:
+ * @op: a #GdaServerOperation object
+ * @cnc: (nullable): a #GdaConnection, or %NULL
+ * @path: a complete path to a node (starting with "/")
+ * @error: (nullable): a place to store errors, or %NULL
+ *
+ * This method is similar to gda_server_operation_get_value_at(), but for SQL identifiers: a new string
+ * is returned instead of a #GValue. Also the returned string is assumed to represents an SQL identifier
+ * and will correctly be quoted to be used with @cnc.
+ *
+ * Returns: (transfer full) (nullable): a new string, or %NULL if the value is undefined or
+ * if the @path is not defined or @path does not hold any value, or if the value held is not a string or
+ * a valid SQL identifier.
+ *
+ * Since: 6.0
+ */
+gchar *
+gda_connection_operation_get_sql_identifier_at_path (GdaConnection *cnc, GdaServerOperation *op,
+ const gchar *path, GError **error)
+{
+ const GValue *value = NULL;
+ GdaConnectionOptions cncoptions = 0;
+
+ g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), NULL);
+
+ value = gda_server_operation_get_value_at_path (op, path);
+
+ if (!value || (G_VALUE_TYPE (value) == GDA_TYPE_NULL)) {
+ g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+ _("Wrong SQL identifier value"));
+ return NULL;
+ }
+
+ g_return_val_if_fail (G_VALUE_TYPE (value) == G_TYPE_STRING, NULL);
+
+ const gchar *str;
+ str = g_value_get_string (value);
+ if (!str || !*str) {
+ g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+ _("Wrong SQL identifier value"));
+ return NULL;
+ }
+
+ if (cnc)
+ g_object_get (G_OBJECT (cnc), "options", &cncoptions, NULL);
+ return gda_sql_identifier_quote (str, cnc, gda_connection_get_provider (cnc), FALSE,
+ cncoptions & GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
+}
diff --git a/libgda/gda-connection.h b/libgda/gda-connection.h
index e73923ef6..642d80ea4 100644
--- a/libgda/gda-connection.h
+++ b/libgda/gda-connection.h
@@ -12,6 +12,7 @@
* Copyright (C) 2007 Leonardo Boshell <lb kmc com co>
* Copyright (C) 2010 David King <davidk openismus com>
* Copyright (C) 2015 Gergely Polonkai <gergely polonkai eu>
+ * Copyright (C) 2018 Daniel Espinosa <esodan gmail com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -296,6 +297,13 @@ GdaServerOperation *gda_connection_create_operation (GdaConnection *cnc, Gd
gboolean gda_connection_perform_operation (GdaConnection *cnc, GdaServerOperation *op, GError
**error);
+GdaServerOperation *gda_connection_prepare_operation_create_table_v (GdaConnection *cnc, const
gchar *table_name, GError **error, ...);
+GdaServerOperation *gda_connection_prepare_operation_create_table (GdaConnection *cnc, const gchar
*table_name, GList *arguments, GError **error);
+GdaServerOperation *gda_connection_prepare_operation_drop_table (GdaConnection *cnc, const gchar
*table_name, GError **error);
+gchar *gda_connection_operation_get_sql_identifier_at (GdaConnection *cnc,
+ GdaServerOperation *op, const gchar *path_format, GError **error, ...);
+gchar *gda_connection_operation_get_sql_identifier_at_path (GdaConnection *cnc,
GdaServerOperation *op,
+ const gchar *path, GError **error);
const gchar *gda_connection_get_dsn (GdaConnection *cnc);
const gchar *gda_connection_get_cnc_string (GdaConnection *cnc);
const gchar *gda_connection_get_authentication (GdaConnection *cnc);
@@ -387,9 +395,6 @@ GdaDataModel *gda_connection_get_meta_store_data (GdaConnection *cnc, Gd
GdaDataModel *gda_connection_get_meta_store_data_v(GdaConnection *cnc, GdaConnectionMetaType
meta_type,
GList* filters, GError **error);
-//void gda_connection_lock_with_context (GdaConnection *cnc, GMainContext *context);
-//void gda_connection_unlock (GdaConnection *cnc);
-
G_END_DECLS
#endif
diff --git a/libgda/gda-server-operation.c b/libgda/gda-server-operation.c
index e799a2908..167436034 100644
--- a/libgda/gda-server-operation.c
+++ b/libgda/gda-server-operation.c
@@ -2151,98 +2151,6 @@ gda_server_operation_get_value_at (GdaServerOperation *op, const gchar *path_for
return value;
}
-/**
- * gda_server_operation_get_sql_identifier_at:
- * @op: a #GdaServerOperation object
- * @cnc: (nullable): a #GdaConnection, or %NULL
- * @prov: (nullable): a #GdaServerProvider, or %NULL
- * @path_format: a complete path to a node (starting with "/")
- * @error: (nullable): a place to store errors, or %NULL
- * @...: arguments to use with @path_format to make a complete path
- *
- * This method is similar to gda_server_operation_get_value_at(), but for SQL identifiers: a new string
- * is returned instead of a #GValue. Also the returned string is assumed to represents an SQL identifier
- * and will correctly be quoted to be used with @cnc, or @prov if @cnc is %NULL (a generic quoting rule
- * will be applied if both are %NULL).
- *
- * Returns: (transfer full): a new string, or %NULL if the value is undefined or
- * if the @path is not defined or @path does not hold any value, or if the value held is not a string
- * (in that last case a warning is shown).
- *
- * Since: 4.0.3
- */
-gchar *
-gda_server_operation_get_sql_identifier_at (GdaServerOperation *op, GdaConnection *cnc, GdaServerProvider
*prov,
- const gchar *path_format, GError **error, ...)
-{
- gchar *path, *ret;
- va_list args;
-
- g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), NULL);
-
- /* build path */
- va_start (args, error);
- path = g_strdup_vprintf (path_format, args);
- va_end (args);
-
- ret = gda_server_operation_get_sql_identifier_at_path (op, cnc, prov, path, error);
- g_free (path);
-
- return ret;
-}
-
-/**
- * gda_server_operation_get_sql_identifier_at_path: (rename-to gda_server_operation_get_sql_identifier_at)
- * @op: a #GdaServerOperation object
- * @cnc: (nullable): a #GdaConnection, or %NULL
- * @prov: (nullable): a #GdaServerProvider, or %NULL
- * @path: a complete path to a node (starting with "/")
- * @error: (nullable): a place to store errors, or %NULL
- *
- * This method is similar to gda_server_operation_get_value_at(), but for SQL identifiers: a new string
- * is returned instead of a #GValue. Also the returned string is assumed to represents an SQL identifier
- * and will correctly be quoted to be used with @cnc, or @prov if @cnc is %NULL (a generic quoting rule
- * will be applied if both are %NULL).
- *
- * Returns: (transfer full): a new string, or %NULL if the value is undefined or
- * if the @path is not defined or @path does not hold any value, or if the value held is not a string or
- * a valid SQL identifier.
- *
- * Since: 4.2.6
- */
-gchar *
-gda_server_operation_get_sql_identifier_at_path (GdaServerOperation *op, GdaConnection *cnc,
GdaServerProvider *prov,
- const gchar *path, GError **error)
-{
- const GValue *value = NULL;
- GdaConnectionOptions cncoptions = 0;
-
- g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), NULL);
-
- value = gda_server_operation_get_value_at_path (op, path);
-
- if (!value || (G_VALUE_TYPE (value) == GDA_TYPE_NULL)) {
- g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
- _("Wrong SQL identifier value"));
- return NULL;
- }
-
- g_return_val_if_fail (G_VALUE_TYPE (value) == G_TYPE_STRING, NULL);
-
- const gchar *str;
- str = g_value_get_string (value);
- if (!str || !*str) {
- g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
- _("Wrong SQL identifier value"));
- return NULL;
- }
-
- if (cnc)
- g_object_get (G_OBJECT (cnc), "options", &cncoptions, NULL);
- return gda_sql_identifier_quote (str, cnc, prov, FALSE,
- cncoptions & GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
-}
-
/**
* gda_server_operation_set_value_at_path: (rename-to gda_server_operation_set_value_at)
* @op: a #GdaServerOperation object
@@ -3133,422 +3041,6 @@ gda_server_operation_create_table_arg_get_fkey_refs (GdaServerOperationCreateTab
return arg->fkey_fields;
}
-
-/**
- * gda_server_operation_prepare_create_table_v:
- * @cnc: an opened connection
- * @table_name: name of the table to create
- * @error: a place to store errors, or %NULL
- * @...: group of three arguments for column's name, column's #GType
- * and a #GdaServerOperationCreateTableFlag flag, finished with %NULL
- *
- * Convenient funtion for table creation.
- *
- * For details about arguments see #gda_server_operation_prepare_create_table_v().
- *
- * Returns: (transfer full) (nullable): a #GdaServerOperation if no errors; NULL and set @error otherwise
- *
- * Since: 4.2.3
- */
-G_GNUC_NULL_TERMINATED
-GdaServerOperation*
-gda_server_operation_prepare_create_table_v (GdaConnection *cnc, const gchar *table_name, GError **error,
...)
-{
- GdaServerOperation *op;
-
- g_return_val_if_fail (gda_connection_is_opened (cnc), NULL);
-
- va_list args;
- gchar *arg;
- GType type;
- GdaServerOperationCreateTableFlag flag;
- gint refs;
- GList *arguments = NULL;
- GdaServerOperationCreateTableArg* argument;
-
- va_start (args, error);
- type = 0;
- arg = NULL;
- refs = -1;
-
- while ((arg = va_arg (args, gchar*))) {
- argument = gda_server_operation_create_table_arg_new ();
- /* First argument for Column's name */
- gda_server_operation_create_table_arg_set_column_name (argument, (const gchar*) arg);
-
- /* Second to Define column's type */
- type = va_arg (args, GType);
- gda_server_operation_create_table_arg_set_column_type (argument, type);
-
- /* Third for column's flags */
- flag = va_arg (args, GdaServerOperationCreateTableFlag);
- gda_server_operation_create_table_arg_set_flags (argument, flag);
- if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG) {
- gint j;
- gint fields;
- gchar *fkey_table;
- gchar *fkey_ondelete;
- gchar *fkey_onupdate;
-
- refs++;
- GList *lfields = NULL;
-
- fkey_table = va_arg (args, gchar*);
- gda_server_operation_create_table_arg_set_fkey_table (argument, fkey_table);
- /* Get number of referenced fields */
- fields = va_arg (args, gint);
-
- for (j = 0; j < fields; j++) {
- gchar *field;
- GdaServerOperationCreateTableArgFKeyRefField *rfields;
-
- /* First pair arguments give local field and referenced field */
- field = va_arg (args, gchar*);
- rfields = gda_server_operation_create_table_arg_fkey_ref_field_new ();
- gda_server_operation_create_table_arg_fkey_ref_field_set_local_field
(rfields, field);
- gda_server_operation_create_table_arg_fkey_ref_field_set_referenced_field
(rfields, field);
- lfields = g_list_append (lfields, rfields);
- }
- gda_server_operation_create_table_arg_set_fkey_refs (argument, lfields);
-
- /* ON DELETE and ON UPDATE events constraints */
- fkey_ondelete = va_arg (args, gchar*);
- gda_server_operation_create_table_arg_set_fkey_ondelete (argument, fkey_ondelete);
-
- fkey_onupdate = va_arg (args, gchar*);
- gda_server_operation_create_table_arg_set_fkey_ondupdate (argument, fkey_onupdate);
- }
-
- arguments = g_list_append (arguments, argument);
- }
-
- va_end (args);
-
- op = gda_server_operation_prepare_create_table (cnc, table_name, arguments, error);
- g_list_free_full (arguments, (GDestroyNotify) gda_server_operation_create_table_arg_free);
- return op;
-}
-
-/**
- * gda_server_operation_prepare_create_table:
- * @cnc: an opened connection
- * @table_name: name of the table to create
- * @arguments: (element-type GdaServerOperationCreateTableArg): list of arguments as
#GdaServerOperationPrepareCreateTableArg containing column's name,
- * column's #GType and a #GdaServerOperationCreateTableFlag flag
- * @error: a place to store errors, or %NULL
- *
- * Add more arguments if the flag needs them:
- *
- * GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG:
- * <itemizedlist>
- * <listitem><para>string with the table's name referenced</para></listitem>
- * <listitem><para>an integer with the number pairs "local_field", "referenced_field"
- * used in the reference</para></listitem>
- * <listitem><para>Pairs of "local_field", "referenced_field" to use, must match
- * the number specified above.</para></listitem>
- * <listitem><para>a string with the action for ON DELETE; can be: "RESTRICT", "CASCADE",
- * "NO ACTION", "SET NULL" and "SET DEFAULT". Example: "ON UPDATE CASCADE".</para></listitem>
- * <listitem><para>a string with the action for ON UPDATE (see above).</para></listitem>
- * </itemizedlist>
- *
- * Create a #GdaServerOperation object using an opened connection, taking three
- * arguments, a column's name the column's GType and #GdaServerOperationCreateTableFlag
- * flag, you need to finish the list using %NULL.
- *
- * You'll be able to modify the #GdaServerOperation object to add custom options
- * to the operation. When finished call #gda_server_operation_perform_create_table
- * or #gda_server_provider_perform_operation
- * in order to execute the operation.
- *
- * Returns: (transfer full) (nullable): a #GdaServerOperation if no errors; NULL and set @error otherwise
- *
- * Since: 6.0.0
- */
-GdaServerOperation*
-gda_server_operation_prepare_create_table (GdaConnection *cnc, const gchar *table_name, GList *arguments,
GError **error)
-{
- GdaServerOperation *op;
- GdaServerProvider *server;
-
- g_return_val_if_fail (gda_connection_is_opened (cnc), NULL);
-
- server = gda_connection_get_provider (cnc);
-
- if (!table_name) {
- g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
- "%s", _("Unspecified table name"));
- return NULL;
- }
-
- if (gda_server_provider_supports_operation (server, cnc, GDA_SERVER_OPERATION_CREATE_TABLE, NULL)) {
- gchar *cname;
- GType type;
- gchar *dbms_type;
- GdaServerOperationCreateTableFlag flag;
- gint i;
- gint refs;
-
- op = gda_server_provider_create_operation (server, cnc,
- GDA_SERVER_OPERATION_CREATE_TABLE, NULL, error);
- if (!GDA_IS_SERVER_OPERATION(op))
- return NULL;
- if(!gda_server_operation_set_value_at (op, table_name, error, "/TABLE_DEF_P/TABLE_NAME")) {
- g_object_unref (op);
- return NULL;
- }
-
- type = 0;
- cname = NULL;
- i = 0;
- refs = -1;
-
- GList *l = arguments;
- while (l != NULL) {
- GdaServerOperationCreateTableArg *argument;
- argument = (GdaServerOperationCreateTableArg*) l->data;
- cname = gda_server_operation_create_table_arg_get_column_name (argument);
- /* First argument for Column's name */
- if(!gda_server_operation_set_value_at (op, cname, error, "/FIELDS_A/@COLUMN_NAME/%d",
i)) {
- g_object_unref (op);
- return NULL;
- }
- g_free (cname);
-
- /* Second to Define column's type */
- type = gda_server_operation_create_table_arg_get_column_type (argument);
- if (type == 0) {
- g_set_error (error, GDA_SERVER_OPERATION_ERROR,
GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
- "%s", _("Invalid type"));
- g_object_unref (op);
- return NULL;
- }
- dbms_type = (gchar *) gda_server_provider_get_default_dbms_type (server,
- cnc, type);
- if (!gda_server_operation_set_value_at (op, dbms_type, error,
"/FIELDS_A/@COLUMN_TYPE/%d", i)){
- g_object_unref (op);
- return NULL;
- }
-
- /* Third for column's flags */
- flag = gda_server_operation_create_table_arg_get_flags (argument);
- if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_FLAG)
- if(!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_PKEY/%d", i)){
- g_object_unref (op);
- return NULL;
- }
- if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_NOT_NULL_FLAG)
- if(!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_NNUL/%d", i)){
- g_object_unref (op);
- return NULL;
- }
- if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_AUTOINC_FLAG)
- if (!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_AUTOINC/%d", i)){
- g_object_unref (op);
- return NULL;
- }
- if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_UNIQUE_FLAG)
- if(!gda_server_operation_set_value_at (op, "TRUE", error,
"/FIELDS_A/@COLUMN_UNIQUE/%d", i)){
- g_object_unref (op);
- return NULL;
- }
- if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG) {
- gint j;
- gchar *fkey_table;
- gchar *fkey_ondelete;
- gchar *fkey_onupdate;
-
- fkey_table = gda_server_operation_create_table_arg_get_column_name (argument);
- if (!gda_server_operation_set_value_at (op, fkey_table, error,
- "/FKEY_S/%d/FKEY_REF_TABLE", refs)){
- g_object_unref (op);
- return NULL;
- }
-
- refs++;
- GList* lr = gda_server_operation_create_table_arg_get_fkey_refs (argument);
- j = 0;
-
- while (lr) {
- gchar *field, *rfield;
- GdaServerOperationCreateTableArgFKeyRefField *ref;
- ref = (GdaServerOperationCreateTableArgFKeyRefField*) l->data;
-
- field =
gda_server_operation_create_table_arg_fkey_ref_field_get_local_field (ref);
- if(!gda_server_operation_set_value_at (op, field, error,
-
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_FIELD/%d", refs, j)){
- g_object_unref (op);
- return NULL;
- }
-
- rfield =
gda_server_operation_create_table_arg_fkey_ref_field_get_referenced_field (ref);
- if(!gda_server_operation_set_value_at (op, rfield, error,
-
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_REF_PK_FIELD/%d", refs, j)){
- g_object_unref (op);
- return NULL;
- }
- j++;
- lr = g_list_next (lr);
- }
-
- fkey_ondelete = gda_server_operation_create_table_arg_get_fkey_ondelete
(argument);
- if (!gda_server_operation_set_value_at (op, fkey_ondelete, error,
- "/FKEY_S/%d/FKEY_ONDELETE", refs)){
- g_object_unref (op);
- return NULL;
- }
- fkey_onupdate = gda_server_operation_create_table_arg_get_fkey_onupdate
(argument);
- if(!gda_server_operation_set_value_at (op, fkey_onupdate, error,
- "/FKEY_S/%d/FKEY_ONUPDATE", refs)){
- g_object_unref (op);
- return NULL;
- }
- }
-
- l = g_list_next (l);
- i++;
- }
-
- g_object_set_data_full (G_OBJECT (op), "_gda_connection", g_object_ref (cnc), g_object_unref);
-
- return op;
- }
- else {
- g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
- "%s", _("CREATE TABLE operation is not supported by the database server"));
- return NULL;
- }
-}
-
-
-/**
- * gda_server_operation_perform_create_table:
- * @op: a valid #GdaServerOperation
- * @error: a place to store errors, or %NULL
- *
- * Performs a prepared #GdaServerOperation to create a table. This could perform
- * an operation created by #gda_server_operation_prepare_create_table or any other using the
- * the #GdaServerOperation API.
- *
- * Returns: TRUE if the table was created; FALSE and set @error otherwise
- *
- * Since: 4.2.3
- */
-gboolean
-gda_server_operation_perform_create_table (GdaServerOperation *op, GError **error)
-{
- GdaConnection *cnc;
-
- g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
- g_return_val_if_fail (gda_server_operation_get_op_type (op) == GDA_SERVER_OPERATION_CREATE_TABLE,
FALSE);
-
- cnc = g_object_get_data (G_OBJECT (op), "_gda_connection");
- if (cnc)
- return gda_server_provider_perform_operation (gda_connection_get_provider (cnc), cnc, op,
error);
- else {
- g_warning ("Could not find operation's associated connection, "
- "did you use gda_connection_prepare_create_table() ?");
- return FALSE;
- }
-}
-
-/**
- * gda_server_operation_prepare_drop_table:
- * @cnc: an opened connection
- * @table_name: name of the table to drop
- * @error: a place to store errors, or %NULL
- *
- * This is just a convenient function to create a #GdaServerOperation to drop a
- * table in an opened connection.
- *
- * Returns: (transfer full) (nullable): a new #GdaServerOperation or %NULL if couldn't create the
opereration.
- *
- * Since: 4.2.3
- */
-GdaServerOperation*
-gda_server_operation_prepare_drop_table (GdaConnection *cnc, const gchar *table_name, GError **error)
-{
- GdaServerOperation *op;
- GdaServerProvider *server;
-
- server = gda_connection_get_provider (cnc);
-
- op = gda_server_provider_create_operation (server, cnc,
- GDA_SERVER_OPERATION_DROP_TABLE, NULL, error);
-
- if (GDA_IS_SERVER_OPERATION (op)) {
- g_return_val_if_fail (table_name != NULL
- || GDA_IS_CONNECTION (cnc)
- || !gda_connection_is_opened (cnc), NULL);
-
- if (gda_server_operation_set_value_at (op, table_name,
- error, "/TABLE_DESC_P/TABLE_NAME")) {
- g_object_set_data_full (G_OBJECT (op), "_gda_connection", g_object_ref (cnc),
g_object_unref);
- return op;
- }
- else
- return NULL;
- }
- else
- return NULL;
-}
-
-
-/**
- * gda_server_operation_perform_drop_table:
- * @op: a #GdaServerOperation object
- * @error: a place to store errors, or %NULL
- *
- * This is just a convenient function to perform a drop a table operation.
- *
- * Returns: TRUE if the table was dropped
- *
- * Since: 4.2.3
- */
-gboolean
-gda_server_operation_perform_drop_table (GdaServerOperation *op, GError **error)
-{
- GdaConnection *cnc;
-
- g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
- g_return_val_if_fail (gda_server_operation_get_op_type (op) == GDA_SERVER_OPERATION_DROP_TABLE,
FALSE);
-
- cnc = g_object_get_data (G_OBJECT (op), "_gda_connection");
- if (cnc)
- return gda_server_provider_perform_operation (gda_connection_get_provider (cnc), cnc, op,
error);
- else {
- g_warning ("Could not find operation's associated connection, "
- "did you use gda_server_operation_prepare_drop_table() ?");
- return FALSE;
- }
-}
-
-/**
- * gda_server_operation_perform:
- * @op: a #GdaServerOperation object
- * @error: (allow-none): a place to store an error, or %NULL
- *
- * Performs the operation described by @op. Note that @op is not destroyed by this method
- * and can be reused.
- *
- * Returns: %TRUE if no error occurred
- */
-gboolean
-gda_server_operation_perform (GdaServerOperation *op, GError **error)
-{
- GdaServerProvider *provider;
- GdaConnection *cnc;
-
- g_return_val_if_fail (op,FALSE);
- g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
-
- g_object_get (op,"provider",&provider,"connection",&cnc,NULL);
-
- g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), FALSE);
- g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-
- return gda_server_provider_perform_operation (provider,cnc,op,error);
-}
-
/**
* gda_server_operation_render:
* @op: a #GdaServerOperation object
diff --git a/libgda/gda-server-operation.h b/libgda/gda-server-operation.h
index ee9476c3e..b4dce92cf 100644
--- a/libgda/gda-server-operation.h
+++ b/libgda/gda-server-operation.h
@@ -206,11 +206,9 @@ GdaServerOperationNode *gda_server_operation_get_node_info (GdaServ
const GValue *gda_server_operation_get_value_at (GdaServerOperation *op, const gchar
*path_format, ...);
const GValue *gda_server_operation_get_value_at_path (GdaServerOperation *op, const gchar
*path);
gchar *gda_server_operation_get_sql_identifier_at (GdaServerOperation *op,
- GdaConnection *cnc,
GdaServerProvider *prov,
const gchar *path_format, GError
**error,
- ...);
+ ...);
gchar *gda_server_operation_get_sql_identifier_at_path (GdaServerOperation *op,
- GdaConnection *cnc,
GdaServerProvider *prov,
const gchar *path, GError
**error);
gboolean gda_server_operation_set_value_at (GdaServerOperation *op, const gchar
*value,
GError **error, const gchar
*path_format, ...);
@@ -244,11 +242,6 @@ gboolean gda_server_operation_is_valid_from_resource (GdaServ
/*
* Database creation and destruction
*/
-GdaServerOperation *gda_server_operation_prepare_create_database (const gchar *provider, const gchar
*db_name, GError **error);
-gboolean gda_server_operation_perform_create_database (GdaServerOperation *op, const gchar
*provider, GError **error);
-GdaServerOperation *gda_server_operation_prepare_drop_database (const gchar *provider, const gchar
*db_name, GError **error);
-gboolean gda_server_operation_perform_drop_database (GdaServerOperation *op, const gchar
*provider, GError **error);
-gboolean gda_server_operation_perform (GdaServerOperation *op, GError
**error);
gchar *gda_server_operation_render (GdaServerOperation *op, GError
**error);
/*
diff --git a/libgda/sqlite/gda-sqlite-ddl.c b/libgda/sqlite/gda-sqlite-ddl.c
index 96fd1efed..5819a06cf 100644
--- a/libgda/sqlite/gda-sqlite-ddl.c
+++ b/libgda/sqlite/gda-sqlite-ddl.c
@@ -59,7 +59,7 @@ _gda_sqlite_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, "IF NOT EXISTS ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DEF_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
g_assert (*error != NULL);
@@ -85,7 +85,7 @@ _gda_sqlite_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc
for (i = 0; i < nrows; i++) {
value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_PKEY/%d", i);
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value)) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error,
i);
if (!tmp) {
@@ -108,7 +108,7 @@ _gda_sqlite_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc
else
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error,
i);
if (!tmp) {
g_string_free (string, TRUE);
@@ -284,7 +284,7 @@ _gda_sqlite_render_DROP_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, " IF EXISTS");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -310,7 +310,7 @@ _gda_sqlite_render_RENAME_TABLE (GdaServerProvider *provider, GdaConnection *cnc
/* DROP TABLE */
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -318,7 +318,7 @@ _gda_sqlite_render_RENAME_TABLE (GdaServerProvider *provider, GdaConnection *cnc
g_string_append (string, tmp);
g_free (tmp);
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NEW_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NEW_NAME",
error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -345,7 +345,7 @@ _gda_sqlite_render_ADD_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
/* DROP TABLE */
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DEF_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -355,7 +355,7 @@ _gda_sqlite_render_ADD_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, " ADD COLUMN ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DEF_P/COLUMN_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DEF_P/COLUMN_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -437,7 +437,7 @@ _gda_sqlite_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cnc
g_string_append (string, " IF NOT EXISTS ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DEF_P/INDEX_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DEF_P/INDEX_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -447,7 +447,7 @@ _gda_sqlite_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cnc
g_string_append (string, " ON ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DEF_P/INDEX_ON_TABLE",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DEF_P/INDEX_ON_TABLE", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -461,7 +461,7 @@ _gda_sqlite_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cnc
g_assert (node);
nrows = gda_server_operation_get_sequence_size (op, "/INDEX_FIELDS_S");
for (i = 0; i < nrows; i++) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/INDEX_FIELDS_S/%d/INDEX_FIELD", error, i);
if (tmp) {
if (i != 0)
@@ -518,7 +518,7 @@ _gda_sqlite_render_DROP_INDEX (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, "IF EXISTS ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DESC_P/INDEX_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DESC_P/INDEX_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -553,7 +553,7 @@ _gda_sqlite_render_CREATE_VIEW (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, "IF NOT EXISTS ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/VIEW_DEF_P/VIEW_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/VIEW_DEF_P/VIEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -595,7 +595,7 @@ _gda_sqlite_render_DROP_VIEW (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, " IF EXISTS");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/VIEW_DESC_P/VIEW_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/VIEW_DESC_P/VIEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
diff --git a/providers/mysql/gda-mysql-ddl.c b/providers/mysql/gda-mysql-ddl.c
index 9c11375c6..bcb502331 100644
--- a/providers/mysql/gda-mysql-ddl.c
+++ b/providers/mysql/gda-mysql-ddl.c
@@ -40,7 +40,7 @@ gda_mysql_render_CREATE_DB (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, "IF NOT EXISTS ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/DB_DEF_P/DB_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/DB_DEF_P/DB_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -57,7 +57,7 @@ gda_mysql_render_CREATE_DB (GdaServerProvider *provider, GdaConnection *cnc,
}
if (gda_server_operation_get_value_at_path (op, "/DB_DEF_P/DB_COLLATION")) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
"/DB_DEF_P/DB_COLLATION", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/DB_DEF_P/DB_COLLATION",
error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -93,7 +93,7 @@ gda_mysql_render_DROP_DB (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, "IF EXISTS ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/DB_DESC_P/DB_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/DB_DESC_P/DB_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -134,7 +134,7 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, "IF NOT EXISTS ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DEF_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -155,7 +155,7 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
for (i = 0; i < nrows; i++) {
value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_PKEY/%d", i);
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value)) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d",
error, i);
if (!tmp) {
@@ -177,7 +177,7 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
else
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error, i);
if (!tmp) {
g_string_free (string, TRUE);
@@ -300,7 +300,7 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
for (j = 0; j < nbfields; j++) {
if (j != 0)
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_FIELD/%d",
error, i, j);
if (tmp) {
@@ -314,7 +314,7 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
}
}
g_string_append (string, ") REFERENCES ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FKEY_S/%d/FKEY_REF_TABLE", error,
i);
if (tmp) {
g_string_append (string, tmp);
@@ -329,7 +329,7 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
for (j = 0; j < nbfields; j++) {
if (j != 0)
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_REF_PK_FIELD/%d",
error, i, j);
if (tmp) {
@@ -386,7 +386,7 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, g_value_get_string (value));
if (gda_server_operation_get_value_at_path (op, "/TABLE_OPTIONS_P/TABLE_COLLATION")) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/TABLE_OPTIONS_P/TABLE_COLLATION",
error);
if (!tmp) {
g_string_free (string, TRUE);
@@ -529,7 +529,7 @@ gda_mysql_render_DROP_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, " IF EXISTS");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -561,7 +561,7 @@ gda_mysql_render_RENAME_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -570,7 +570,7 @@ gda_mysql_render_RENAME_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, tmp);
g_free (tmp);
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NEW_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -598,7 +598,7 @@ gda_mysql_render_COMMENT_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -631,7 +631,7 @@ gda_mysql_render_ADD_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DEF_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -642,7 +642,7 @@ gda_mysql_render_ADD_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, " ADD COLUMN ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DEF_P/COLUMN_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DEF_P/COLUMN_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -748,7 +748,7 @@ gda_mysql_render_DROP_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -757,7 +757,7 @@ gda_mysql_render_DROP_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, tmp);
g_free (tmp);
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DESC_P/COLUMN_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DESC_P/COLUMN_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -787,7 +787,7 @@ gda_mysql_render_COMMENT_COLUMN (GdaServerProvider *provider, GdaConnection *cnc
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -797,7 +797,7 @@ gda_mysql_render_COMMENT_COLUMN (GdaServerProvider *provider, GdaConnection *cnc
g_string_append (string, tmp);
g_free (tmp);
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DESC_P/COLUMN_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DESC_P/COLUMN_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -884,7 +884,7 @@ gda_mysql_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, "INDEX ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DEF_P/INDEX_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DEF_P/INDEX_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -901,7 +901,7 @@ gda_mysql_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, " ON ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DEF_P/INDEX_ON_TABLE",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DEF_P/INDEX_ON_TABLE", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -916,7 +916,7 @@ gda_mysql_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cnc,
g_assert (node);
nrows = gda_server_operation_get_sequence_size (op, "/INDEX_FIELDS_S");
for (i = 0; i < nrows; i++) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/INDEX_FIELDS_S/%d/INDEX_FIELD", error, i);
if (!tmp) {
g_string_free (string, TRUE);
@@ -957,7 +957,7 @@ gda_mysql_render_DROP_INDEX (GdaServerProvider *provider, GdaConnection *cnc,
string = g_string_new ("DROP INDEX ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DESC_P/INDEX_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DESC_P/INDEX_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -966,7 +966,7 @@ gda_mysql_render_DROP_INDEX (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, tmp);
g_free (tmp);
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DESC_P/INDEX_ON_TABLE",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DESC_P/INDEX_ON_TABLE", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -1001,7 +1001,7 @@ gda_mysql_render_CREATE_VIEW (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, "VIEW ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/VIEW_DEF_P/VIEW_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/VIEW_DEF_P/VIEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -1020,7 +1020,7 @@ gda_mysql_render_CREATE_VIEW (GdaServerProvider *provider, GdaConnection *cnc,
if (i == 0)
g_string_append (string, " (");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error,
i);
if (!tmp) {
g_string_free (string, TRUE);
@@ -1072,7 +1072,7 @@ gda_mysql_render_DROP_VIEW (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, " IF EXISTS");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/VIEW_DESC_P/VIEW_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/VIEW_DESC_P/VIEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
diff --git a/providers/postgres/gda-postgres-ddl.c b/providers/postgres/gda-postgres-ddl.c
index 11f5a783e..9af18d4ef 100644
--- a/providers/postgres/gda-postgres-ddl.c
+++ b/providers/postgres/gda-postgres-ddl.c
@@ -36,7 +36,7 @@ gda_postgres_render_CREATE_DB (GdaServerProvider *provider, GdaConnection *cnc,
string = g_string_new ("CREATE DATABASE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/DB_DEF_P/DB_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/DB_DEF_P/DB_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -93,7 +93,7 @@ gda_postgres_render_DROP_DB (GdaServerProvider *provider, GdaConnection *cnc,
string = g_string_new ("DROP DATABASE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/DB_DESC_P/DB_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/DB_DESC_P/DB_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -131,7 +131,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
g_string_append (string, "TEMP ");
g_string_append (string, "TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/TABLE_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
@@ -153,7 +153,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
for (i = 0; i < nrows; i++) {
value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_PKEY/%d", i);
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value)) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error,
i);
if (!tmp) {
g_string_free (string, TRUE);
@@ -174,7 +174,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
else
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error, i);
if (!tmp) {
g_string_free (string, TRUE);
@@ -251,7 +251,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
for (i = 0; i < nrows; i++) {
value = gda_server_operation_get_value_at (op, "/TABLE_PARENTS_S/%d/TABLE_PARENT_COPY", i);
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && !g_value_get_boolean (value)) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/TABLE_PARENTS_S/%d/TABLE_PARENT_TABLE",
error, i);
if (!tmp) {
@@ -314,7 +314,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
for (j = 0; j < nbfields; j++) {
if (j != 0)
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_FIELD/%d",
error, i, j);
if (tmp) {
@@ -329,7 +329,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
}
g_string_append (string, ") REFERENCES ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FKEY_S/%d/FKEY_REF_TABLE", error,
i);
if (tmp) {
g_string_append (string, tmp);
@@ -344,7 +344,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
for (j = 0; j < nbfields; j++) {
if (j != 0)
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FKEY_S/%d/FKEY_FIELDS_A/@FK_REF_PK_FIELD/%d",
error, i, j);
if (tmp) {
@@ -380,7 +380,7 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
for (i = 0; i < nrows; i++) {
value = gda_server_operation_get_value_at (op, "/TABLE_PARENTS_S/%d/TABLE_PARENT_COPY", i);
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value)) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/TABLE_PARENTS_S/%d/TABLE_PARENT_TABLE",
error, i);
if (tmp) {
@@ -430,7 +430,7 @@ gda_postgres_render_DROP_TABLE (GdaServerProvider *provider, GdaConnection *cn
string = g_string_new ("DROP TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/TABLE_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
@@ -462,7 +462,7 @@ gda_postgres_render_RENAME_TABLE (GdaServerProvider *provider, GdaConnection *cn
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -471,7 +471,7 @@ gda_postgres_render_RENAME_TABLE (GdaServerProvider *provider, GdaConnection *cn
g_string_append (string, tmp);
g_free (tmp);
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DESC_P/TABLE_NEW_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DESC_P/TABLE_NEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -503,7 +503,7 @@ gda_postgres_render_ADD_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, "ONLY ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DEF_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -514,7 +514,7 @@ gda_postgres_render_ADD_COLUMN (GdaServerProvider *provider, GdaConnection *cnc,
g_string_append (string, " ADD COLUMN ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DEF_P/COLUMN_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DEF_P/COLUMN_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -587,7 +587,7 @@ gda_postgres_render_DROP_COLUMN (GdaServerProvider *provider, GdaConnection *cn
string = g_string_new ("ALTER TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DESC_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DESC_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -595,7 +595,7 @@ gda_postgres_render_DROP_COLUMN (GdaServerProvider *provider, GdaConnection *cn
g_string_append (string, tmp);
g_free (tmp);
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/COLUMN_DESC_P/COLUMN_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/COLUMN_DESC_P/COLUMN_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -643,7 +643,7 @@ gda_postgres_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cn
g_string_append (string, "INDEX ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DEF_P/INDEX_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DEF_P/INDEX_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -654,7 +654,7 @@ gda_postgres_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cn
g_string_append (string, " ON ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DEF_P/INDEX_ON_TABLE",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DEF_P/INDEX_ON_TABLE", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -675,7 +675,7 @@ gda_postgres_render_CREATE_INDEX (GdaServerProvider *provider, GdaConnection *cn
g_assert (node);
nrows = gda_server_operation_get_sequence_size (op, "/INDEX_FIELDS_S");
for (i = 0; i < nrows; i++) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/INDEX_FIELDS_S/%d/INDEX_FIELD", error, i);
if (tmp) {
if (i != 0)
@@ -722,7 +722,7 @@ gda_postgres_render_DROP_INDEX (GdaServerProvider *provider, GdaConnection *cn
string = g_string_new ("DROP INDEX ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DESC_P/INDEX_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/INDEX_DESC_P/INDEX_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -764,7 +764,7 @@ gda_postgres_render_CREATE_VIEW (GdaServerProvider *provider, GdaConnection *cnc
g_string_append (string, "VIEW ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/VIEW_DEF_P/VIEW_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/VIEW_DEF_P/VIEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -782,7 +782,7 @@ gda_postgres_render_CREATE_VIEW (GdaServerProvider *provider, GdaConnection *cnc
nrows = gda_data_model_get_n_rows (node->model);
for (i = 0; i < nrows; i++) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d",
error, i);
if (!tmp) {
@@ -828,7 +828,7 @@ gda_postgres_render_DROP_VIEW (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, " IF EXISTS");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/VIEW_DESC_P/VIEW_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
@@ -875,7 +875,7 @@ gda_postgres_render_CREATE_USER (GdaServerProvider *provider, GdaConnection *cnc
else
string = g_string_new ("CREATE USER ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/USER_DEF_P/USER_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/USER_DEF_P/USER_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -982,10 +982,10 @@ gda_postgres_render_CREATE_USER (GdaServerProvider *provider, GdaConnection *cnc
for (first = TRUE, i = 0; i < nrows; i++) {
gchar *name;
if (use_role)
- name = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
"/GROUPS_S/%d/ROLE",
+ name = gda_connection_operation_get_sql_identifier_at (cnc, op, "/GROUPS_S/%d/ROLE",
error, i);
else
- name = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
"/GROUPS_S/%d/USER",
+ name = gda_connection_operation_get_sql_identifier_at (cnc, op, "/GROUPS_S/%d/USER",
error, i);
if (name) {
@@ -1011,7 +1011,7 @@ gda_postgres_render_CREATE_USER (GdaServerProvider *provider, GdaConnection *cnc
nrows = gda_server_operation_get_sequence_size (op, "/ROLES_S");
for (first = TRUE, i = 0; i < nrows; i++) {
gchar *name;
- name = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/ROLES_S/%d/ROLE",
error, i);
+ name = gda_connection_operation_get_sql_identifier_at (cnc, op, "/ROLES_S/%d/ROLE", error, i);
if (name) {
if (first) {
first = FALSE;
@@ -1032,7 +1032,7 @@ gda_postgres_render_CREATE_USER (GdaServerProvider *provider, GdaConnection *cnc
nrows = gda_server_operation_get_sequence_size (op, "/ADMINS_S");
for (first = TRUE, i = 0; i < nrows; i++) {
gchar *name;
- name = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/ADMINS_S/%d/ROLE",
error, i);
+ name = gda_connection_operation_get_sql_identifier_at (cnc, op, "/ADMINS_S/%d/ROLE", error,
i);
if (name) {
if (first) {
first = FALSE;
@@ -1103,7 +1103,7 @@ gda_postgres_render_DROP_USER (GdaServerProvider *provider, GdaConnection *cnc,
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
g_string_append (string, " IF EXISTS");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/USER_DESC_P/USER_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
diff --git a/providers/skel-implementation/capi/gda-capi-ddl.c
b/providers/skel-implementation/capi/gda-capi-ddl.c
index 30535b748..c10d6d1c3 100644
--- a/providers/skel-implementation/capi/gda-capi-ddl.c
+++ b/providers/skel-implementation/capi/gda-capi-ddl.c
@@ -43,7 +43,7 @@ gda_capi_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
/* CREATE TABLE */
string = g_string_new ("CREATE TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/TABLE_DEF_P/TABLE_NAME",
error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -64,7 +64,7 @@ gda_capi_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
for (i = 0; i < nrows; i++) {
value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_PKEY/%d", i);
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value)) {
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error, i);
if (!tmp) {
g_string_free (string, TRUE);
@@ -84,7 +84,7 @@ gda_capi_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
else
g_string_append (string, ", ");
- tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider,
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error,
i);
if (!tmp) {
g_string_free (string, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]