Mercurial Hosting > traffic-intelligence
comparison python/utils.py @ 491:343cfd185ca6
minor changes and reaarrangements
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 16 Apr 2014 17:43:53 -0400 |
parents | 30b3455978d9 |
children | 0a93afea8243 935430b1d408 |
comparison
equal
deleted
inserted
replaced
490:60735bd452fc | 491:343cfd185ca6 |
---|---|
654 configDict = dict() | 654 configDict = dict() |
655 for sectionName in config.sections(): | 655 for sectionName in config.sections(): |
656 configDict[sectionName] = SceneParameters(config, sectionName) | 656 configDict[sectionName] = SceneParameters(config, sectionName) |
657 return configDict | 657 return configDict |
658 | 658 |
659 | |
660 ######################### | |
661 # sqlite | |
662 ######################### | |
663 | |
664 def printDBError(error): | |
665 print('DB Error: {}'.format(error)) | |
666 | |
667 def dropTables(connection, tableNames): | |
668 'deletes the table with names in tableNames' | |
669 import sqlite3 | |
670 try: | |
671 cursor = connection.cursor() | |
672 for tableName in tableNames: | |
673 cursor.execute('DROP TABLE IF EXISTS '+tableName) | |
674 except sqlite3.OperationalError as error: | |
675 printDBError(error) | |
676 | |
677 ######################### | 659 ######################### |
678 # running tests | 660 # running tests |
679 ######################### | 661 ######################### |
680 | 662 |
681 if __name__ == "__main__": | 663 if __name__ == "__main__": |