summaryrefslogtreecommitdiffstats
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-23 16:34:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-23 16:34:50 +0000
commita7b25cfc2df349d5af8d9f64b781ef9aa16b83e3 (patch)
tree773a732384e7649c5d78a2954378dee87058ddf7 /mansearch.c
parent842d2c18036af60bbed3a3624ecf8fe100d9d443 (diff)
downloadmandoc-a7b25cfc2df349d5af8d9f64b781ef9aa16b83e3.tar.gz
improve SQL style: avoid "SELECT *", be explicit in what columns we want;
suggested by espie@.
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mansearch.c b/mansearch.c
index cbf2cec8..f7c99394 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -310,14 +310,15 @@ mansearch(const struct mansearch *search,
sqlite3_finalize(s);
c = sqlite3_prepare_v2(db,
- "SELECT * FROM mlinks WHERE pageid=?"
- " ORDER BY sec, arch, name",
+ "SELECT sec, arch, name, pageid FROM mlinks "
+ "WHERE pageid=? ORDER BY sec, arch, name",
-1, &s, NULL);
if (SQLITE_OK != c)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
c = sqlite3_prepare_v2(db,
- "SELECT * FROM keys WHERE pageid=? AND bits & ?",
+ "SELECT bits, key, pageid FROM keys "
+ "WHERE pageid=? AND bits & ?",
-1, &s2, NULL);
if (SQLITE_OK != c)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
@@ -542,7 +543,8 @@ sql_statement(const struct expr *e)
size_t sz;
int needop;
- sql = mandoc_strdup("SELECT * FROM mpages WHERE ");
+ sql = mandoc_strdup(
+ "SELECT desc, form, pageid FROM mpages WHERE ");
sz = strlen(sql);
for (needop = 0; NULL != e; e = e->next) {