From 5c51ff2c9ed80e2e111c8968c6cc66f305bc09c4 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 16 Jul 2007 17:03:48 +0300 Subject: [PATCH] Prepare sql statements with _v2 version. Don't ignore POIs without names. Break out of the loop if a match is found.. stupid me --- src/osm.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/osm.c b/src/osm.c index 0cd853d..26e28ae 100644 --- a/src/osm.c +++ b/src/osm.c @@ -208,42 +208,42 @@ void db_prepare(void) { /* Way nodes */ -sqlite3_prepare(db, "insert into nodes (nid,lat,lon,l) values (?, ?, ?, 0)", +sqlite3_prepare_v2(db, "insert into nodes (nid,lat,lon,l) values (?, ?, ?, 0)", -1, &sql.insert_node, NULL); -sqlite3_prepare(db, "select lat,lon,l from nodes where nid=?", +sqlite3_prepare_v2(db, "select lat,lon,l from nodes where nid=?", -1, &sql.select_node, NULL); -sqlite3_prepare(db, "delete from nodes", -1, &sql.delete_nodes, NULL); -sqlite3_prepare(db, "update nodes set l=l+1 where nid=?", -1, &sql.update_node, NULL); +sqlite3_prepare_v2(db, "delete from nodes", -1, &sql.delete_nodes, NULL); +sqlite3_prepare_v2(db, "update nodes set l=l+1 where nid=?", -1, &sql.update_node, NULL); /* Places */ -sqlite3_prepare(db, "insert into places (nid,type,name,isin) values (?, ?, ?, ?)", +sqlite3_prepare_v2(db, "insert into places (nid,type,name,isin) values (?, ?, ?, ?)", -1, &sql.insert_place, NULL); -sqlite3_prepare(db, "delete from places", -1, &sql.delete_place, NULL); +sqlite3_prepare_v2(db, "delete from places", -1, &sql.delete_place, NULL); /* POI nodes */ -sqlite3_prepare(db, "insert into poi (osm_id, lat, lon, label, desc, cat_id, public, priority)" +sqlite3_prepare_v2(db, "insert into poi (osm_id, lat, lon, label, desc, cat_id, public, priority)" " values (?, ?, ?, ?, ?, ?, 1, ?)", -1, &sql.insert_poi, NULL); -sqlite3_prepare(db, "delete from poi where osm_id>0", -1, &sql.delete_osm_poi, NULL); +sqlite3_prepare_v2(db, "delete from poi where osm_id>0", -1, &sql.delete_osm_poi, NULL); /* Ways */ -sqlite3_prepare(db, "insert into way (wid,nodes,type,flags) values (?, ?, ?, ?)", +sqlite3_prepare_v2(db, "insert into way (wid,nodes,type,flags) values (?, ?, ?, ?)", -1, &sql.insert_way_data, NULL); -sqlite3_prepare(db, "delete from way", -1, +sqlite3_prepare_v2(db, "delete from way", -1, &sql.delete_way, NULL); -sqlite3_prepare(db, "insert into way_seg (wsid,num,node) values (?, ?, ?)", +sqlite3_prepare_v2(db, "insert into way_seg (wsid,num,node) values (?, ?, ?)", -1, &sql.insert_way_seg, NULL); -sqlite3_prepare(db, "delete from way_seg", -1, +sqlite3_prepare_v2(db, "delete from way_seg", -1, &sql.delete_way_seg, NULL); -sqlite3_prepare(db, "insert into way_names (wid,name) values (?, ?)", +sqlite3_prepare_v2(db, "insert into way_names (wid,name) values (?, ?)", -1, &sql.insert_way_name, NULL); -sqlite3_prepare(db, "delete from way_names", -1, +sqlite3_prepare_v2(db, "delete from way_names", -1, &sql.delete_way_name, NULL); -sqlite3_prepare(db, "insert into way_ref (rid,ref,int_ref) values (?, ?, ?)", +sqlite3_prepare_v2(db, "insert into way_ref (rid,ref,int_ref) values (?, ?, ?)", -1, &sql.insert_way_ref, NULL); -sqlite3_prepare(db, "delete from way_ref", -1, +sqlite3_prepare_v2(db, "delete from way_ref", -1, &sql.delete_way_ref, NULL); } @@ -624,9 +624,6 @@ osm_node_save_poi(gint key, node *value, gpointer user_data) if (value->data==NULL) return; -if (value->data->name==NULL) - return; - if (value->data->type>NODE_POI_START && value->data->typedata->type=nodeinfo[i].type; + break; } } } @@ -799,6 +797,7 @@ switch (t) { if (wayinfo[i].oneway==TRUE) cway->flags|=W_ONEWAY; cway->type=wayinfo[i].type; + break; } } } -- 2.39.5