summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-23 16:33:38 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-23 16:33:38 +0000
commitaba8f222ce9ee0b8b034c874f1636385fc6267db (patch)
treeba52da789b95242116d5ebaaed88cd0cc2ad80c0 /usr.bin/mandoc
parent7fb61e9ea715e208887bf916718ddcd73d36c34a (diff)
improve SQL style: avoid "SELECT *", be explicit in what columns we want;
suggested by espie@.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mandocdb.c5
-rw-r--r--usr.bin/mandoc/mansearch.c12
2 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 4a75494348c..ee75af0e0b8 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.98 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.99 2014/04/23 16:33:37 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1279,7 +1279,8 @@ names_check(void)
"AND mlinks.name == names.name"
")"
") JOIN ("
- "SELECT * FROM mlinks GROUP BY pageid"
+ "SELECT sec, arch, name, pageid FROM mlinks "
+ "GROUP BY pageid"
") USING (pageid);",
-1, &stmt, NULL);
diff --git a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c
index 9141c4c691d..cf2299dd0ad 100644
--- a/usr.bin/mandoc/mansearch.c
+++ b/usr.bin/mandoc/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.24 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.25 2014/04/23 16:33:37 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -302,14 +302,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));
@@ -534,7 +535,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) {