gchar *keys_sql;
} Table;
-typedef struct
-{
- gint id;
- gchar *name;
- gchar *cnc_string;
- GdaEx *gdaex;
- GList *tables;
-} Datasource;
-
typedef struct
{
gchar **values;
static ZakAudit *zak_audit_new_ (void);
static gboolean load_fields (ZakAudit *zak_audit,
- Datasource *datasource,
+ ZakAuditDatasource *datasource,
Table *table);
static gboolean load_tables (ZakAudit *zak_audit,
- Datasource *datasource);
+ ZakAuditDatasource *datasource);
static gboolean load_datasources (ZakAudit *zak_audit, va_list ap);
static Field *get_field_from_name (ZakAudit *zak_audit,
Table *table,
const char *field);
static Table *get_table_from_name (ZakAudit *zak_audit,
- Datasource *datasource,
+ ZakAuditDatasource *datasource,
const char *table);
-static Datasource *get_datasource_from_name (ZakAudit *zak_audit,
+static ZakAuditDatasource *get_datasource_from_name (ZakAudit *zak_audit,
const char *datasource);
static gboolean insert_value (ZakAudit *zak_audit,
gint id_actions,
static gboolean
load_fields (ZakAudit *zak_audit,
- Datasource *datasource,
+ ZakAuditDatasource *datasource,
Table *table)
{
GdaDataModel *dm;
static gboolean
load_tables (ZakAudit *zak_audit,
- Datasource *datasource)
+ ZakAuditDatasource *datasource)
{
GdaDataModel *dm;
gchar *sql;
gchar *sql;
gint rows;
gint row;
- Datasource *datas;
+ ZakAuditDatasource *datas;
GString *str_in;
char *datasource_name;
for (row = 0; row < rows; row++)
{
- datas = g_new0 (Datasource, 1);
+ datas = g_new0 (ZakAuditDatasource, 1);
datas->id = gdaex_data_model_get_field_value_integer_at (dm, row, "id");
datas->name = gdaex_data_model_get_field_value_stringify_at (dm, row, "name");
static Table
*get_table_from_name (ZakAudit *zak_audit,
- Datasource *datasource,
+ ZakAuditDatasource *datasource,
const char *table)
{
Table *ret_table;
return ret_table;
}
-static Datasource
+static ZakAuditDatasource
*get_datasource_from_name (ZakAudit *zak_audit,
const char *datasource)
{
- Datasource *ret_datasource;
+ ZakAuditDatasource *ret_datasource;
ZakAuditPrivate *priv = ZAK_AUDIT_GET_PRIVATE (zak_audit);
ret_datasource = NULL;
while (f != NULL)
{
- if (g_strcmp0 (((Datasource *)f->data)->name, real_datasource) == 0)
+ if (g_strcmp0 (((ZakAuditDatasource *)f->data)->name, real_datasource) == 0)
{
- ret_datasource = (Datasource *)f->data;
+ ret_datasource = (ZakAuditDatasource *)f->data;
}
f = g_list_next (f);
gint cols;
gint col;
GDateTime *gdt;
- Datasource *datasource;
+ ZakAuditDatasource *datasource;
Table *table;
ZakAuditPrivate *priv = ZAK_AUDIT_GET_PRIVATE (zak_audit);
{
gboolean ret;
- Datasource *datasource;
+ ZakAuditDatasource *datasource;
Table *table;
GdaConnection *conn;
GtkWidget *ret;
- Datasource *datasource;
+ ZakAuditDatasource *datasource;
Table *table;
Field *field;
const gchar *table_name,
const gchar **key_values)
{
- Datasource *datasource;
+ ZakAuditDatasource *datasource;
Table *table;
Field *field;
{
GdaDataModel *dm;
gchar *sql;
- Datasource *datasource;
+ ZakAuditDatasource *datasource;
/* find the datasource */
datasource = get_datasource_from_name (zak_audit, datasource_name);
return ret;
}
+
+ZakAuditDatasource
+*zak_audit_datasource_copy (ZakAuditDatasource *datasource)
+{
+ ZakAuditDatasource *b;
+
+ b = g_slice_new (ZakAuditDatasource);
+ b->id = datasource->id;
+ b->name = g_strdup (datasource->name);
+ b->cnc_string = g_strdup (datasource->cnc_string);
+ b->gdaex = g_object_ref (datasource->gdaex);
+ b->tables = g_list_copy (datasource->tables);
+
+ return b;
+}
+
+void
+zak_audit_datasource_free (ZakAuditDatasource *datasource)
+{
+ g_free (datasource->name);
+ g_free (datasource->cnc_string);
+ g_object_unref (datasource->gdaex);
+ g_list_free (datasource->tables);
+ g_slice_free (ZakAuditDatasource, datasource);
+}