1
#!/usr/bin/env python3.1
2
""" Testing the cmd interface """
8
class cmdTest(cmd.Cmd):
12
conn = sqlite3.connect("./test.sqlite")
15
startQueryShow = "select * from test1 where("
16
startQueryCount = "select count(*) from test1 where("
20
def do_show(self,line):
21
""" Shows the query where
22
IE: select * from <table> where <Command>
24
show test2 = 1 and test = 1"""
25
query = cmdTest.startQueryShow + line + cmdTest.endQuery
27
result = cmdTest.db.execute(query)
29
print("Dave, I can not show you that....")
34
def do_count(self,line):
35
""" Shows the query where
36
IE: select count(*) from <table> where <Command>
38
count test2 = 1 and test = 1"""
39
query = cmdTest.startQueryCount + line + cmdTest.endQuery
41
result = cmdTest.db.execute(query)
43
print("Dave, I can not count that....")
49
def do_exit(self,line):
52
def de_EOF(self, line):
55
if __name__ == '__main__':