gchar** parts;
gchar* keywords = NULL;
const gchar* search_uri = NULL;
- time_t now;
- gint64 day;
- sqlite3* db;
- static sqlite3_stmt* statement = NULL;
/* Do we have a keyword and a string? */
parts = g_strsplit (stripped_uri, " ", 2);
- if (parts[0])
+ if (parts[0] && browser->search_engines)
{
KatzeItem* item;
if ((item = katze_array_find_token (browser->search_engines, parts[0])))
}
new_uri = sokoke_search_uri (search_uri, keywords);
- now = time (NULL);
- day = sokoke_time_t_to_julian (&now);
-
- db = g_object_get_data (G_OBJECT (browser->history), "db");
- if (!statement)
+ if (browser->history != NULL)
{
- const gchar* sqlcmd;
- sqlcmd = "INSERT INTO search (keywords, uri, day) VALUES (?,?,?)";
- sqlite3_prepare_v2 (db, sqlcmd, strlen (sqlcmd) + 1, &statement, NULL);
- }
- sqlite3_bind_text (statement, 1, keywords, -1, 0);
- sqlite3_bind_text (statement, 2, search_uri, -1, 0);
- sqlite3_bind_int64 (statement, 3, day);
+ time_t now = time (NULL);
+ gint64 day = sokoke_time_t_to_julian (&now);
+ sqlite3* db = g_object_get_data (G_OBJECT (browser->history), "db");
+ static sqlite3_stmt* statement = NULL;
+
+ if (!statement)
+ {
+ const gchar* sqlcmd;
+ sqlcmd = "INSERT INTO search (keywords, uri, day) VALUES (?,?,?)";
+ sqlite3_prepare_v2 (db, sqlcmd, strlen (sqlcmd) + 1, &statement, NULL);
+ }
+ sqlite3_bind_text (statement, 1, keywords, -1, 0);
+ sqlite3_bind_text (statement, 2, search_uri, -1, 0);
+ sqlite3_bind_int64 (statement, 3, day);
- if (sqlite3_step (statement) != SQLITE_DONE)
- g_printerr (_("Failed to insert new history item: %s\n"),
+ if (sqlite3_step (statement) != SQLITE_DONE)
+ g_printerr (_("Failed to insert new history item: %s\n"),
sqlite3_errmsg (db));
- sqlite3_reset (statement);
- if (sqlite3_step (statement) == SQLITE_DONE)
- sqlite3_clear_bindings (statement);
+ sqlite3_reset (statement);
+ if (sqlite3_step (statement) == SQLITE_DONE)
+ sqlite3_clear_bindings (statement);
+ }
g_free (keywords);
}