diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-09-12 18:42:20 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-09-12 18:42:20 (GMT) |
commit | 57f6179e22f880bbcff031714e8576cf9bd488ac (patch) | |
tree | 399fce4b52f3d42162a91578bd3ef2e460307229 /src/analysis | |
parent | 607a867355b2ffe09a76f3b4ea8dbc4be1dc477f (diff) |
Cleaned the DB code a little bit.
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/db/collection.c | 3 | ||||
-rw-r--r-- | src/analysis/db/item-int.h | 4 | ||||
-rw-r--r-- | src/analysis/db/item.c | 27 | ||||
-rw-r--r-- | src/analysis/db/item.h | 12 |
4 files changed, 12 insertions, 34 deletions
diff --git a/src/analysis/db/collection.c b/src/analysis/db/collection.c index 0f4e771..3ac70fa 100644 --- a/src/analysis/db/collection.c +++ b/src/analysis/db/collection.c @@ -969,9 +969,6 @@ static bool _g_db_collection_setup_load(GDbCollection *collec, bound_value **val if (!store_rle_string(NULL, "author", values, count)) return false; - if (!store_rle_string(NULL, "tool", values, count)) - return false; - return true; } diff --git a/src/analysis/db/item-int.h b/src/analysis/db/item-int.h index bdaf38e..a6398f9 100644 --- a/src/analysis/db/item-int.h +++ b/src/analysis/db/item-int.h @@ -67,7 +67,6 @@ struct _GDbItem timestamp_t timestamp; /* Date dernière activité */ rle_string author; /* Utilisateur d'origine */ - rle_string tool; /* Eventuel outil automatique ?*/ union { @@ -104,8 +103,7 @@ struct _GDbItemClass #define SQLITE_DB_ITEM_CREATE \ SQLITE_TIMESTAMP_CREATE("created") ", " \ SQLITE_TIMESTAMP_CREATE("timestamp") ", " \ - SQLITE_RLESTR_CREATE("author") ", " \ - SQLITE_RLESTR_CREATE("tool") + SQLITE_RLESTR_CREATE("author") diff --git a/src/analysis/db/item.c b/src/analysis/db/item.c index a403537..2eb31b1 100644 --- a/src/analysis/db/item.c +++ b/src/analysis/db/item.c @@ -157,7 +157,6 @@ static void g_db_item_dispose(GDbItem *item) static void g_db_item_finalize(GDbItem *item) { exit_rle_string(&item->author); - exit_rle_string(&item->tool); G_OBJECT_CLASS(g_db_item_parent_class)->finalize(G_OBJECT(item)); @@ -314,9 +313,6 @@ static bool _g_db_item_unpack(GDbItem *item, packed_buffer *pbuf) if (result) result = unpack_rle_string(&item->author, pbuf); - if (result) - result = unpack_rle_string(&item->tool, pbuf); - return result; } @@ -371,9 +367,6 @@ static bool _g_db_item_pack(const GDbItem *item, packed_buffer *pbuf) if (result) result = pack_rle_string(&item->author, pbuf); - if (result) - result = pack_rle_string(&item->tool, pbuf); - return result; } @@ -662,15 +655,13 @@ static bool _g_db_item_load(GDbItem *item, const bound_value *values, size_t cou { bool result; /* Bilan global à retourner */ - result = true; + result = load_timestamp(&item->created, "created", values, count); - result &= load_timestamp(&item->created, "created", values, count); - - result &= load_timestamp(&item->timestamp, "timestamp", values, count); - - result &= load_rle_string(&item->author, "author", values, count); + if (result) + result = load_timestamp(&item->timestamp, "timestamp", values, count); - result &= load_rle_string(&item->tool, "tool", values, count); + if (result) + result = load_rle_string(&item->author, "author", values, count); return result; @@ -741,14 +732,6 @@ static bool _g_db_item_store(const GDbItem *item, bound_value **values, size_t * result = store_rle_string(&item->author, "author", values, count); } - if (result) - { - if (item == NULL) - result = store_rle_string(NULL, "tool", values, count); - else - result = store_rle_string(&item->tool, "tool", values, count); - } - return result; } diff --git a/src/analysis/db/item.h b/src/analysis/db/item.h index fc6475e..dfc97fd 100644 --- a/src/analysis/db/item.h +++ b/src/analysis/db/item.h @@ -51,12 +51,12 @@ typedef enum _DbItemFlags } DbItemFlags; -#define G_TYPE_DB_ITEM g_db_item_get_type() -#define G_DB_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_db_item_get_type(), GDbItem)) -#define G_IS_DB_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_db_item_get_type())) -#define G_DB_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DB_ITEM, GDbItemClass)) -#define G_IS_DB_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DB_ITEM)) -#define G_DB_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DB_ITEM, GDbItemClass)) +#define G_TYPE_DB_ITEM g_db_item_get_type() +#define G_DB_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DB_ITEM, GDbItem)) +#define G_IS_DB_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DB_ITEM)) +#define G_DB_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DB_ITEM, GDbItemClass)) +#define G_IS_DB_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DB_ITEM)) +#define G_DB_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DB_ITEM, GDbItemClass)) /* Base d'un élément pour collection générique (instance) */ |