/* * #ifdef SQLITE_INSTALLED =1 * * Copyright(c) 2020, Space Science and Engineering Center, UW-Madison * Refer to "McIDAS Software Acquisition and Distribution Policies" * in the file mcidas/data/license.txt */ /**** $Id: M0ImgSQLiteDB_tables.c,v 1.1 2020/11/03 23:15:49 russd Tst $ *** */ #include #include #include #include #include #include #include "mcidas.h" #include "mcidasp.h" #include "mcncdf.h" #include "mcgrib.h" #include "servutil.h" /* SQLite libraries may not be installed on the local system */ /* #define SQLITE_INSTALLED 1 this variable is defined from the dmake command line */ #ifdef SQLITE_INSTALLED #include "sqlite3.h" #endif char errstr[240]; /* TYPEDEFS */ int M0GetSQLiteDB_tables( char *, char ***, int * ); int M0ImgSQLiteDB_tables( char * DB_file, char *** DBName, int* numDb ) /* *$ Name: *$ M0ImgQLiteDB_tables - Gets SQLite database table names from the INFO string *$ *$ Interface: *$ integer function *$ M0ImgSQLiteDB_tables ( char * DB_file, char *** DBName, int* numDB ) *$ *$ Input: *$ DB_file - INFO= fields from DSSERVE command *$ *$ Input and Output: *$ none *$ *$ Output: *$ DBName - array of database names matching the INFO string *$ numDb - number of databases *$ *$ Return values: *$ 1 - More than one database returned *$ 0 - No errors found *$ *$ Remarks: *$ INFO field should have a DATABASE field to determine the *$ database names for SQLite *$ *$ Categories: *$ utility */ { int rc = 0; char trce[512]; char **maskDBName; int nDb; /* Get the database mask */ maskDBName = VecNew(); (void)sprintf(trce,"DB_file is >%s< %d\n",DB_file,strlen(DB_file)); M0sxtrce(trce); /* Get the database names based on the mask */ /* there can be more than one database in SQLite land *DBName = M0GetMaskFileList(maskDBName[0]); *numDb = VecLen(*DBName); if (*numDb >= 1) rc=1; VecOld(maskDBName); return(rc); */ }