Mercurial Hosting > traffic-intelligence
comparison python/utils.py @ 344:14a2405f54f8
slight modification to safety analysis and generalized script to delete computed data (objects and interactions)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 21 Jun 2013 17:32:57 -0400 |
parents | c9201f6b143a |
children | c64a4f889b97 |
comparison
equal
deleted
inserted
replaced
343:74e437ab5f11 | 344:14a2405f54f8 |
---|---|
453 | 453 |
454 ######################### | 454 ######################### |
455 # sqlite | 455 # sqlite |
456 ######################### | 456 ######################### |
457 | 457 |
458 def printDBError(error): | |
459 print('DB Error: {}'.format(error)) | |
460 | |
458 def dropTables(connection, tableNames): | 461 def dropTables(connection, tableNames): |
459 'deletes the table with names in tableNames' | 462 'deletes the table with names in tableNames' |
460 cursor = connection.cursor() | 463 try: |
461 for tableName in tableNames: | 464 cursor = connection.cursor() |
462 cursor.execute('DROP TABLE '+tableName) | 465 for tableName in tableNames: |
466 cursor.execute('DROP TABLE '+tableName) | |
467 except sqlite3.OperationalError as error: | |
468 printDBError(error) | |
463 | 469 |
464 ######################### | 470 ######################### |
465 # running tests | 471 # running tests |
466 ######################### | 472 ######################### |
467 | 473 |