]> err.no Git - mapper/commitdiff
Add POI search SQL statements
authorKaj-Michael Lang <milang@angel.tal.org>
Fri, 19 Oct 2007 14:10:24 +0000 (17:10 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Fri, 19 Oct 2007 14:10:24 +0000 (17:10 +0300)
src/poi.c
src/poi.h

index 0d639fb5595b34ba75a53df79c90f6ade31808a5..f8a174d862af3a417c2667fca91a3685faeab0c0 100644 (file)
--- a/src/poi.c
+++ b/src/poi.c
@@ -176,6 +176,26 @@ poi_db_prepare(sqlite3 *db)
                        "+ ($LON - p.lon) * ($LON - p.lon)) limit 1",
                        -1, &poisql.select_nearest_poi, NULL);
 
+       /* Search POI label */
+       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 "
+                       " where p.lat between ? and ? "
+                       " and p.lon between ? and ? "
+                       " and c.enabled = 1 and p.cat_id = c.cat_id and p.label like ?",
+                       -1, &poisql.select_poi_search, NULL);
+
+       /* Search POI label && category */
+       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 "
+                       " where p.lat between ? and ? "
+                       " and p.lon between ? and ? "
+                       " and c.enabled = 1 and p.cat_id = c.cat_id and p.label like ? and c.cat_id = ?",
+                       -1, &poisql.select_poi_search_cat, NULL);
+
        /* insert poi */
        sqlite3_prepare_v2(db,
                        "insert into poi (lat, lon, label, desc, cat_id, public)"
index e5f2cd2876d36d2e2a00fb5e8107ff7e9e976521..339b4ecd2fd2f9c6b60e5efacbe6e8bd637b597c 100644 (file)
--- a/src/poi.h
+++ b/src/poi.h
@@ -62,6 +62,8 @@ struct _poi_category {
 struct sql_poi_stmt {
        sqlite3_stmt *select_poi;
        sqlite3_stmt *select_nearest_poi;
+       sqlite3_stmt *select_poi_search;
+       sqlite3_stmt *select_poi_search_cat;
        sqlite3_stmt *insert_poi;
        sqlite3_stmt *update_poi;
        sqlite3_stmt *delete_poi;