diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2015-07-12 23:17:00 +0530 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-12 13:58:17 -0700 |
commit | e53897cd158150995b48cb641dda1b8697d0099b (patch) | |
tree | 2b2bb2c4e531f9b4d7f823f5fe4dc3e7b1c514f5 /parse-xml.c | |
parent | c91ee860f2dff268182d80bb8f64b0ea5109c58b (diff) | |
download | subsurface-e53897cd158150995b48cb641dda1b8697d0099b.tar.gz |
Divinglog import: grab information for cylinder 0
Cylinder 0 is stored on the Logbook table along with other dive metadata
(not in Tank table).
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/parse-xml.c b/parse-xml.c index bca7345cc..974906e58 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -23,6 +23,7 @@ int verbose, quit; int metric = 1; int last_xml_version = -1; +int diveid = -1; static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params); @@ -2982,10 +2983,11 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu extern int divinglog_dive(void *param, int columns, char **data, char **column) { - int retval = 0, diveid; + int retval = 0; sqlite3 *handle = (sqlite3 *)param; char *err = NULL; char get_profile_template[] = "select ProfileInt,Profile,Profile2 from Logbook where ID = %d"; + char get_cylinder0_template[] = "select 0,TankSize,PresS,PresE,PresW,O2,He,DblTank from Logbook where ID = %d"; char get_cylinder_template[] = "select TankID,TankSize,PresS,PresE,PresW,O2,He,DblTank from Tank where LogID = %d order by TankID"; char get_buffer[1024]; @@ -3036,6 +3038,13 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column) cur_settings.dc.model = strdup("Divinglog import"); } + snprintf(get_buffer, sizeof(get_buffer) - 1, get_cylinder0_template, diveid); + retval = sqlite3_exec(handle, get_buffer, &divinglog_cylinder, 0, &err); + if (retval != SQLITE_OK) { + fprintf(stderr, "%s", "Database query divinglog_cylinder0 failed.\n"); + return 1; + } + snprintf(get_buffer, sizeof(get_buffer) - 1, get_cylinder_template, diveid); retval = sqlite3_exec(handle, get_buffer, &divinglog_cylinder, 0, &err); if (retval != SQLITE_OK) { |