From: Kaj-Michael Lang Date: Tue, 5 Feb 2008 11:58:38 +0000 (+0200) Subject: More sqlite helper function usage X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbf126d806a4110b334a6391b5951271ddeb8345;p=mapper More sqlite helper function usage --- diff --git a/src/osm.c b/src/osm.c index 3b2fc12..3c945f4 100644 --- a/src/osm.c +++ b/src/osm.c @@ -533,7 +533,7 @@ lon=lon2mp_int(n->lon); sqlite3_bind_int(sql.insert_node, 1, n->id); -/* Projected and integerized lat/lot * +/* Projected and integerized lat/lot */ sqlite3_bind_int(sql.insert_node, 2, lat); sqlite3_bind_int(sql.insert_node, 3, lon); /* Original */ @@ -541,9 +541,7 @@ sqlite3_bind_double(sql.insert_node, 4, n->lat); sqlite3_bind_double(sql.insert_node, 5, n->lon); sqlite3_bind_int(sql.insert_node, 6, n->type); -sqlite3_step(sql.insert_node); -sqlite3_reset(sql.insert_node); -sqlite3_clear_bindings(sql.insert_node); +db_exec(db, sql.insert_node); return TRUE; } @@ -1214,24 +1212,24 @@ if (n->type>NODE_POI_START && n->type0) { static void osm_planet_clear_ways(void) { -g_print("Clearing old data:\n"); +g_print("Clearing old data\n"); sqlite3_step(sql.delete_way); sqlite3_step(sql.delete_way_name); sqlite3_step(sql.delete_way_ref); sqlite3_step(sql.delete_way_n2n); } -static void +static gboolean osm_planet_save_ways(void) { -g_print("Inserting new ways:\n"); -sqlite3_exec(db, "begin;", NULL, NULL, NULL); +g_print("Inserting new ways\n"); +db_transaction_begin(db); g_slist_foreach(osm_ways, osm_way_save, NULL); -sqlite3_exec(db, "commit;", NULL, NULL, NULL); +return db_transaction_commit(db); } /*********************************************************************/