From 4f78a255869961a93c37a0356a6c7eaf3f32f769 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 19 Oct 2007 17:10:24 +0300 Subject: [PATCH] Add POI search SQL statements --- src/poi.c | 20 ++++++++++++++++++++ src/poi.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/poi.c b/src/poi.c index 0d639fb..f8a174d 100644 --- 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)" diff --git a/src/poi.h b/src/poi.h index e5f2cd2..339b4ec 100644 --- 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; -- 2.39.5