本文整理汇总了C++中DT_DEBUG_SQLITE3_BIND_INT函数的典型用法代码示例。如果您正苦于以下问题:C++ DT_DEBUG_SQLITE3_BIND_INT函数的具体用法?C++ DT_DEBUG_SQLITE3_BIND_INT怎么用?C++ DT_DEBUG_SQLITE3_BIND_INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DT_DEBUG_SQLITE3_BIND_INT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dt_view_filmstrip_prefetch
void dt_view_filmstrip_prefetch()
{
const gchar *qin = dt_collection_get_query (darktable.collection);
if(!qin) return;
char query[1024];
int offset = 0;
if(qin)
{
int imgid = -1;
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from selected_images", -1, &stmt, NULL);
if(sqlite3_step(stmt) == SQLITE_ROW)
imgid = sqlite3_column_int(stmt, 0);
sqlite3_finalize(stmt);
snprintf(query, 1024, "select rowid from (%s) where id=?3", qin);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), query, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, 0);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, -1);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, imgid);
if(sqlite3_step(stmt) == SQLITE_ROW)
offset = sqlite3_column_int(stmt, 0) - 1;
sqlite3_finalize(stmt);
}
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), qin, -1, &stmt, NULL);
// only get one more image:
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, offset+1);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, offset+2);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
const uint32_t prefetchid = sqlite3_column_int(stmt, 0);
// dt_control_log("prefetching image %u", prefetchid);
dt_mipmap_cache_read_get(darktable.mipmap_cache, NULL, prefetchid, DT_MIPMAP_FULL, DT_MIPMAP_PREFETCH);
}
sqlite3_finalize(stmt);
}
示例2: menuitem_update_preset
static void menuitem_update_preset(GtkMenuItem *menuitem, dt_iop_module_t *module)
{
gchar *name = get_preset_name(menuitem);
// commit all the module fields
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"UPDATE presets SET op_version=?2, op_params=?3, enabled=?4, "
"blendop_params=?5, blendop_version=?6 WHERE name=?7 AND operation=?1",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 1, module->op, -1, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, module->version());
DT_DEBUG_SQLITE3_BIND_BLOB(stmt, 3, module->params, module->params_size, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 4, module->enabled);
DT_DEBUG_SQLITE3_BIND_BLOB(stmt, 5, module->blend_params, sizeof(dt_develop_blend_params_t),
SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 6, dt_develop_blend_version());
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 7, name, -1, SQLITE_TRANSIENT);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
示例3: dt_gui_presets_add_generic
void dt_gui_presets_add_generic(const char *name, dt_dev_operation_t op, const int32_t version,
const void *params, const int32_t params_size, const int32_t enabled)
{
sqlite3_stmt *stmt;
dt_develop_blend_params_t default_blendop_params
= { DEVELOP_MASK_DISABLED,
DEVELOP_BLEND_NORMAL2,
100.0f,
DEVELOP_COMBINE_NORM_EXCL,
0,
0,
0.0f,
{ 0, 0, 0, 0 },
{ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f } };
DT_DEBUG_SQLITE3_PREPARE_V2(
dt_database_get(darktable.db),
"INSERT OR REPLACE INTO presets (name, description, operation, op_version, op_params, enabled, "
"blendop_params, blendop_version, multi_priority, multi_name, model, maker, lens, "
"iso_min, iso_max, exposure_min, exposure_max, aperture_min, aperture_max, focal_length_min, "
"focal_length_max, "
"writeprotect, autoapply, filter, def, format) "
"VALUES (?1, '', ?2, ?3, ?4, ?5, ?6, ?7, 0, '', '%', '%', '%', 0, 51200, 0, 10000000, 0, 100000000, 0, "
"1000, 1, 0, 0, 0, 0)",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 1, name, -1, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 2, op, -1, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, version);
DT_DEBUG_SQLITE3_BIND_BLOB(stmt, 4, params, params_size, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 5, enabled);
DT_DEBUG_SQLITE3_BIND_BLOB(stmt, 6, &default_blendop_params, sizeof(dt_develop_blend_params_t),
SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 7, dt_develop_blend_version());
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
示例4: dt_image_full_path
void dt_image_full_path(const int imgid, char *pathname, int len)
{
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"select folder || '/' || filename from images, film_rolls where "
"images.film_id = film_rolls.id and images.id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
g_strlcpy(pathname, (char *)sqlite3_column_text(stmt, 0), len);
}
sqlite3_finalize(stmt);
}
示例5: dt_view_set_selection
/**
* \brief Set the selection bit to a given value for the specified image
* \param[in] imgid The image id
* \param[in] value The boolean value for the bit
*/
void dt_view_set_selection(int imgid, int value)
{
/* clear and reset statement */
DT_DEBUG_SQLITE3_CLEAR_BINDINGS(darktable.view_manager->statements.is_selected);
DT_DEBUG_SQLITE3_RESET(darktable.view_manager->statements.is_selected);
/* setup statement and iterate over rows */
DT_DEBUG_SQLITE3_BIND_INT(darktable.view_manager->statements.is_selected, 1, imgid);
if(sqlite3_step(darktable.view_manager->statements.is_selected) == SQLITE_ROW)
{
if(!value)
{
/* Value is set and should be unset; get rid of it */
/* clear and reset statement */
DT_DEBUG_SQLITE3_CLEAR_BINDINGS(darktable.view_manager->statements.delete_from_selected);
DT_DEBUG_SQLITE3_RESET(darktable.view_manager->statements.delete_from_selected);
/* setup statement and execute */
DT_DEBUG_SQLITE3_BIND_INT(darktable.view_manager->statements.delete_from_selected, 1, imgid);
sqlite3_step(darktable.view_manager->statements.delete_from_selected);
}
}
else if(value)
{
/* Select bit is unset and should be set; add it */
/* clear and reset statement */
DT_DEBUG_SQLITE3_CLEAR_BINDINGS(darktable.view_manager->statements.make_selected);
DT_DEBUG_SQLITE3_RESET(darktable.view_manager->statements.make_selected);
/* setup statement and execute */
DT_DEBUG_SQLITE3_BIND_INT(darktable.view_manager->statements.make_selected, 1, imgid);
sqlite3_step(darktable.view_manager->statements.make_selected);
}
}
示例6: _lib_filmstrip_scroll_to_image
static void _lib_filmstrip_scroll_to_image(dt_lib_module_t *self, gint imgid, gboolean activate)
{
dt_lib_filmstrip_t *strip = (dt_lib_filmstrip_t *)self->data;
/* if no imgid just bail out */
if(imgid <= 0) return;
strip->activated_image = imgid;
char query[1024];
const gchar *qin = dt_collection_get_query (darktable.collection);
if(qin)
{
snprintf(query, 1024, "select rowid from (%s) where id=?3", qin);
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), query, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, 0);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, -1);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, imgid);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
strip->offset = sqlite3_column_int(stmt, 0) - 1;
}
sqlite3_finalize(stmt);
}
/* activate the image if requested */
if (activate)
{
strip->activated_image = imgid;
dt_control_signal_raise(darktable.signals, DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE);
}
/* redraw filmstrip */
gboolean owns_lock = dt_control_gdk_lock();
gtk_widget_queue_draw(self->widget);
if(owns_lock) dt_control_gdk_unlock();
}
示例7: dt_add_hist
static void dt_add_hist(int imgid, char *operation, dt_iop_params_t *params, int params_size, char *imported,
size_t imported_len, int version, int *import_count)
{
int32_t num = 0;
dt_develop_blend_params_t blend_params = { 0 };
// get current num if any
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"SELECT count(num) FROM history WHERE imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
num = sqlite3_column_int(stmt, 0);
}
sqlite3_finalize(stmt);
// add new history info
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"INSERT INTO history (imgid, num, module, operation, op_params, enabled, "
"blendop_params, blendop_version, multi_priority, multi_name) "
"VALUES (?1, ?2, ?3, ?4, ?5, 1, ?6, ?7, 0, ' ')",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, num);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, version);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 4, operation, -1, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_BLOB(stmt, 5, params, params_size, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_BLOB(stmt, 6, &blend_params, sizeof(dt_develop_blend_params_t), SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 7, LRDT_BLEND_VERSION);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
if(imported[0]) g_strlcat(imported, ", ", imported_len);
g_strlcat(imported, dt_iop_get_localized_name(operation), imported_len);
(*import_count)++;
}
示例8: dt_image_remove
void dt_image_remove(const int32_t imgid)
{
sqlite3_stmt *stmt;
const dt_image_t *img = dt_image_cache_read_get(darktable.image_cache, imgid);
int old_group_id = img->group_id;
dt_image_cache_read_release(darktable.image_cache, img);
int new_group_id = dt_grouping_remove_from_group(imgid);
if(darktable.gui && darktable.gui->expanded_group_id == old_group_id)
darktable.gui->expanded_group_id = new_group_id;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from images where id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"update tagxtag set count = count - 1 where "
"(id2 in (select tagid from tagged_images where imgid = ?1)) or "
"(id1 in (select tagid from tagged_images where imgid = ?1))",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from tagged_images where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from history where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from color_labels where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from meta_data where id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from selected_images where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
// also clear all thumbnails in mipmap_cache.
dt_image_cache_remove(darktable.image_cache, imgid);
dt_mipmap_cache_remove(darktable.mipmap_cache, imgid);
}
示例9: dt_film_open2
/** open film with given id. */
int
dt_film_open2 (dt_film_t *film)
{
/* check if we got a decent film id */
if(film->id<0) return 1;
/* query database for id and folder */
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"select id, folder from film_rolls where id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, film->id);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
/* fill out the film dirname */
sprintf (film->dirname,"%s",(gchar *)sqlite3_column_text (stmt, 1));
sqlite3_finalize (stmt);
char datetime[20];
dt_gettime (datetime);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"update film_rolls set datetime_accessed = ?1 where id = ?2",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 1, datetime, strlen(datetime),
SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, film->id);
sqlite3_step (stmt);
sqlite3_finalize (stmt);
dt_film_set_query (film->id);
dt_control_queue_redraw_center ();
dt_view_manager_reset (darktable.view_manager);
return 0;
}
else sqlite3_finalize (stmt);
/* failure */
return 1;
}
示例10: dt_image_cache_write_release
// drops the write priviledges on an image struct.
// this triggers a write-through to sql, and if the setting
// is present, also to xmp sidecar files (safe setting).
void
dt_image_cache_write_release(
dt_image_cache_t *cache,
dt_image_t *img,
dt_image_cache_write_mode_t mode)
{
if(img->id <= 0) return;
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"update images set width = ?1, height = ?2, maker = ?3, model = ?4, "
"lens = ?5, exposure = ?6, aperture = ?7, iso = ?8, focal_length = ?9, "
"focus_distance = ?10, film_id = ?11, datetime_taken = ?12, flags = ?13, "
"crop = ?14, orientation = ?15, raw_parameters = ?16, group_id = ?17, longitude = ?18, "
"latitude = ?19, color_matrix = ?20 where id = ?21", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, img->width);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, img->height);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 3, img->exif_maker, strlen(img->exif_maker), SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 4, img->exif_model, strlen(img->exif_model), SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 5, img->exif_lens, strlen(img->exif_lens), SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 6, img->exif_exposure);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 7, img->exif_aperture);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 8, img->exif_iso);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 9, img->exif_focal_length);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 10, img->exif_focus_distance);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 11, img->film_id);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 12, img->exif_datetime_taken, strlen(img->exif_datetime_taken), SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 13, img->flags);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 14, img->exif_crop);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 15, img->orientation);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 16, *(uint32_t*)(&img->legacy_flip));
DT_DEBUG_SQLITE3_BIND_INT(stmt, 17, img->group_id);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 18, img->longitude);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 19, img->latitude);
DT_DEBUG_SQLITE3_BIND_BLOB(stmt, 20, &img->d65_color_matrix, sizeof(img->d65_color_matrix), SQLITE_STATIC);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 21, img->id);
int rc = sqlite3_step(stmt);
if (rc != SQLITE_DONE) fprintf(stderr, "[image_cache_write_release] sqlite3 error %d\n", rc);
sqlite3_finalize(stmt);
// TODO: make this work in relaxed mode, too.
if(mode == DT_IMAGE_CACHE_SAFE)
{
// rest about sidecars:
// also synch dttags file:
dt_image_write_sidecar_file(img->id);
}
dt_cache_write_release(&cache->cache, img->id);
}
示例11: menuitem_pick_preset
static void menuitem_pick_preset(GtkMenuItem *menuitem, dt_iop_module_t *module)
{
gchar *name = get_preset_name(menuitem);
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"select op_params, enabled, blendop_params, blendop_version, writeprotect from "
"presets where operation = ?1 and op_version = ?2 and name = ?3",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 1, module->op, -1, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, module->version());
DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 3, name, -1, SQLITE_TRANSIENT);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
const void *op_params = sqlite3_column_blob(stmt, 0);
int op_length = sqlite3_column_bytes(stmt, 0);
int enabled = sqlite3_column_int(stmt, 1);
const void *blendop_params = sqlite3_column_blob(stmt, 2);
int bl_length = sqlite3_column_bytes(stmt, 2);
int blendop_version = sqlite3_column_int(stmt, 3);
int writeprotect = sqlite3_column_int(stmt, 4);
if(op_params && (op_length == module->params_size))
{
memcpy(module->params, op_params, op_length);
module->enabled = enabled;
}
if(blendop_params && (blendop_version == dt_develop_blend_version())
&& (bl_length == sizeof(dt_develop_blend_params_t)))
{
memcpy(module->blend_params, blendop_params, sizeof(dt_develop_blend_params_t));
}
else if(blendop_params
&& dt_develop_blend_legacy_params(module, blendop_params, blendop_version, module->blend_params,
dt_develop_blend_version(), bl_length) == 0)
{
// do nothing
}
else
{
memcpy(module->blend_params, module->default_blendop_params, sizeof(dt_develop_blend_params_t));
}
if(!writeprotect) dt_gui_store_last_preset(name);
}
sqlite3_finalize(stmt);
g_free(name);
dt_iop_gui_update(module);
dt_dev_add_history_item(darktable.develop, module, FALSE);
gtk_widget_queue_draw(module->widget);
}
示例12: dt_styles_get_item_list
GList *
dt_styles_get_item_list (const char *name, gboolean params)
{
GList *result=NULL;
sqlite3_stmt *stmt;
int id=0;
if ((id=dt_styles_get_id_by_name(name)) != 0)
{
if (params)
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select num, operation, enabled, op_params, blendop_params from style_items where styleid=?1 order by num desc", -1, &stmt, NULL);
else
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select num, operation, enabled from style_items where styleid=?1 order by num desc", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, id);
while (sqlite3_step(stmt) == SQLITE_ROW)
{
char name[512]= {0};
dt_style_item_t *item=g_malloc (sizeof (dt_style_item_t));
item->num = sqlite3_column_int (stmt, 0);
if (params)
{
// when we get the parameters we do not want to get the operation localized as this
// is used to compare against the internal module name.
g_snprintf(name,512,"%s",sqlite3_column_text (stmt, 1));
const unsigned char *op_blob = sqlite3_column_blob(stmt, 3);
const int32_t op_len = sqlite3_column_bytes(stmt, 3);
const unsigned char *bop_blob = sqlite3_column_blob(stmt, 4);
const int32_t bop_len = sqlite3_column_bytes(stmt, 4);
item->params = malloc(op_len);
memcpy(item->params, op_blob, op_len);
item->blendop_params = malloc(bop_len);
memcpy(item->blendop_params, bop_blob, bop_len);
}
else
{
g_snprintf(name,512,"%s (%s)",dt_iop_get_localized_name((gchar *)sqlite3_column_text (stmt, 1)),(sqlite3_column_int (stmt, 2)!=0)?_("on"):_("off"));
item->params = NULL;
item->blendop_params = NULL;
}
item->name = g_strdup (name);
result = g_list_append (result,item);
}
sqlite3_finalize(stmt);
}
return result;
}
示例13: DT_DEBUG_SQLITE3_PREPARE_V2
GList *dt_film_get_image_ids(const int filmid)
{
GList *result = NULL;
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "SELECT id FROM main.images WHERE film_id = ?1",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, filmid);
while(sqlite3_step(stmt) == SQLITE_ROW)
{
int id = sqlite3_column_int(stmt, 0);
result = g_list_append(result, GINT_TO_POINTER(id));
}
return result;
}
示例14: dt_image_altered
int dt_image_altered(const uint32_t imgid)
{
int altered = 0;
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"select num from history where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
if(sqlite3_step(stmt) == SQLITE_ROW)
altered = 1;
sqlite3_finalize(stmt);
if(altered) return 1;
return altered;
}
示例15: dt_colorlabels_toggle_label_selection
void dt_colorlabels_toggle_label_selection(const int color)
{
sqlite3_stmt *stmt, *stmt2;
// check if all images in selection have that color label, i.e. try to get those which do not have the label
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select * from selected_images where imgid not "
"in (select a.imgid from selected_images as a "
"join color_labels as b on a.imgid = b.imgid "
"where b.color = ?1)",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, color);
if(sqlite3_step(stmt) == SQLITE_ROW)
{
// none or only part of images have that color label, so label them all
DT_DEBUG_SQLITE3_PREPARE_V2(
dt_database_get(darktable.db),
"insert or ignore into color_labels (imgid, color) select imgid, ?1 from selected_images", -1, &stmt2,
NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt2, 1, color);
sqlite3_step(stmt2);
sqlite3_finalize(stmt2);
}
else
{
// none of the selected images without that color label, so delete them all
DT_DEBUG_SQLITE3_PREPARE_V2(
dt_database_get(darktable.db),
"delete from color_labels where imgid in (select imgid from selected_images) and color=?1", -1,
&stmt2, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt2, 1, color);
sqlite3_step(stmt2);
sqlite3_finalize(stmt2);
}
sqlite3_finalize(stmt);
dt_collection_hint_message(darktable.collection);
}