#!/usr/bin/python # # # 3/30/2015 Paul Mattione # # # This script adds the RF signal channels to the translation table. # import sqlite3 as lite import sys import os import re import datetime if len(sys.argv) != 2: print "You must supply a SQLite DB file to modify!" sys.exit(0); # Connect to SQLite DB file db_filename = sys.argv[1] print "" print "opening SQLite DB file: %s" % db_filename print "---------------------------------------------" con = lite.connect(db_filename) with con: # Specify that next cursor should be "dictionary" # (i.e. python's hash map) so columns can be indexed # by name con.row_factory = lite.Row # Create Cursor cur = con.cursor() # Check that this TT file has not already been updated cur.execute("SELECT * FROM Module WHERE moduleid = '1024' AND slot = '10'") rf_rows = cur.fetchall() if len(rf_rows) != 0: print 'Module was already moved' sys.exit(-1) # Update other channels for RF (were SPARE) cur.execute("UPDATE Module SET slot='10' WHERE moduleid='1024'") print 'Done'