#include "osm-sql-tables.h"
/* #define DEBUG_OSM */
-/* #define DEBUG_OSM_TIME */
+#define DEBUG_OSM_TIME
#define OSM_PLACE_CACHE_MAX_ITEMS (64)
#define OSM_DB_PROGRESS_NUM (30000)
/* Way range for searching again */
#define OSM_RANGE_WAY (12000)
+#ifdef DEBUG_OSM_TIME
+#define QT_START { g_timer_start(dbt); }
+#define QT_END { g_timer_stop(dbt); g_debug("Query took: %f sec", g_timer_elapsed(dbt, &tms)); }
+#else
+#define QT_START
+#define QT_END
+#endif
+
static sqlite3 *osmdb;
static gboolean osm_db_ok;
};
static struct sql_select_stmt sql;
static GTimer *dbt;
+static gulong tms;
static GtkProgressBar *dbpw=NULL;
static const gchar *osm_tables[]={
return FALSE;
}
+QT_START
if (SQLITE_ROW == sqlite3_step(sql.select_place)) {
const gchar *place;
guint32 dist;
/* n->isin_c=sqlite3_column_int(sql.select_place, 6); */
return TRUE;
}
+QT_END
return FALSE;
}
n=osm_place_new();
n->isin_p=n->lat=n->lon=n->dist=0;
+QT_START
if (SQLITE_ROW == sqlite3_step(sql.select_place_near)) {
const gchar *place;
guint32 dist;
/* n->isin_c=sqlite3_column_int(sql.select_place_near, 6); */
n->type=type;
+ QT_END
osm_place_cache_add(n);
*nr=n;
{
GList *ways=NULL;
osm_way *w;
-gulong tms;
guint wc=0;
g_return_val_if_fail(sql.select_way2, NULL);
return NULL;
}
-#ifdef DEBUG_OSM_TIME
-g_timer_start(dbt);
-#endif
-
+QT_START
while (SQLITE_ROW == sqlite3_step(sql.select_way2)) {
guint32 dist;
gint lat, lon;
ways=g_list_prepend(ways, w);
}
-
-#ifdef DEBUG_OSM_TIME
-g_timer_stop(dbt);
-g_debug("Query took: %f sec, found: %d ways", g_timer_elapsed(dbt, &tms), wc);
-#endif
+QT_END
return ways;
}