63 "SELECT i.id, i.group_id, "
64 " (SELECT COUNT(id) FROM main.images WHERE group_id = i.group_id), "
65 " (SELECT COUNT(imgid) FROM main.history WHERE imgid = i.id), "
66 " COALESCE((SELECT current_hash FROM main.history_hash WHERE imgid = i.id), -1), "
67 " COALESCE((SELECT mipmap_hash FROM main.history_hash WHERE imgid = i.id), -1), "
68 " i.film_id, i.version, i.width, i.height, i.orientation, i.flags, "
69 " i.import_timestamp, i.change_timestamp, i.export_timestamp, i.print_timestamp, "
70 " i.exposure, i.exposure_bias, i.aperture, i.iso, i.focal_length, i.focus_distance, "
71 " i.datetime_taken, i.longitude, i.latitude, i.altitude, "
73 " i.maker, i.model, i.lens, f.folder, "
74 " COALESCE((SELECT SUM(1 << color) FROM main.color_labels WHERE imgid=i.id), 0), "
75 " i.crop, i.raw_parameters, i.color_matrix, i.colorspace, "
76 " i.raw_black, i.raw_maximum, i.aspect_ratio, i.output_width, i.output_height"
77 " FROM main.images AS i"
78 " LEFT JOIN main.film_rolls AS f ON f.id = i.film_id"
181 "INSERT INTO main.history_hash (imgid, current_hash, basic_hash, auto_hash, mipmap_hash)"
182 " VALUES (?1, ?2, NULL, NULL, ?3)"
183 " ON CONFLICT (imgid)"
184 " DO UPDATE SET current_hash = ?2, basic_hash = NULL, auto_hash = NULL, mipmap_hash = ?3",
203 gboolean found =
FALSE;
219 fprintf(
stderr,
"[image_repository_load] failed to open image %" PRId32 " from database: %s\n", imgid,
237 "SELECT i.id, i.group_id, "
238 " (SELECT COUNT(id) FROM main.images WHERE group_id = i.group_id), "
239 " (SELECT COUNT(imgid) FROM main.history WHERE imgid = i.id), "
240 " COALESCE((SELECT current_hash FROM main.history_hash WHERE imgid = i.id), -1), "
241 " COALESCE((SELECT mipmap_hash FROM main.history_hash WHERE imgid = i.id), -1), "
242 " i.film_id, i.version, i.width, i.height, i.orientation, i.flags, "
243 " i.import_timestamp, i.change_timestamp, i.export_timestamp, i.print_timestamp, "
244 " i.exposure, i.exposure_bias, i.aperture, i.iso, i.focal_length, i.focus_distance, "
245 " i.datetime_taken, i.longitude, i.latitude, i.altitude, "
247 " i.maker, i.model, i.lens, f.folder, "
248 " COALESCE((SELECT SUM(1 << color) FROM main.color_labels WHERE imgid=i.id), 0), "
249 " i.crop, i.raw_parameters, i.color_matrix, i.colorspace, "
250 " i.raw_black, i.raw_maximum, i.aspect_ratio, i.output_width, i.output_height"
251 " FROM main.images AS i"
252 " JOIN memory.collected_images AS c ON i.id = c.imgid"
253 " LEFT JOIN main.film_rolls AS f ON f.id = i.film_id"
254 " ORDER BY c.rowid ASC",
266 cb(user_data, &info);
285 " SET width = ?1, height = ?2, filename = ?3, maker = ?4, model = ?5,"
286 " lens = ?6, exposure = ?7, aperture = ?8, iso = ?9, focal_length = ?10,"
287 " focus_distance = ?11, film_id = ?12, datetime_taken = ?13, flags = ?14,"
288 " crop = ?15, orientation = ?16, raw_parameters = ?17, group_id = ?18,"
289 " longitude = ?19, latitude = ?20, altitude = ?21, color_matrix = ?22,"
290 " colorspace = ?23, raw_black = ?24, raw_maximum = ?25,"
291 " aspect_ratio = ROUND(?26,1), exposure_bias = ?27,"
292 " import_timestamp = ?28, change_timestamp = ?29, export_timestamp = ?30,"
293 " print_timestamp = ?31, output_width = ?32, output_height = ?33"
376 "SELECT id FROM main.images WHERE group_id = ?1", -1, &
stmt,
NULL);
395 "SELECT id, version, filename"
397 " WHERE group_id = ?1", -1, &
stmt,
424 "SELECT COUNT(*) FROM main.images WHERE id >= ?1 AND id <= ?2", -1,
444 "SELECT id, filename FROM main.images WHERE id >= ?1 AND id <= ?2", -1,
462 "UPDATE main.images SET group_id = ?1 WHERE group_id = ?2 AND id != ?3",
480 "SELECT flags FROM main.images WHERE id IN "
481 "(SELECT imgid FROM main.selected_images)",
489 "SELECT flags FROM main.images WHERE id = ?1", -1, &
stmt,
NULL);
516 "SELECT id FROM main.images WHERE film_id = ?1 AND filename = ?2",
534 " FROM main.images, main.film_rolls"
535 " WHERE film_rolls.folder = ?1"
536 " AND images.film_id = film_rolls.id"
537 " AND images.filename = ?2",
571 "UPDATE main.images SET version=?1, max_version = ?1 WHERE id = ?2", -1, &
stmt,
NULL);
588 " WHERE id!=?1 AND flags&?2=?2"
589 " AND film_id=(SELECT film_id"
592 " AND filename=(SELECT filename"
629 char *
query =
g_strdup_printf(
"SELECT id FROM main.images WHERE id IN (%s) AND flags&?1=?1", set);
646 char *
query =
g_strdup_printf(
"UPDATE main.images SET flags = (flags|?1) WHERE id IN (%s)", set);
665 "main.images i, main.film_rolls f "
666 "ON i.film_id = f.id WHERE i.id IN (%s)", set);
696 if(imgid <= 0)
return FALSE;
703 "UPDATE main.images SET flags = ?1 WHERE id = ?2",
729 "SELECT i.id, write_timestamp, version,"
731 " FROM main.images i, main.film_rolls f"
732 " ON i.film_id = f.id"
733 " ORDER BY f.id, filename",
759 "COUNT(DISTINCT film_id), "
761 "COUNT(DISTINCT group_id), "
762 "COUNT(DISTINCT filename), "
763 "COUNT(DISTINCT version), "
764 "COUNT(DISTINCT film_id || '/' || filename), "
765 "COUNT(DISTINCT flags & 2048), "
766 "COUNT(DISTINCT import_timestamp), "
767 "COUNT(DISTINCT change_timestamp), "
768 "COUNT(DISTINCT export_timestamp), "
769 "COUNT(DISTINCT print_timestamp), "
770 "COUNT(DISTINCT flags), "
771 "COUNT(DISTINCT model), "
772 "COUNT(DISTINCT maker), "
773 "COUNT(DISTINCT lens), "
774 "COUNT(DISTINCT aperture), "
775 "COUNT(DISTINCT exposure), "
776 "COUNT(DISTINCT IFNULL(exposure_bias, '')), "
777 "COUNT(DISTINCT focal_length), "
778 "COUNT(DISTINCT focus_distance), "
779 "COUNT(DISTINCT iso), "
780 "COUNT(DISTINCT datetime_taken), "
781 "COUNT(DISTINCT width), "
782 "COUNT(DISTINCT height), "
783 "COUNT(DISTINCT IFNULL(output_width, '')), "
784 "COUNT(DISTINCT IFNULL(output_height, '')), "
785 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 2 WHERE images.id in (%s)), "
786 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 3 WHERE images.id in (%s)), "
787 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 0 WHERE images.id in (%s)), "
788 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 1 WHERE images.id in (%s)), "
789 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 4 WHERE images.id in (%s)), "
790 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 5 WHERE images.id in (%s)), "
791 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 6 WHERE images.id in (%s)), "
792 "(SELECT COUNT(DISTINCT IFNULL(value,'')) FROM images LEFT JOIN meta_data ON meta_data.id = images.id AND key = 7 WHERE images.id in (%s)), "
793 "COUNT(DISTINCT IFNULL(latitude, '')), "
794 "COUNT(DISTINCT IFNULL(longitude, '')), "
795 "COUNT(DISTINCT IFNULL(altitude, '')) "
798 set, set, set, set, set, set, set, set, set);
836 "SELECT MIN(latitude), MAX(latitude),"
837 " MIN(longitude), MAX(longitude), COUNT(*)"
838 " FROM main.images AS i "
839 " JOIN memory.collected_images AS l ON l.imgid = i.id "
840 " WHERE latitude NOT NULL AND longitude NOT NULL",
860 const double lat1,
const double lat2,
870 " (SELECT i.id, i.longitude, i.latitude "
871 " FROM main.images i INNER JOIN memory.collected_images c ON i.id = c.imgid"
872 " WHERE longitude >= ?1 AND longitude <= ?2"
873 " AND latitude <= ?3 AND latitude >= ?4 "
874 " AND longitude NOT NULL AND latitude NOT NULL)"
875 " ORDER BY longitude ASC",
897 *count = (int)points->len;
909 if(imgid <= 0)
return 0;
916 "SELECT write_timestamp FROM main.images WHERE id = ?1",
938 if(imgid <= 0)
return;
946 "UPDATE main.images SET write_timestamp = STRFTIME('%s', 'now') WHERE id = ?1",
961 if(imgid <= 0)
return FALSE;
965 "UPDATE main.images SET write_timestamp = ?2 WHERE id = ?1",
991 "DELETE FROM main.meta_data WHERE id = ?1", -1, &
stmt,
NULL);
1007 " FROM main.images AS a JOIN main.images AS b"
1008 " WHERE a.film_id = b.film_id AND a.filename = b.filename"
1009 " AND b.id = ?1 AND a.version = ?2"
1010 " ORDER BY a.id DESC",
1027 "INSERT INTO main.images"
1028 " (id, group_id, film_id, width, height, filename, maker, model, lens, exposure,"
1029 " aperture, iso, focal_length, focus_distance, datetime_taken, flags,"
1030 " output_width, output_height, crop, raw_parameters, raw_denoise_threshold,"
1031 " raw_auto_bright_threshold, raw_black, raw_maximum,"
1032 " license, sha1sum, orientation, histogram, lightmap,"
1033 " longitude, latitude, altitude, color_matrix, colorspace, version, max_version, history_end,"
1034 " aspect_ratio, exposure_bias, import_timestamp)"
1035 " SELECT NULL, group_id, film_id, width, height, filename, maker, model, lens,"
1036 " exposure, aperture, iso, focal_length, focus_distance, datetime_taken,"
1037 " flags, output_width, output_height, crop, raw_parameters, raw_denoise_threshold,"
1038 " raw_auto_bright_threshold, raw_black, raw_maximum,"
1039 " license, sha1sum, orientation, histogram, lightmap,"
1040 " longitude, latitude, altitude, color_matrix, colorspace, NULL, NULL, 0,"
1041 " aspect_ratio, exposure_bias, import_timestamp"
1042 " FROM main.images WHERE id = ?1",
1050 "SELECT a.id, a.film_id, a.filename, b.max_version"
1051 " FROM main.images AS a JOIN main.images AS b"
1052 " WHERE a.film_id = b.film_id AND a.filename = b.filename AND b.id = ?1"
1053 " ORDER BY a.id DESC",
1060 gchar *filename =
NULL;
1074 "INSERT INTO main.color_labels (imgid, color)"
1075 " SELECT ?1, color FROM main.color_labels WHERE imgid = ?2",
1085 "INSERT INTO main.meta_data (id, key, value)"
1086 " SELECT ?1, key, value FROM main.meta_data WHERE id = ?2",
1096 "INSERT INTO main.tagged_images (imgid, tagid, position)"
1097 " SELECT ?1, tagid, "
1098 " (SELECT (IFNULL(MAX(position),0) & 0xFFFFFFFF00000000)"
1099 " FROM main.tagged_images)"
1100 " + (ROW_NUMBER() OVER (ORDER BY imgid) << 32)"
1101 " FROM main.tagged_images AS ti"
1102 " WHERE imgid = ?2",
1112 "INSERT INTO main.module_order (imgid, iop_list, version)"
1113 " SELECT ?1, iop_list, version FROM main.module_order WHERE imgid = ?2",
1135 "UPDATE main.images SET max_version=?1 WHERE film_id = ?2 AND filename = ?3", -1,
1165 "SELECT i.version, i.id, m.value"
1167 " LEFT JOIN meta_data AS m ON m.id = i.id AND m.key = ?3"
1168 " WHERE film_id = ?1 AND filename = ?2"
1169 " ORDER BY i.version",
1204 " WHERE filename IN (SELECT filename FROM main.images WHERE id = ?1)"
1205 " AND film_id IN (SELECT film_id FROM main.images WHERE id = ?1)",
1223 gchar *filename =
NULL;
1230 "INSERT INTO main.images"
1231 " (id, group_id, film_id, width, height, filename, maker, model, lens, exposure,"
1232 " aperture, iso, focal_length, focus_distance, datetime_taken, flags,"
1233 " output_width, output_height, crop, raw_parameters, raw_denoise_threshold,"
1234 " raw_auto_bright_threshold, raw_black, raw_maximum,"
1235 " license, sha1sum, orientation, histogram, lightmap,"
1236 " longitude, latitude, altitude, color_matrix, colorspace, version, max_version,"
1237 " aspect_ratio, exposure_bias)"
1238 " SELECT NULL, group_id, ?1 as film_id, width, height, ?2 as filename, maker, model, lens,"
1239 " exposure, aperture, iso, focal_length, focus_distance, datetime_taken,"
1240 " flags, width, height, crop, raw_parameters, raw_denoise_threshold,"
1241 " raw_auto_bright_threshold, raw_black, raw_maximum,"
1242 " license, sha1sum, orientation, histogram, lightmap,"
1243 " longitude, latitude, altitude, color_matrix, colorspace, -1, -1,"
1244 " aspect_ratio, exposure_bias"
1257 "SELECT a.id, a.filename"
1258 " FROM main.images AS a"
1259 " JOIN main.images AS b"
1260 " WHERE a.film_id = ?1 AND a.filename = ?2 AND b.filename = ?3 AND b.id = ?4"
1261 " ORDER BY a.id DESC",
1280 "INSERT INTO main.color_labels (imgid, color)"
1282 " FROM main.color_labels"
1283 " WHERE imgid = ?2",
1292 "INSERT INTO main.meta_data (id, key, value)"
1293 " SELECT ?1, key, value"
1294 " FROM main.meta_data"
1305 "INSERT INTO main.tagged_images (imgid, tagid, position)"
1306 " SELECT ?1, tagid, "
1307 " (SELECT (IFNULL(MAX(position),0) & 0xFFFFFFFF00000000)"
1308 " FROM main.tagged_images)"
1309 " + (ROW_NUMBER() OVER (ORDER BY imgid) << 32)"
1310 " FROM main.tagged_images AS ti"
1311 " WHERE imgid = ?2",
1324 "SELECT MAX(a.max_version)"
1325 " FROM main.images AS a"
1326 " JOIN main.images AS b"
1327 " WHERE a.film_id = b.film_id AND a.filename = b.filename AND b.id = ?1",
1342 "UPDATE main.images SET version=?1 WHERE id = ?2", -1, &
stmt,
NULL);
1350 "UPDATE main.images SET max_version=?1 WHERE film_id = ?2 AND filename = ?3",
1364 "SELECT DISTINCT a.group_id"
1365 " FROM main.images AS a"
1366 " JOIN main.images AS b"
1367 " WHERE a.film_id = b.film_id AND a.filename = b.filename"
1368 " AND b.id = ?1 AND a.id != ?1",
1386 "UPDATE main.images SET group_id=?1 WHERE id = ?2", -1, &
stmt,
NULL);
1400 const int flags,
const int64_t import_timestamp)
1407 "INSERT INTO main.images (id, film_id, filename, license, sha1sum, flags, version, "
1408 " max_version, history_end, position, import_timestamp)"
1409 " SELECT NULL, ?1, ?2, '', '', ?3, 0, 0, 0, (IFNULL(MAX(position),0) & 0xFFFFFFFF00000000) + (1 << 32), ?4 "
1430 int32_t group_id = -1;
1440 " WHERE film_id = ?1 AND filename LIKE ?2 AND id = group_id", -1, &
stmt,
1453 " WHERE film_id = ?1 AND filename LIKE ?2 AND id != ?3", -1, &
stmt,
NULL);
1470 "UPDATE main.images SET group_id = ?1 WHERE id = ?2",
1484 gboolean found =
FALSE;
1488 "SELECT filename, flags, raw_parameters, "
1489 " longitude, latitude, altitude, history_end, datetime_taken"
1536 memset(ts, 0,
sizeof(*ts));
1538 gboolean found =
FALSE;
1543 "SELECT import_timestamp, change_timestamp, export_timestamp, print_timestamp"
void dt_colorlabel_repository_remove(const int32_t imgid, const int color)
Clear colour color on imgid. Clearing one that is not set does nothing.
void dt_colorlabel_repository_set(const int32_t imgid, const int color)
Set colour color on imgid. Setting one that is already set does nothing.
main.color_labels: which of the five colour labels are set on an image.
void dt_image_init(dt_image_t *img)
const char * dt_image_film_roll_name(const char *path)
void dt_image_set_provisional_dsc(dt_image_t *img)
void dt_image_local_copy_paths_from_fullpath(const char *fullpath, int32_t imgid, char *local_copy_path, size_t local_copy_len, char *local_copy_legacy_path, size_t local_copy_legacy_len)
sqlite3 * dt_database_get_sqlite3_global(void)
gboolean dt_datetime_gtimespan_to_local(char *local, const size_t local_size, const GTimeSpan gts, const gboolean msec, const gboolean tz)
static int dt_pthread_mutex_unlock(dt_pthread_mutex_t *mutex) RELEASE(mutex) NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_mutex_init(dt_pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr)
static int dt_pthread_mutex_destroy(dt_pthread_mutex_t *mutex)
static int dt_pthread_mutex_lock(dt_pthread_mutex_t *mutex) ACQUIRE(mutex) NO_THREAD_SAFETY_ANALYSIS
int dt_image_repository_get_version(const int32_t imgid)
The duplicate version number of imgid, or 0.
void dt_image_repository_touch_write_timestamp(const int32_t imgid)
Set write_timestamp of imgid to now.
static void _image_write_history_hash(const dt_image_t *img)
static gsize _image_stmt_mutex_inited
static sqlite3_stmt * _image_write_timestamp_update_stmt
int dt_image_repository_count_others_with_flag(const int32_t imgid, const int flag)
How many OTHER images share this image's film roll and filename and carry flag.
int dt_image_repository_count_in_id_range(const int32_t min_imgid, const int32_t max_imgid)
How many images have an id in [min_imgid, max_imgid]. -1 when unreadable.
GList * dt_image_repository_get_ids_with_flag_among(GList *imgids, const int flag)
Of the images in imgids, those whose flags carry flag, in row order.
void dt_image_repository_cleanup(void)
Finalise the prepared statements. Called at shutdown, after the last cache release and before the dat...
static char * _id_set(GList *imgids)
void dt_image_repository_xmp_row_cleanup(dt_image_xmp_row_t *row)
Release what dt_image_repository_get_xmp_row() allocated.
int64_t dt_image_repository_get_write_timestamp(const int32_t imgid)
main.images.write_timestamp for imgid, or 0.
gboolean dt_image_repository_set_group(const int32_t imgid, const int32_t group_id)
Set imgid's group_id.
static sqlite3_stmt * _image_write_timestamp_select_stmt
gboolean dt_image_repository_set_write_timestamp(const int32_t imgid, const int64_t timestamp)
Set write_timestamp of imgid to timestamp (seconds since the epoch). Bound as a 64-bit integer; the c...
void dt_image_group_member_free(gpointer data)
Free one dt_image_group_member_t. Suits g_list_free_full().
gboolean dt_image_repository_get_collected_geo_bounds(dt_image_geo_bounds_t *bounds)
Bounding box of every collected image carrying coordinates.
void dt_image_repository_foreach_collected(dt_image_repository_collected_cb cb, void *user_data)
Every image of the current collection, in collection order, already mapped.
gboolean dt_image_repository_load(const int32_t imgid, dt_image_t *img)
Fill img from the main.images row for imgid.
static sqlite3_stmt * _image_set_flags_stmt
int32_t dt_image_repository_find_group_for_pattern(const int32_t film_id, const char *filename_pattern, const gboolean leader_only, const int32_t exclude_imgid)
The group leader of an existing image in film_id matching filename_pattern (a LIKE pattern),...
GList * dt_image_repository_get_group_member_rows(const int32_t group_id)
Every member of group_id, in row order, named. Free with g_list_free_full(list, dt_image_group_member...
gboolean dt_image_repository_get_timestamps(const int32_t imgid, dt_image_timestamps_t *ts)
Read imgid's four timestamps. FALSE when there is no such image.
gboolean dt_image_repository_delete(const int32_t imgid)
Delete imgid from main.images and main.meta_data.
int32_t dt_image_repository_copy_to_film(const int32_t imgid, const int32_t filmid, const char *new_filename, const char *old_filename)
Copy imgid into film roll filmid under new_filename, returning the new id.
GList * dt_image_repository_get_versions(const int32_t film_id, const char *filename, const int name_keyid)
Every version of the file (film_id, filename), in version order, each with the name stored under meta...
gboolean dt_image_repository_set_flags(const int32_t imgid, const int flags)
Replace imgid's whole flags word.
GList * dt_image_repository_get_duplicate_ids(const int32_t imgid)
Every image id sharing imgid's film roll and filename, itself included, in row order – an image and i...
static sqlite3_stmt * _image_load_stmt
GList * dt_image_repository_get_ids_with_flag(const int flag)
Every image id whose flags carry flag, in row order.
void dt_image_repository_foreach_in_id_range(const int32_t min_imgid, const int32_t max_imgid, dt_image_repository_id_filename_cb cb, void *user_data)
Walk the images whose id falls in [min_imgid, max_imgid], in row order.
gboolean dt_image_repository_get_xmp_row(const int32_t imgid, dt_image_xmp_row_t *row)
Read imgid's sidecar fields. FALSE when there is no such image.
static dt_pthread_mutex_t _image_stmt_mutex
void dt_image_version_free(gpointer data)
Release one dt_image_version_t. Use with g_list_free_full().
void dt_image_repository_reassign_group(const int32_t from_group_id, const int32_t to_group_id, const int32_t exclude_imgid)
Move every member of from_group_id into to_group_id, except exclude_imgid.
int32_t dt_image_repository_duplicate(const int32_t imgid, const int32_t newversion)
Duplicate imgid as a new version, returning the new image id (-1 on failure).
static void dt_image_from_stmt(dt_image_t *img, sqlite3_stmt *stmt)
static void _image_stmt_mutex_ensure(void)
void dt_image_repository_store(const dt_image_t *img)
Write img back to main.images, plus its colour labels and history hash.
int32_t dt_image_repository_find_by_film_and_filename(const int32_t film_id, const char *filename)
The image id for filename inside film roll film_id, or -1.
static sqlite3_stmt * _image_get_stmt(void)
GList * dt_image_repository_get_ratings(const int32_t imgid)
Star ratings, as main.images.flags encodes them: the low three bits, minus one.
dt_image_geo_point_t * dt_image_repository_get_collected_geo_points(const double lon1, const double lon2, const double lat1, const double lat2, int *count)
Collected images inside the box, ordered by longitude ascending.
void dt_image_repository_foreach_with_path(dt_image_repository_path_row_cb cb, void *user_data)
Walk every image in the library, film roll by film roll, filename within each.
gboolean dt_image_repository_set_version(const int32_t imgid, const int version)
Set both version and max_version of imgid to version.
int32_t dt_image_repository_find_by_folder_and_filename(const char *folder, const char *filename)
The image id for a full path, split into its folder and filename, or -1.
gboolean dt_image_repository_set_flag_among(GList *imgids, const int flag)
Set flag on every image in imgids.
GList * dt_image_repository_get_group_members(const int32_t group_id, const int32_t exclude_imgid)
Image ids in group group_id.
GList * dt_image_repository_get_full_paths(GList *imgids)
"<folder>/<filename>" for every image in imgids, distinct, in row order. Caller owns the strings.
int * dt_image_repository_count_distinct_fields(GList *imgids)
How many DISTINCT values each dt_image_field_t takes over imgids.
static sqlite3_stmt * _image_write_history_hash_stmt
gboolean dt_image_repository_insert_import(const int32_t film_id, const char *filename, const int flags, const int64_t import_timestamp)
Insert a bare row for a file being imported, returning TRUE on success.
static GList * _collect_ids(sqlite3_stmt *stmt, const int32_t exclude_imgid)
Reading and writing one dt_image_t to and from the library database. The SQL half of what used to be ...
void(* dt_image_repository_path_row_cb)(const int32_t imgid, const int64_t write_timestamp, const int version, const char *image_path, const int flags, void *user_data)
One row of dt_image_repository_foreach_with_path(). image_path is borrowed: it lives until the callba...
void(* dt_image_repository_id_filename_cb)(const int32_t imgid, const char *filename, void *user_data)
One row of dt_image_repository_foreach_in_id_range(). filename is borrowed.
void(* dt_image_repository_collected_cb)(void *user_data, const dt_image_t *info)
One image of the current collection. info is borrowed: it lives until the callback returns.
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
dt_mipmap_buffer_dsc_flags flags
Checked wrappers around the sqlite3_* calls: trace the statement, assert the return code,...
#define DT_DEBUG_SQLITE3_BIND_BLOB(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_PREPARE_V2(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_TEXT(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_INT(a, b, c)
#define DT_DEBUG_SQLITE3_BIND_INT64(a, b, c)
#define DT_DEBUG_SQLITE3_BIND_DOUBLE(a, b, c)
const float const int flip
The extent of the collection's geotagged images.
One geotagged image, in degrees as stored.
One member of a group, with what a tooltip needs to name it.
GTimeSpan export_timestamp
float exif_focus_distance
GTimeSpan import_timestamp
dt_image_orientation_t orientation
GTimeSpan change_timestamp
char local_copy_path[PATH_MAX]
GTimeSpan print_timestamp
GTimeSpan exif_datetime_taken
float d65_color_matrix[9]
dt_image_colorspace_t colorspace
dt_image_raw_parameters_t legacy_flip
char filename[DT_MAX_FILENAME_LEN]
char local_copy_legacy_path[PATH_MAX]
The four timestamps, each with whether it is set at all.
One version of a file: which duplicate it is, its id, and the name the user gave it.
The main.images fields an XMP sidecar carries.