"+ ($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)"
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;