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 */
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;
}
return TRUE;
}
-static void
+static gboolean
osm_planet_poi_clear_nodes(void)
{
g_print("Removing old OSM POIs...\n");
-sqlite3_exec(db, "begin;", NULL, NULL, NULL);
+db_transaction_begin(db);
sqlite3_step(sql.delete_osm_poi);
sqlite3_step(sql.delete_place);
-sqlite3_exec(db, "commit;", NULL, NULL, NULL);
+return db_transaction_commit(db);
}
-static void
+static gboolean
osm_planet_poi_save_nodes(void)
{
g_print("Storing new POIs...\n");
-sqlite3_exec(db, "begin;", NULL, NULL, NULL);
+db_transaction_begin(db);
g_slist_foreach(osm_poi, osm_node_save_poi, NULL);
-sqlite3_exec(db, "commit;", NULL, NULL, NULL);
g_slist_free(osm_poi);
+return db_transaction_commit(db);
}
/*********************************************************************/
sqlite3_step(sql.delete_nodes);
}
-static void
+static gboolean
osm_planet_save_nodes(void)
{
-g_print("Storing nodes...\n");
-
-sqlite3_exec(db, "begin;", NULL, NULL, NULL);
+g_print("Storing nodes\n");
+db_transaction_begin(db);
g_hash_table_foreach(osm_nodes, osm_node_save_node, NULL);
-sqlite3_exec(db, "commit;", NULL, NULL, NULL);
+return db_transaction_commit(db);
}
/*********************************************************************/
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);
}
/*********************************************************************/