/+junk/Dataanalys

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/Dataanalys

« back to all changes in this revision

Viewing changes to sqlCmd.py

  • Committer: Gusatv Hartvigsson
  • Date: 2011-02-13 13:50:00 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20110213135000-su5lfygrzgbktbrs
Finnished the QC (thanks mom) and now it should be done....
hopefully...

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
        conn = sqlite3.connect("./awnsers.sqlite")
15
15
        db = conn.cursor()
16
16
 
17
 
        startQueryShow = "select * from test1 where("
 
17
        startQueryShow = "select * from awnsers where("
18
18
        startQueryCount = "select count(*) from awnsers where("
19
19
        endQuery =");"
20
20
 
23
23
                """ Shows the query where
24
24
                IE: select * from <table> where <Command>
25
25
                example:
26
 
                show test2 = 1 and test = 1"""
 
26
                        show test2 = 1 and test = 1"""
27
27
                query = commandPromt.startQueryShow + line + commandPromt.endQuery
28
28
                try:
29
29
                        result = commandPromt.db.execute(query)
35
35
        
36
36
        def do_count(self,line):
37
37
                """ counts the query where
38
 
        IE: select count(*) from <table> where <Command>
39
 
        example:
40
 
        count test2 = 1 and test = 1"""
 
38
                IE: select count(*) from <table> where <Command>
 
39
                example:
 
40
                        count test2 = 1 and test = 1"""
41
41
                query = commandPromt.startQueryCount + line + commandPromt.endQuery
42
42
                try:
43
43
                        result = commandPromt.db.execute(query)
46
46
                else:
47
47
                        for row in result:
48
48
                                print(row[0])
49
 
        
 
49
        #TODO: Add a countAll command, it will show the numbor of each true value in the DB.
 
50
        #IE:
 
51
        #gud: 13
 
52
        #vegan: 4
 
53
        #etc etc.
50
54
 
51
55
        def do_exit(self,line):
52
56
                import awnsers_and_db_edit
53
 
                print("====== returning to man menu ======")
 
57
                print("====== returning to main menu ======")##FIXME: why is this not printed before going into the main menu?
54
58
                awnsers_and_db_edit.menu()
55
59
 
56
60
        def de_EOF(self, line):