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);
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);
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 "
-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 "
-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"
{
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;