*/
#include <glib.h>
+#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include "logging.h"
GError *tmp_err = NULL;
sqlite3 *db = NULL;
+ assert(db_type < CR_DB_SENTINEL);
+
if (!path || path[0] == '\0')
return db;
db_create_filelists_tables(db, &tmp_err); break;
case CR_DB_OTHER:
db_create_other_tables(db, &tmp_err); break;
+ default:
+ assert(0);
}
if (tmp_err)
{
GError *tmp_err = NULL;
+ assert(db_type < CR_DB_SENTINEL);
+
if (!db)
return;
db_index_filelists_tables(db, &tmp_err); break;
case CR_DB_OTHER:
db_index_other_tables(db, &tmp_err); break;
+ default:
+ assert(0);
}
if (tmp_err)
/** Database type.
*/
typedef enum {
- CR_DB_PRIMARY, /*!< primary */
- CR_DB_FILELISTS, /*!< filelists */
- CR_DB_OTHER /*!< other */
+ CR_DB_PRIMARY, /*!< primary */
+ CR_DB_FILELISTS, /*!< filelists */
+ CR_DB_OTHER, /*!< other */
+ CR_DB_SENTINEL, /*!< sentinel of the list */
} cr_DatabaseType;
/** Macro over cr_db_open function. Open (create new) primary sqlite sqlite db.