diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-10-16 22:04:29 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-10-16 22:04:29 (GMT) |
commit | 6d34dbbb00da0c276261d0e1ce4bf862f22fd8e0 (patch) | |
tree | a5d3c8644691934ba84a91919f7db177f70743f1 /src/arch | |
parent | e75f44a99c8f984af4c47fa9a2c8e7e9841700d8 (diff) |
Stored a bookmark into the data base and saved the archive.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@414 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/vmpa.c | 56 | ||||
-rw-r--r-- | src/arch/vmpa.h | 9 |
2 files changed, 65 insertions, 0 deletions
diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c index 6f305fb..024161c 100644 --- a/src/arch/vmpa.c +++ b/src/arch/vmpa.c @@ -482,6 +482,62 @@ vmpa2t *string_to_vmpa_virt(const char *buffer) } +/****************************************************************************** +* * +* Paramètres : addr = adresse virtuelle ou physique à traiter. * +* create = indique si la préparation vise une création ou non. * +* values = couples de champs et de valeurs à lier. [OUT] * +* count = nombre de ces couples. [OUT] * +* * +* Description : Constitue les champs destinés à une insertion / modification.* +* * +* Retour : Bilan de l'opération : succès ou non. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool prepare_vmpa_db_statement(const vmpa2t *addr, bool create, bound_value **values, size_t *count) +{ + bound_value *value; /* Valeur à éditer / définir */ + + *values = (bound_value *)realloc(*values, ++(*count) * sizeof(bound_value)); + value = &(*values)[*count - 1]; + + value->name = "phys"; + + if (addr->physical != VMPA_NO_PHYSICAL) + { + value->type = SQLITE_INT64; + value->integer64 = addr->physical; + } + else + { + value->type = SQLITE_RAW; + value->cstring = "NULL"; + } + + *values = (bound_value *)realloc(*values, ++(*count) * sizeof(bound_value)); + value = &(*values)[*count - 1]; + + value->name = "virt"; + + if (addr->virtual != VMPA_NO_VIRTUAL) + { + value->type = SQLITE_INT64; + value->integer64 = addr->virtual; + } + else + { + value->type = SQLITE_RAW; + value->cstring = "NULL"; + } + + return true; + +} + + /* ---------------------------------------------------------------------------------- */ /* DEFINITION D'UNE ZONE EN MEMOIRE */ diff --git a/src/arch/vmpa.h b/src/arch/vmpa.h index 52c5d6a..f0a8faf 100644 --- a/src/arch/vmpa.h +++ b/src/arch/vmpa.h @@ -34,6 +34,7 @@ #include "archbase.h" #include "../common/cpp.h" +#include "../common/sqlite.h" @@ -117,6 +118,14 @@ vmpa2t *string_to_vmpa_phy(const char *); /* Transforme une chaîne de caractères en adresse virtuelle. */ vmpa2t *string_to_vmpa_virt(const char *); +/* Définition du tronc commun pour les créations SQLite */ +#define SQLITE_VMPA_CREATE \ + "phys INTEGER, " \ + "virt INTEGER, " + +/* Constitue les champs destinés à une insertion / modification. */ +bool prepare_vmpa_db_statement(const vmpa2t *, bool, bound_value **, size_t *); + /* ------------------------ DEFINITION D'UNE ZONE EN MEMOIRE ------------------------ */ |