return ret;
}
-/**
- * gdaex_save_file_in_blob:
- * @gdaex:
- * @sql:
- * @blob_field_name:
- * @filename:
- *
- * Returns:
- */
gboolean
-gdaex_save_file_in_blob (GdaEx *gdaex,
- const gchar *sql,
- const gchar *blob_field_name,
- const gchar *filename)
+_gdaex_save_data_file_in_blob (GdaEx *gdaex,
+ const gchar *sql,
+ const gchar *blob_field_name,
+ const guchar *data,
+ glong size,
+ const gchar *filename)
{
GdaConnection *gda_con;
GdaSqlParser *parser;
gda_connection_begin_transaction (gda_con, NULL, 0, NULL);
param = gda_set_get_holder (plist, blob_field_name);
- value = gda_value_new_blob_from_file (filename);
+
+ if (data != NULL)
+ {
+ value = gda_value_new_blob (data, size);
+ }
+ else
+ {
+ value = gda_value_new_blob_from_file (filename);
+ }
+
error = NULL;
if (!gda_holder_take_value (param, value, &error))
{
gda_connection_commit_transaction (gda_con, NULL, NULL);
}
+ if (value != NULL)
+ {
+ g_value_unset (value);
+ }
+
return TRUE;
}
+/**
+ * gdaex_save_file_in_blob:
+ * @gdaex:
+ * @sql:
+ * @blob_field_name:
+ * @data:
+ * @size:
+ *
+ * Returns:
+ */
+gboolean
+gdaex_save_data_in_blob (GdaEx *gdaex,
+ const gchar *sql,
+ const gchar *blob_field_name,
+ const guchar *data,
+ glong size)
+{
+ return _gdaex_save_data_file_in_blob (gdaex, sql, blob_field_name, data, size, NULL);
+}
+
+/**
+ * gdaex_save_file_in_blob:
+ * @gdaex:
+ * @sql:
+ * @blob_field_name:
+ * @filename:
+ *
+ * Returns:
+ */
+gboolean
+gdaex_save_file_in_blob (GdaEx *gdaex,
+ const gchar *sql,
+ const gchar *blob_field_name,
+ const gchar *filename)
+{
+ return _gdaex_save_data_file_in_blob (gdaex, sql, blob_field_name, NULL, 0, filename);
+}
+
/**
* gdaex_get_blob:
* @gdaex:
/*
* gdaex.h
*
- * Copyright (C) 2005-2016 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2005-2017 Andrea Zagli <azagli@libero.it>
*
* This file is part of libgdaex.
*
gint row,
const gchar *field_name);
struct tm *gdaex_data_model_get_field_value_tm_at (GdaDataModel *data_model,
- gint row,
- const gchar *field_name);
+ gint row,
+ const gchar *field_name);
gchar *gdaex_data_model_get_value_stringify_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
gchar *gdaex_data_model_get_value_stringify_escaped_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
gint gdaex_data_model_get_value_integer_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
gfloat gdaex_data_model_get_value_float_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
gdouble gdaex_data_model_get_value_double_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
gboolean gdaex_data_model_get_value_boolean_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
GdaTimestamp *gdaex_data_model_get_value_gdatimestamp_at (GdaDataModel *data_model,
gint row,
gint col);
GDate *gdaex_data_model_get_value_gdate_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
GDateTime *gdaex_data_model_get_value_gdatetime_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
struct tm *gdaex_data_model_get_value_tm_at (GdaDataModel *data_model,
- gint row,
- gint col);
+ gint row,
+ gint col);
gchar *gdaex_data_model_iter_get_field_value_stringify_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
gchar *gdaex_data_model_iter_get_field_value_stringify_escaped_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
gint gdaex_data_model_iter_get_field_value_integer_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
gfloat gdaex_data_model_iter_get_field_value_float_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
gdouble gdaex_data_model_iter_get_field_value_double_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
gboolean gdaex_data_model_iter_get_field_value_boolean_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
GdaTimestamp *gdaex_data_model_iter_get_field_value_gdatimestamp_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
GDate *gdaex_data_model_iter_get_field_value_gdate_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
GDateTime *gdaex_data_model_iter_get_field_value_gdatetime_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
struct tm *gdaex_data_model_iter_get_field_value_tm_at (GdaDataModelIter *iter,
- const gchar *field_name);
+ const gchar *field_name);
gchar *gdaex_data_model_iter_get_value_stringify_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
gchar *gdaex_data_model_iter_get_value_stringify_escaped_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
gint gdaex_data_model_iter_get_value_integer_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
gfloat gdaex_data_model_iter_get_value_float_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
gdouble gdaex_data_model_iter_get_value_double_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
gboolean gdaex_data_model_iter_get_value_boolean_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
GdaTimestamp *gdaex_data_model_iter_get_value_gdatimestamp_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
GDate *gdaex_data_model_iter_get_value_gdate_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
GDateTime *gdaex_data_model_iter_get_value_gdatetime_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
struct tm *gdaex_data_model_iter_get_value_tm_at (GdaDataModelIter *iter,
- gint col);
+ gint col);
GHashTable *gdaex_data_model_columns_to_hashtable (GdaDataModel *dm);
GHashTable *gdaex_data_model_row_to_hashtable (GdaDataModel *dm, guint row);
gint decimals,
gboolean with_currency_symbol);
+gboolean gdaex_save_data_in_blob (GdaEx *gdaex,
+ const gchar *sql,
+ const gchar *blob_field_name,
+ const guchar *data,
+ glong size);
+
gboolean gdaex_save_file_in_blob (GdaEx *gdaex,
- const gchar *sql,
- const gchar *blob_field_name,
- const gchar *filename);
+ const gchar *sql,
+ const gchar *blob_field_name,
+ const gchar *filename);
const gchar *gdaex_get_blob (GdaEx *gdaex,
- const gchar *sql,
- const gchar *filename_field_name,
- const gchar *blob_field_name);
+ const gchar *sql,
+ const gchar *filename_field_name,
+ const gchar *blob_field_name);
G_END_DECLS