mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Refactoring sqlite import support
Move the opening of DB connection to occur before DC dependent code. This way we can try to detect log software before calling the DC dependent import function. This prepares for adding support for Shearwater sqlite database. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e49bd86f5e
commit
4b949936c2
3 changed files with 17 additions and 14 deletions
15
file.c
15
file.c
|
@ -153,7 +153,20 @@ static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, char
|
|||
|
||||
static int try_to_open_db(const char *filename, struct memblock *mem, char **error)
|
||||
{
|
||||
return parse_dm4_buffer(filename, mem->buffer, mem->size, &dive_table, error);
|
||||
sqlite3 *handle;
|
||||
int retval;
|
||||
|
||||
retval = sqlite3_open(filename, &handle);
|
||||
|
||||
if (retval) {
|
||||
fprintf(stderr, translate("gettextFromC","Database connection failed '%s'.\n"), filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
retval = parse_dm4_buffer(handle, filename, mem->buffer, mem->size, &dive_table, error);
|
||||
sqlite3_close(handle);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
timestamp_t parse_date(const char *date)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue