]> err.no Git - mapper/commitdiff
Formating.
authorKaj-Michael Lang <milang@angel.tal.org>
Sat, 21 Jul 2007 17:52:59 +0000 (20:52 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Sat, 21 Jul 2007 17:52:59 +0000 (20:52 +0300)
src/cb.c
src/poi.c

index ac71df625feb540fa5de8d0d6b6b9f1d9eb11194..e8dce37c7632d057cb802ca61cbd5a8b0e3700f2 100644 (file)
--- a/src/cb.c
+++ b/src/cb.c
@@ -502,27 +502,20 @@ gboolean menu_cb_goto_nearpoi(GtkAction * action)
                        unit2latlon(_center.unitx, _center.unity, lat, lon);
                }
 
-               if (SQLITE_OK ==
-                   sqlite3_bind_double(_stmt_select_nearest_poi, 1, lat)
-                   && SQLITE_OK ==
-                   sqlite3_bind_double(_stmt_select_nearest_poi, 2, lon)
+               if (SQLITE_OK == sqlite3_bind_double(_stmt_select_nearest_poi, 1, lat)
+                   && SQLITE_OK == sqlite3_bind_double(_stmt_select_nearest_poi, 2, lon)
                    && SQLITE_ROW == sqlite3_step(_stmt_select_nearest_poi)) {
                        guint unitx, unity;
                        gchar *banner;
                        const gchar *poi_label, *cat_label;
 
-                       lat =
-                           sqlite3_column_double(_stmt_select_nearest_poi, 0);
-                       lon =
-                           sqlite3_column_double(_stmt_select_nearest_poi, 1);
-                       poi_label =
-                           sqlite3_column_text(_stmt_select_nearest_poi, 2);
-                       cat_label =
-                           sqlite3_column_text(_stmt_select_nearest_poi, 3);
+                       lat = sqlite3_column_double(_stmt_select_nearest_poi, 0);
+                       lon = sqlite3_column_double(_stmt_select_nearest_poi, 1);
+                       poi_label = sqlite3_column_text(_stmt_select_nearest_poi, 2);
+                       cat_label = sqlite3_column_text(_stmt_select_nearest_poi, 3);
 
                        latlon2unit(lat, lon, unitx, unity);
-                       banner =
-                           g_strdup_printf("%s (%s)", poi_label, cat_label);
+                       banner = g_strdup_printf("%s (%s)", poi_label, cat_label);
                        MACRO_BANNER_SHOW_INFO(_window, banner);
                        g_free(banner);
 
index a1b01ef85db78b4a7e85c5a37a7ffc8518741950..a82aba6ea839f32a363f4dd28e87ba2bfba8f4d8 100644 (file)
--- a/src/poi.c
+++ b/src/poi.c
@@ -103,7 +103,7 @@ sqlite3_stmt *sql_cat;
 gint i;
 
 g_printf("Checking default categories\n");
-sqlite3_prepare(db,"insert into category (cat_id, label, desc, enabled)"
+sqlite3_prepare_v2(db,"insert into category (cat_id, label, desc, enabled)"
                        " values (?, ?, ?, 1)", 
                        -1, &sql_cat, NULL);
 
@@ -172,7 +172,7 @@ gboolean
 poi_db_prepare(sqlite3 *db)
 {
        /* select from poi */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "select p.lat, p.lon, p.poi_id, p.label, p.desc,"
                        " p.cat_id, c.label, c.desc, c.icon, c.color"
                        " from poi p, category c "
@@ -182,7 +182,7 @@ poi_db_prepare(sqlite3 *db)
                        -1, &_stmt_select_poi, NULL);
 
        /* select nearest pois */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "select p.lat, p.lon, p.label, c.label, c.icon, c.color"
                        " from poi p, category c "
                        " where c.enabled = 1 and p.cat_id = c.cat_id "
@@ -193,46 +193,46 @@ poi_db_prepare(sqlite3 *db)
                        -1, &_stmt_select_nearest_poi, NULL);
 
        /* insert poi */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "insert into poi (lat, lon, label, desc, cat_id, public)"
                        " values (?, ?, ?, ?, ?, 1)", -1, &_stmt_insert_poi, NULL);
        /* update poi */
-       sqlite3_prepare(db, "update poi set label = ?, desc = ?, "
+       sqlite3_prepare_v2(db, "update poi set label = ?, desc = ?, "
                        "cat_id = ? where poi_id = ?",
                        -1, &_stmt_update_poi, NULL);
        /* delete from poi */
-       sqlite3_prepare(db, "delete from poi where poi_id = ?",
+       sqlite3_prepare_v2(db, "delete from poi where poi_id = ?",
                        -1, &_stmt_delete_poi, NULL);
        /* delete from poi by cat_id */
-       sqlite3_prepare(db, "delete from poi where cat_id = ?",
+       sqlite3_prepare_v2(db, "delete from poi where cat_id = ?",
                        -1, &_stmt_delete_poi_by_catid, NULL);
        /* get next poilabel */
-       sqlite3_prepare(db, "select ifnull(max(poi_id) + 1,1) from poi",
+       sqlite3_prepare_v2(db, "select ifnull(max(poi_id) + 1,1) from poi",
                        -1, &_stmt_nextlabel_poi, NULL);
 
        /* select from category */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "select c.label, c.desc, c.enabled"
                        " from category c where c.cat_id = ?",
                        -1, &_stmt_select_cat, NULL);
        /* insert into category */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "insert into category (label, desc, enabled)"
                        " values (?, ?, ?)", -1, &_stmt_insert_cat, NULL);
        /* update category */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "update category set label = ?, desc = ?,"
                        " enabled = ? where poi_id = ?",
                        -1, &_stmt_update_cat, NULL);
        /* delete from category */
-       sqlite3_prepare(db,"delete from category where cat_id = ?",
+       sqlite3_prepare_v2(db,"delete from category where cat_id = ?",
                        -1, &_stmt_delete_cat, NULL);
        /* enable category */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "update category set enabled = ?"
                        " where cat_id = ?", -1, &_stmt_toggle_cat, NULL);
        /* select all category */
-       sqlite3_prepare(db,
+       sqlite3_prepare_v2(db,
                        "select c.cat_id, c.label, c.desc, c.enabled, c.icon, c.color,"
                        " count(p.poi_id)"
                        " from category c"
@@ -259,7 +259,10 @@ poi_db_connect(sqlite3 **db, const gchar *poi_db)
 {
 if (db_connect(db, poi_db)) {
        poi_db_create(*db);
-       poi_db_prepare(*db);
+       if (poi_db_prepare(*db)==FALSE)
+               g_printerr("Failed to prepare POI SQL statements");
+       if (osm_db_prepare(*db)==FALSE)
+               g_printerr("Failed to prepare OSM SQL statements");
        return TRUE;
 }
 return FALSE;