<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
- <cconfiguration id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1128457019">
- <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1128457019" moduleId="org.eclipse.cdt.core.settings" name="Build (GNU)">
+ <cconfiguration id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.665635732">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.665635732" moduleId="org.eclipse.cdt.core.settings" name="Build (GNU)">
<externalSettings/>
<extensions>
- <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
- <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
- <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration artifactName="libzakaudit" buildProperties="" description="" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1128457019" name="Build (GNU)" parent="org.eclipse.cdt.build.core.emptycfg">
- <folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1128457019.1727757376" name="/" resourcePath="">
- <toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.953838990" name="org.eclipse.linuxtools.cdt.autotools.core.toolChain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
- <targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.903091443" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
- <builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.1240998913" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.1109640047" name="configure" superClass="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure">
- <option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.1269728550" name="Name" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1128457019" valueType="string"/>
+ <configuration buildProperties="" description="" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.665635732" name="Build (GNU)" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.665635732.235677185" name="/" resourcePath="">
+ <toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2125576947" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
+ <targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.1664665547" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
+ <builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.378242351" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.1134304446" name="configure" superClass="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure">
+ <option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.278296702" name="Name" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.toolChain.665635732" valueType="string"/>
</tool>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen.592417764" name="autogen.sh" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen"/>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.36634604" name="GCC C Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc">
- <option id="gnu.c.compiler.option.include.paths.574540124" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
- <listOptionValue builtIn="false" value=""C:\mingw\include""/>
- <listOptionValue builtIn="false" value=""C:\mingw\include\glib-2.0""/>
- <listOptionValue builtIn="false" value=""C:\mingw\include\gtk-2.0""/>
- <listOptionValue builtIn="false" value=""C:\mingw\include\libgda-4.0""/>
- <listOptionValue builtIn="false" value=""C:\mingw\include\libgda-4.0\libgda""/>
- <listOptionValue builtIn="false" value=""C:\mingw\include\libxml2""/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen.1375468250" name="autogen.sh" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen"/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1737636881" name="GCC C Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc">
+ <option id="gnu.c.compiler.option.include.paths.1186212133" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""C:\msys64\mingw32\include""/>
+ <listOptionValue builtIn="false" value=""C:\msys64\mingw32\include\glib-2.0""/>
+ <listOptionValue builtIn="false" value=""C:\msys64\mingw32\include\gtk-3.0""/>
+ <listOptionValue builtIn="false" value=""C:\msys64\mingw32\include\libgda-5.0""/>
+ <listOptionValue builtIn="false" value=""C:\msys64\mingw32\include\libgda-5.0\libgda""/>
</option>
- <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.248247095" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.881044361" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.2010591375" name="GCC C++ Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp"/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.286923844" name="GCC C++ Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp"/>
</toolChain>
</folderInfo>
</configuration>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <project id="libzakaudit.null.1698067940" name="libzakaudit"/>
+ <project id="libzakaudit.null.985972467" name="libzakaudit"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="scannerConfiguration">
<scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1128457019;org.eclipse.linuxtools.cdt.autotools.core.toolChain.1128457019.1727757376;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.36634604;cdt.managedbuild.tool.gnu.c.compiler.input.248247095">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.665635732;org.eclipse.linuxtools.cdt.autotools.core.toolChain.665635732.235677185;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1737636881;cdt.managedbuild.tool.gnu.c.compiler.input.881044361">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
</storageModule>
- <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
/*
* audit.c
*
- * Copyright (C) 2005-2013 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2005-2015 Andrea Zagli <azagli@libero.it>
*
* This file is part of libzak_audit.
*
...)
{
va_list vargs;
- gchar *str;
+ GString *str;
gchar **fields_values;
gchar *field_name;
gchar *field_value;
+ gchar **values;
+
gboolean ret;
ret = FALSE;
- str = g_strdup ("");
+ str = g_string_new ("");
va_start (vargs, table_name);
field_value = va_arg (vargs, gchar *);
if (field_value == NULL) break;
- str = g_strconcat (str, (g_strcmp0 (str, "") != 0 ? "|" : ""), field_name, "|", field_value, NULL);
+ g_string_append (str, (g_strcmp0 (str->str, "") != 0 ? "|" : ""));
+ g_string_append (str, field_name);
+ g_string_append (str, "|");
+ g_string_append (str, field_value);
field_name = va_arg (vargs, gchar *);
}
va_end (vargs);
- if (g_strcmp0 (str, "") != 0)
+ if (g_strcmp0 (str->str, "") != 0)
{
- ret = zak_audit_action_v (zak_audit, action, username, datasource_name, table_name, (const gchar **)g_strsplit (str, "|", -1));
+ values = g_strsplit (str->str, "|", -1);
+ ret = zak_audit_action_v (zak_audit, action, username, datasource_name, table_name, (const gchar **)values);
+ g_strfreev (values);
}
- g_free (str);
+ g_string_free (str, TRUE);
return ret;
}
}
}
}
+ g_strfreev (fields);
return ret;
}
gint id = 0;
gint cols;
gint col;
- time_t t;
- struct tm *tm_ora;
+ GDateTime *gdt;
Datasource *datasource;
Table *table;
{
id = gdaex_data_model_get_value_integer_at (dm, 0, 0);
}
+ if (dm != NULL)
+ {
+ g_object_unref (dm);
+ }
id++;
/* find action's timestamp */
- t = time (NULL);
- tm_ora = localtime (&t);
+ gdt = g_date_time_new_now_local ();
/* trovo il datasource */
datasource = get_datasource_from_name (zak_audit, datasource_name);
/* TODO find the way to save more than 2 digits for the seconds */
sql = g_strdup_printf ("INSERT INTO actions"
" (id, type, username, date, id_tables)"
- " VALUES (%d, %d, '%s', '%04d-%02d-%02d %02d:%02d:%02d', %d)",
+ " VALUES (%d, %d, '%s', '%s', %d)",
id, action, username,
- tm_ora->tm_year + 1900, tm_ora->tm_mon + 1, tm_ora->tm_mday,
- tm_ora->tm_hour, tm_ora->tm_min, tm_ora->tm_sec,
+ g_date_time_format (gdt, "%F %T"),
table->id);
gdaex_execute (priv->gdaex, sql);
g_free (sql);
insert_value (zak_audit, id, table, field_name,
gdaex_data_model_get_value_stringify_at (dm, 0, col));
}
+ g_object_unref (dm);
break;
case ZAK_AUDIT_ACTION_BEFORE_UPDATE:
for (col = 0; col < cols; col++)
{
g_hash_table_insert (priv->fields_updated,
- (gpointer)gda_data_model_get_column_title (dm, col),
+ (gpointer)g_strdup (gda_data_model_get_column_title (dm, col)),
(gpointer)gdaex_data_model_get_value_stringify_at (dm, 0, col));
}
+ g_object_unref (dm);
break;
case ZAK_AUDIT_ACTION_AFTER_UPDATE:
g_hash_table_destroy (priv->fields_updated);
priv->fields_updated = NULL;
+ g_object_unref (dm);
break;
case ZAK_AUDIT_ACTION_DELETE:
insert_value (zak_audit, id, table, field_name,
gdaex_data_model_get_value_stringify_at (dm, 0, col));
}
+ g_object_unref (dm);
break;
default:
GdaSqlStatement *sql_stmt;
- gchar *str;
+ GString *str;
gchar *table_name;
+ gchar **values;
+
ret = FALSE;
- str = g_strdup ("");
+ str = g_string_new ("");
g_object_get (gda_statement, "structure", &sql_stmt, NULL);
if (sql_stmt == NULL)
field_name = ((GdaSqlField *)fields->data)->field_name;
field_value = (gchar *)gda_value_stringify (((GdaSqlExpr *)values->data)->value);
- str = g_strconcat (str, (g_strcmp0 (str, "") != 0 ? "|" : ""),
- field_name,
- "|",
- field_value,
- NULL);
+ g_string_append (str, (g_strcmp0 (str->str, "") != 0 ? "|" : ""));
+ g_string_append (str, field_name);
+ g_string_append (str, "|");
+ g_string_append (str, field_value);
fields = g_slist_next (fields);
values = g_slist_next (values);
case GDA_SQL_STATEMENT_UPDATE:
{
+ gchar *strtmp;
GdaSqlStatementUpdate *sql;
sql = (GdaSqlStatementUpdate *)sql_stmt->contents;
table_name = sql->table->table_name;
- str = g_strdup ("");
- parse_cond (sql->cond, &str);
+ strtmp = g_strdup ("");
+ parse_cond (sql->cond, &strtmp);
+ g_string_printf (str, "%s", strtmp);
+ g_free (strtmp);
break;
}
case GDA_SQL_STATEMENT_DELETE:
{
+ gchar *strtmp;
GdaSqlStatementDelete *sql;
sql = (GdaSqlStatementDelete *)sql_stmt->contents;
table_name = sql->table->table_name;
- str = g_strdup ("");
- parse_cond (sql->cond, &str);
+ strtmp = g_strdup ("");
+ parse_cond (sql->cond, &strtmp);
+ g_string_printf (str, "%s", strtmp);
+ g_free (strtmp);
break;
}
return ret;
}
- if (g_strcmp0 (str, "") != 0)
+ if (g_strcmp0 (str->str, "") != 0)
{
- ret = zak_audit_action_v (zak_audit, action, username, datasource_name, table_name, (const gchar **)g_strsplit (str, "|", -1));
+ values = g_strsplit (str->str, "|", -1);
+ ret = zak_audit_action_v (zak_audit, action, username, datasource_name, table_name, (const gchar **)values);
+ g_strfreev (values);
}
return ret;
gdaex_free (priv->gdaex);
- g_free (zak_audit);
+ g_object_unref (zak_audit);
}
/**