}
else
{
- prefix = g_strdup (table_name);
+ prefix = g_strdup (table_prefix);
}
/* roles */
sql = g_strdup_printf ("SELECT role_id FROM %s ORDER BY id",
table_name);
dm = gda_execute_select_command (gdacon, sql, &error);
- if (dm != NULL)
+ g_free (sql);
+ if (dm != NULL && error == NULL)
{
rows = gda_data_model_get_n_rows (dm);
for (row = 0; row < rows; row++)
irole = AUTOZ_IROLE (autoz_role_new (gda_value_stringify (gda_data_model_get_value_at (dm, 0, row, &error))));
autoz_add_role (autoz, irole);
}
+
+ g_object_unref (dm);
}
else if (error != NULL)
{
prefix,
prefix);
dm = gda_execute_select_command (gdacon, sql, &error);
- if (dm != NULL)
+ g_free (sql);
+ if (dm != NULL && error == NULL)
{
rows = gda_data_model_get_n_rows (dm);
for (row = 0; row < rows; row++)
{
error = NULL;
irole = AUTOZ_IROLE (autoz_role_new (gda_value_stringify (gda_data_model_get_value_at (dm, 0, row, &error))));
+ error = NULL;
irole_parent = AUTOZ_IROLE (autoz_role_new (gda_value_stringify (gda_data_model_get_value_at (dm, 1, row, &error))));
autoz_add_parent_to_role (autoz, irole, irole_parent);
}
+
+ g_object_unref (dm);
}
else if (error != NULL)
{
sql = g_strdup_printf ("SELECT resource_id FROM %s ORDER BY id",
table_name);
dm = gda_execute_select_command (gdacon, sql, &error);
- if (dm != NULL)
+ g_free (sql);
+ if (dm != NULL && error == NULL)
{
rows = gda_data_model_get_n_rows (dm);
for (row = 0; row < rows; row++)
iresource = AUTOZ_IRESOURCE (autoz_resource_new (gda_value_stringify (gda_data_model_get_value_at (dm, 0, row, &error))));
autoz_add_resource (autoz, iresource);
}
+
+ g_object_unref (dm);
}
else if (error != NULL)
{
prefix,
prefix);
dm = gda_execute_select_command (gdacon, sql, &error);
- if (dm != NULL)
+ g_free (sql);
+ if (dm != NULL && error == NULL)
{
rows = gda_data_model_get_n_rows (dm);
for (row = 0; row < rows; row++)
{
error = NULL;
iresource = AUTOZ_IRESOURCE (autoz_resource_new (gda_value_stringify (gda_data_model_get_value_at (dm, 0, row, &error))));
+ error = NULL;
iresource_parent = AUTOZ_IRESOURCE (autoz_resource_new (gda_value_stringify (gda_data_model_get_value_at (dm, 1, row, &error))));
autoz_add_parent_to_resource (autoz, iresource, iresource_parent);
}
+
+ g_object_unref (dm);
}
else if (error != NULL)
{
prefix,
prefix);
dm = gda_execute_select_command (gdacon, sql, &error);
- if (dm != NULL)
+ g_free (sql);
+ if (dm != NULL && error == NULL)
{
rows = gda_data_model_get_n_rows (dm);
for (row = 0; row < rows; row++)
irole = autoz_get_role_from_id (autoz, role_id);
if (irole != NULL)
{
+ error = NULL;
gval = gda_data_model_get_value_at (dm, 2, row, &error);
if (gval == NULL || gda_value_is_null (gval))
{
+ if (error != NULL)
+ {
+ g_warning ("Error on reading resource value: %s",
+ error != NULL && error->message != NULL ? error->message : "no details");
+ }
iresource = NULL;
}
else
iresource = autoz_get_resource_from_id (autoz, resource_id);
}
+ error = NULL;
gval = gda_data_model_get_value_at (dm, 0, row, &error);
if (gval == NULL || error != NULL)
{
}
}
}
+
+ g_object_unref (dm);
}
else if (error != NULL)
{
error->message != NULL ? error->message : "no details");
}
+ g_free (prefix);
+
return ret;
}
/* PRIVATE */
static void
autoz_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
Autoz *autoz = (Autoz *)object;
-
AutozPrivate *priv = AUTOZ_GET_PRIVATE (autoz);
switch (property_id)
static void
autoz_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
Autoz *autoz = (Autoz *)object;
-
AutozPrivate *priv = AUTOZ_GET_PRIVATE (autoz);
switch (property_id)