static gboolean clear_blobs (GdaConnection *cnc, GError **error) { GdaStatement *stmt; gboolean retval; #define SQL_DELETE "DELETE FROM blobs" show_header ("Clear blobs"); stmt = gda_sql_parser_parse_string (parser, SQL_DELETE, NULL, error); if (!stmt) return FALSE; retval = exec_statement (cnc, stmt, NULL, error); g_object_unref (stmt); return retval; }
static gboolean update_blob (GdaConnection *cnc, gint id, const gchar *data, glong binary_length, GError **error) { GdaStatement *stmt; GdaSet *plist; GdaHolder *param; GValue *value; gchar *str; gboolean retval; const gchar* SQL_UPDATE = "UPDATE blobs set name = ##/*name:'name' type:gchararray*/, data = ##/*name:'theblob' type:'GdaBlob'*/ WHERE id= ##/*name:'id' type:gint*/"; show_header ("Update a blob"); stmt = gda_sql_parser_parse_string (parser, SQL_UPDATE, NULL, error); if (!stmt) return FALSE; if (!gda_statement_get_parameters (stmt, &plist, NULL)) return FALSE; /* blob id */ param = gda_set_get_holder (plist, "id"); str = g_strdup_printf ("%d", id); if (! gda_holder_set_value_str (param, NULL, str, error)) return FALSE; g_free (str); /* blob name */ param = gda_set_get_holder (plist, "name"); str = g_strdup_printf ("BLOB_%d", id); if (! gda_holder_set_value_str (param, NULL, str, error)) return FALSE; g_free (str); /* blob data */ param = gda_set_get_holder (plist, "theblob"); value = gda_value_new_blob ((guchar*) data, binary_length); if (! gda_holder_set_value (param, value, error)) return FALSE; gda_value_free (value); gda_connection_clear_events_list (cnc); retval = exec_statement (cnc, stmt, plist, error); g_object_unref (stmt); g_object_unref (plist); return retval; }
static void exec_statementlist(const struct StatementList* statementlist, struct Scope* scope) { exec_statement(statementlist->statement, scope); if (statementlist->statementlist) exec_statementlist(statementlist->statementlist, scope); }