xmlNodeSetPtr xnodeset;
xmlNodePtr xnode;
+ GError *error;
+
guint id;
gboolean tosave;
{
tosave = TRUE;
+ /* starting the transaction */
+ if (gda_connection_supports_feature (priv->gda_conn, GDA_CONNECTION_FEATURE_TRANSACTIONS))
+ {
+ error = NULL;
+ if (!gda_connection_begin_transaction (priv->gda_conn, NULL, GDA_TRANSACTION_ISOLATION_UNKNOWN, &error))
+ {
+ continue;
+ }
+ }
+
id = strtol (xmlGetProp (xnodeset->nodeTab[i], (const gchar *)"id"), NULL, 10);
if (dbt_check_to_execute (dbt, id))
gchar *sql = (gchar *)xmlNodeGetContent (xnode);
GdaStatement *stmt;
- GError *error = NULL;
+ error = NULL;
stmt = gda_sql_parser_parse_string (parser, g_strstrip (sql), NULL, &error);
if (stmt == NULL)
{
g_warning ("Unable to create GdaStatement from sql: %s\n%s",
sql, error && error->message ? error->message : "No detail");
+ tosave = FALSE;
}
else
{
{
g_warning ("NON SELECT error: %s\n%s\n", sql,
error && error->message ? error->message : "No detail");
+ tosave = FALSE;
}
g_object_unref (stmt);
}
else if (!xmlNodeIsText (xnode))
{
g_warning ("Invalid tag: %s", xnode->name);
+ tosave = FALSE;
}
xnode = xnode->next;
xmlBufferPtr xbuf = xmlBufferCreate ();
xmlNodeDump (xbuf, priv->xml_doc, xnodeset->nodeTab[i], 0, 0);
operation = g_strstrip (g_strdup (xbuf->content));
- dbt_save_transformation (dbt, id, g_strstrip (operation));
+ tosave = dbt_save_transformation (dbt, id, g_strstrip (operation));
+ }
+
+ /* ending transaction */
+ if (gda_connection_supports_feature (priv->gda_conn, GDA_CONNECTION_FEATURE_TRANSACTIONS))
+ {
+ error = NULL;
+ if (tosave)
+ {
+ gda_connection_commit_transaction (priv->gda_conn, NULL, &error);
+ }
+ else
+ {
+ gda_connection_rollback_transaction (priv->gda_conn, NULL, &error);
+ }
}
}
}