Re: [gnome-db] API Break Request for gda_insert_row_into_table
- From: "Daniel Espinosa" <esodan gmail com>
- To: "Vivien Malerba" <vmalerba gmail com>
- Cc: gnome-db-list gnome org
- Subject: Re: [gnome-db] API Break Request for gda_insert_row_into_table
- Date: Mon, 29 Dec 2008 09:28:03 -0600
2008/12/29 Vivien Malerba
<vmalerba gmail com>
2008/12/28 Daniel Espinosa
<esodan gmail com>
Sorry again I missed the file (its the time :-)
2008/12/28 Daniel Espinosa
<esodan gmail com>
For GType to String and String to GType I found the following:
gda_g_type_from_string
This function doesn't use the standard g_type_from_name and the name of the string it checks doesn't correspond with the standard g_type_name retuning string
gda_g_type_to_string
This function use the standard g_type_name, but the above don't.
But even after applying the attached PATCH (its a mix with the GdaBatchStatement) the error doesn't desapear:
Could not determine GType for parameter '2+:string:N'
The correct syntax is <param_name>[::<type>[::NULL]]
Also the patch you sent me does not include the gda-batch-statement.[ch] files.
Thanks,
Vivien
Thanks, for your help.
Find attached the required .ch files, sorry for the inconvenience.
--
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los cuates: LIBRE)
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* gda-easy-test
* Copyright (C) Daniel Espinosa Ortiz 2008 <esodan gmail com>
*
* gda-easy-test is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gda-easy-test is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gda-batch-statement.h>
#include <libgda/gda-set.h>
#include <libgda/gda-holder.h>
#include <libgda/gda-connection.h>
typedef struct _GdaBatchStatementPrivate GdaBatchStatementPrivate;
struct _GdaBatchStatementPrivate
{
GdaStatement* statement;
GSList* parameters;
};
#define GDA_BATCH_STATEMENT_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDA_TYPE_BATCH_STATEMENT, GdaBatchStatementPrivate))
enum
{
PROP_0,
PROP_STATEMENT
};
G_DEFINE_TYPE (GdaBatchStatement, gda_batch_statement, G_TYPE_OBJECT);
static void
gda_batch_statement_init (GdaBatchStatement *object)
{
GdaBatchStatementPrivate *priv;
priv = GDA_BATCH_STATEMENT_PRIVATE (object);
priv->statement = NULL;
priv->parameters = NULL;
}
static void unref_object (gpointer data, gpointer user_data)
{
g_object_unref (data);
}
static void
gda_batch_statement_finalize (GObject *object)
{
GdaBatchStatementPrivate *priv;
priv = GDA_BATCH_STATEMENT_PRIVATE (object);
g_object_unref (priv->statement);
g_slist_foreach (priv->parameters, unref_object, NULL);
g_slist_free (priv->parameters);
G_OBJECT_CLASS (gda_batch_statement_parent_class)->finalize (object);
}
static void
gda_batch_statement_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GdaBatchStatementPrivate *priv;
g_return_if_fail (GDA_IS_BATCH_STATEMENT (object));
priv = GDA_BATCH_STATEMENT_PRIVATE (object);
switch (prop_id)
{
case PROP_STATEMENT:
priv->statement = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gda_batch_statement_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GdaBatchStatementPrivate *priv;
g_return_if_fail (GDA_IS_BATCH_STATEMENT (object));
priv = GDA_BATCH_STATEMENT_PRIVATE (object);
switch (prop_id)
{
case PROP_STATEMENT:
g_value_set_object (value, priv->statement);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gda_batch_statement_class_init (GdaBatchStatementClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
GObjectClass* parent_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GdaBatchStatementPrivate));
object_class->finalize = gda_batch_statement_finalize;
object_class->set_property = gda_batch_statement_set_property;
object_class->get_property = gda_batch_statement_get_property;
g_object_class_install_property (object_class,
PROP_STATEMENT,
g_param_spec_object ("statement",
"stm",
"Statement to Execute",
GDA_TYPE_STATEMENT,
G_PARAM_WRITABLE | G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY));
}
/**
* gda_batch_statement_new
* @stmt: a #GdaStatement object
*
* Creates a new #GdaBatchStatement object using @stmt as a template
* for execution by #gda_connection_batch_statement_execute
*
* Returns: a new #GdaBatchStatement object
*/
GdaBatchStatement*
gda_batch_statement_new (GdaStatement *stm)
{
GdaBatchStatement *bstm;
bstm = GDA_BATCH_STATEMENT (g_object_new (GDA_TYPE_BATCH_STATEMENT, "statement", stm, NULL));
return bstm;
}
/**
* gda_batch_statement_get_parameters
* @bstm: a #GdaBatchStatement object
* @set: a place to store the returned parameters used by the internal statement
* @error: a place to store error, or %NULL
*
* Gets a #GdaSet object with the parameters used by the internal statement in the
* @bstm object, required by its execution using #gda_connection_batch_statement_execute.
*
* Returns: TRUE on success, FALSE on error
*/
gboolean
gda_batch_statement_get_parameters (GdaBatchStatement *bstm, GdaSet **set, GError **error)
{
GdaBatchStatementPrivate *priv;
priv = GDA_BATCH_STATEMENT_PRIVATE (bstm);
return gda_statement_get_parameters (priv->statement, set, error);
}
/**
* gda_batch_statement_get_all_parameters
* @bstm: a #GdaBatchStatement object
*
* Gets all #GdaSet objects stored in @bstm that will be used by the internal statement
* required to execute each statement; don't modify the returned pointer.
*
* Returns: a #GSList.
*/
GSList*
gda_batch_statement_get_all_parameters (GdaBatchStatement *bstm)
{
GdaBatchStatementPrivate *priv;
priv = GDA_BATCH_STATEMENT_PRIVATE (bstm);
return priv->parameters;
}
/**
* gda_batch_statement_add_values
* @stmt: a #GdaStatement object
* @values: a #GdaSet object with the parameters to be used
* @error: a place to store errors, or %NULL
*
* Add new values to the #GdaBatchStatement object, in order to be used by
* the internal statement when it is executed by #gda_connection_batch_statement_execute.
* As many #GdaSet objects @stmt have, as many statements will be executed.
*
* Returns: a new #GdaBatchStatement object
*/
gboolean
gda_batch_statement_append_values (GdaBatchStatement *bstm, GdaSet *values)
{
GdaBatchStatementPrivate *priv;
g_return_val_if_fail (GDA_IS_BATCH_STATEMENT(bstm), FALSE);
g_return_val_if_fail (GDA_IS_SET (values), FALSE);
priv = GDA_BATCH_STATEMENT_PRIVATE (bstm);
priv->parameters = g_slist_prepend (priv->parameters, values);
return TRUE;
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* gda-easy-test
* Copyright (C) Daniel Espinosa Ortiz 2008 <esodan gmail com>
*
* gda-easy-test is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gda-easy-test is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GDA_BATCH_STATEMENT_H_
#define _GDA_BATCH_STATEMENT_H_
#include <glib-object.h>
#include <libgda/gda-statement.h>
G_BEGIN_DECLS
#define GDA_TYPE_BATCH_STATEMENT (gda_batch_statement_get_type ())
#define GDA_BATCH_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDA_TYPE_BATCH_STATEMENT, GdaBatchStatement))
#define GDA_BATCH_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDA_TYPE_BATCH_STATEMENT, GdaBatchStatementClass))
#define GDA_IS_BATCH_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDA_TYPE_BATCH_STATEMENT))
#define GDA_IS_BATCH_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDA_TYPE_BATCH_STATEMENT))
#define GDA_BATCH_STATEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDA_TYPE_BATCH_STATEMENT, GdaBatchStatementClass))
typedef struct _GdaBatchStatementClass GdaBatchStatementClass;
typedef struct _GdaBatchStatement GdaBatchStatement;
struct _GdaBatchStatementClass
{
GObjectClass parent_class;
};
struct _GdaBatchStatement
{
GObject parent_instance;
};
GType gda_batch_statement_get_type (void) G_GNUC_CONST;
GdaBatchStatement* gda_batch_statement_new (GdaStatement *stm);
gboolean gda_batch_statement_get_parameters (GdaBatchStatement *bstm, GdaSet **set, GError **error);
GSList* gda_batch_statement_get_all_parameters (GdaBatchStatement *bstm);
gboolean gda_batch_statement_append_values (GdaBatchStatement *bstm, GdaSet *values);
GSList* gda_batch_statement_execute (GdaBatchStatement *bstm, GdaConnection *cnc,
GdaStatementModelUsage model_usage, GError **error);
G_END_DECLS
#endif /* _GDA_BATCH_STATEMENT_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]