if (sqlite3_exec (db,
"CREATE TABLE IF NOT EXISTS "
- "bookmarks (uri text, title text, folder text, type integer, "
+ "bookmarks (uri text, title text, folder text, "
"desc text, app integer, toolbar integer);",
NULL, NULL, errmsg) != SQLITE_OK)
return NULL;
#if HAVE_SQLITE
i = 0;
n = 1;
- sqlcmd = "SELECT title from bookmarks where type=0";
+ sqlcmd = "SELECT title from bookmarks where uri=''";
result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
while ((result = sqlite3_step (statement)) == SQLITE_ROW)
{
subsqlcmd = g_strdup_printf ("SELECT uri, title, app FROM bookmarks WHERE "
" folder = '%s'", katze_item_get_name (item));
- subfolder = katze_array_from_sqlite (db, sqlcmd);
+ subfolder = katze_array_from_sqlite (db, subsqlcmd);
katze_item_set_name (KATZE_ITEM (subfolder), katze_item_get_name (item));
midori_bookmarkbar_insert_item (browser->bookmarkbar, KATZE_ITEM (subfolder));
g_free (subsqlcmd);
{
gchar* sqlcmd;
char* errmsg = NULL;
- int type = 0;
gchar* parent;
+ gchar* uri;
if (KATZE_ITEM_IS_BOOKMARK (item))
- type = 1;
+ uri = g_strdup (katze_item_get_uri (item));
+ else
+ uri = g_strdup ("");
if (folder)
parent = g_strdup (folder);
handling of katze_item_get_meta_integer(). */
/* FIXME: Need proper single quote escaping. */
sqlcmd = g_strdup_printf (
- "INSERT into bookmarks (uri, title, folder, type, toolbar, app) values"
- " ('%s', '%s', '%s', %d, %d, %d)",
- katze_item_get_uri (item),
+ "INSERT into bookmarks (uri, title, folder, toolbar, app) values"
+ " ('%s', '%s', '%s', %d, %d)",
+ uri,
katze_item_get_name (item),
parent,
- type,
- (int)katze_item_get_meta_integer (item, "toolbar"),
- (int)katze_item_get_meta_integer (item, "app"));
+ katze_item_get_meta_boolean (item, "toolbar"),
+ katze_item_get_meta_boolean (item, "app"));
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
{
sqlite3_free (errmsg);
}
+ g_free (uri);
g_free (parent);
g_free (sqlcmd);
}
katze_item_get_uri (item));
else
sqlcmd = sqlite3_mprintf (
- "DELETE FROM bookmarks WHERE folder = '%q' OR title = '%q'",
- katze_item_get_name (item),
+ "DELETE FROM bookmarks WHERE title = '%q'",
katze_item_get_name (item));
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)