static sqlite3*
midori_history_initialize (KatzeArray* array,
const gchar* filename,
+ const gchar* bookmarks_filename,
char** errmsg)
{
sqlite3* db;
gboolean has_day;
sqlite3_stmt* stmt;
gint result;
+ gchar* sql;
has_day = FALSE;
"DROP TABLE backup;"
"COMMIT;",
NULL, NULL, errmsg);
+
+ sql = g_strdup_printf ("ATTACH DATABASE '%s' AS bookmarks", bookmarks_filename);
+ sqlite3_exec (db, sql, NULL, NULL, errmsg);
+ g_free (sql);
+
return db;
}
gchar** extensions;
MidoriWebSettings* settings;
gchar* config_file;
+ gchar* bookmarks_file;
MidoriStartup load_on_startup;
KatzeArray* search_engines;
KatzeArray* bookmarks;
midori_startup_timer ("Search read: \t%f");
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
- katze_assign (config_file, build_config_filename ("bookmarks.db"));
+ bookmarks_file = build_config_filename ("bookmarks.db");
errmsg = NULL;
- if ((db = midori_bookmarks_initialize (bookmarks, config_file, &errmsg)) == NULL)
+ if ((db = midori_bookmarks_initialize (bookmarks, bookmarks_file, &errmsg)) == NULL)
{
g_string_append_printf (error_messages,
_("Bookmarks couldn't be loaded: %s\n"), errmsg);
katze_assign (config_file, build_config_filename ("history.db"));
errmsg = NULL;
- if ((db = midori_history_initialize (history, config_file, &errmsg)) == NULL)
+ if ((db = midori_history_initialize (history, config_file, bookmarks_file ,&errmsg)) == NULL)
{
g_string_append_printf (error_messages,
_("The history couldn't be loaded: %s\n"), errmsg);
g_free (errmsg);
}
+ g_free (bookmarks_file);
g_object_set_data (G_OBJECT (history), "db", db);
midori_startup_timer ("History read: \t%f");
"UNION ALL "
"SELECT type, replace(uri, '%s', title) AS uri, title, count() AS ct FROM search_view "
"WHERE title LIKE ?1 GROUP BY uri "
+ "UNION ALL "
+ "SELECT '1' AS type, uri, title, '100' AS ct FROM bookmarks "
+ "WHERE title LIKE ?1 AND uri !='' "
"ORDER BY ct DESC LIMIT ?2";
sqlite3_prepare_v2 (db, sqlcmd, strlen (sqlcmd) + 1, &stmt, NULL);
}