summaryrefslogtreecommitdiffstats
path: root/db_demo/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'db_demo/main.c')
-rw-r--r--db_demo/main.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/db_demo/main.c b/db_demo/main.c
index 37286f1..2120be9 100644
--- a/db_demo/main.c
+++ b/db_demo/main.c
@@ -1,9 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "db.h"
+// prints a new line
+void newline(void) { printf("%s> ", DBNAME); }
+
int main(int argc, char *argv[])
{
+ char string[1024];
+
+ printf("type exit and hit <enter> to quit the program...\n\n");
+
db_init();
- db_execute("SELECT * FROM testicle ORDER BY teller");
+ newline();
+
+ // parse user input
+ while (gets(string))
+ {
+ if (!strcmp(string, "exit")) exit(0);
+ else if (!strcmp(string, "")) {}
+ else db_execute(string);
+ newline();
+ }
+
db_close();
return 0;