2
Make sure the app info is truly bad and we don't crash or something.
4
Copyright 2011 Canonical Ltd.
7
Ted Gould <ted@canonical.com>
9
This program is free software: you can redistribute it and/or modify it
10
under the terms of the GNU General Public License version 3, as published
11
by the Free Software Foundation.
13
This program is distributed in the hope that it will be useful, but
14
WITHOUT ANY WARRANTY; without even the implied warranties of
15
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
16
PURPOSE. See the GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License along
19
with this program. If not, see <http://www.gnu.org/licenses/>.
24
#include <glib/gstdio.h>
25
#include <glib-object.h>
26
#include "load-app-info.h"
27
#include "load-app-info.c"
30
build_db (sqlite3 * db)
32
/* Create the table */
33
int exec_status = SQLITE_OK;
34
gchar * failstring = NULL;
35
exec_status = sqlite3_exec(db,
36
"create table usage (application text, entry text, timestamp datetime);",
37
NULL, NULL, &failstring);
38
if (exec_status != SQLITE_OK) {
39
g_warning("Unable to create table: %s", failstring);
42
/* Import data from the system */
48
main (int argv, char * argc[])
50
gboolean passed = TRUE;
53
g_printerr("Usage: %s <db path> <app-info file path>\n", argc[0]);
59
gchar * filename = argc[1];
62
int open_status = sqlite3_open(filename, &db);
64
if (open_status != SQLITE_OK) {
65
g_warning("Error opening usage DB: %s", filename);
70
/* Create the table in the DB */
73
passed = load_app_info(argc[2], db);