From 9894f3c77ae975ffd212286e38a786c73b275757 Mon Sep 17 00:00:00 2001 From: <> Date: Sun, 12 Mar 2017 20:03:51 -0700 Subject: [PATCH] got tables to display in a basic way --- main.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index d49820d..f9ccc73 100644 --- a/main.c +++ b/main.c @@ -23,9 +23,9 @@ inline char *get_filename(const char c) { return qout; } -inline char *get_tblheader(const char c) { +inline void print_tblheader(const char *c) { char *out; - switch (c) { + switch (*c) { default: out = "
| \
@@ -55,23 +55,28 @@ inline char *get_tblheader(const char c) {
";
break;
}
- return out;
+ printf("%s", out);
}
//display and format the results of the query.
-void qresult(sqlite3_stmt *sp) {
+void qresult(sqlite3_stmt *sp, const char *c) {
int e;
- unsigned int cc, i;
+ unsigned int i;
+ unsigned int cc = sqlite3_column_count(sp);
+ print_tblheader(c);
while ((e = sqlite3_step(sp)) == SQLITE_ROW) {
- cc = sqlite3_column_count(sp);
+ printf("
---|
%s | ", sqlite3_column_text(sp, i)); } - printf("\n"); + printf("