comparison python/storage.py @ 913:1cd878812529

work in progress
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 28 Jun 2017 17:57:06 -0400
parents b58a1061a717
children 13434f5017dd
comparison
equal deleted inserted replaced
912:fd057a6b04db 913:1cd878812529
57 print('Unallowed name {} for trajectory table'.format(tableName)) 57 print('Unallowed name {} for trajectory table'.format(tableName))
58 58
59 def createObjectsTable(cursor): 59 def createObjectsTable(cursor):
60 cursor.execute("CREATE TABLE IF NOT EXISTS objects (object_id INTEGER, road_user_type INTEGER, n_objects INTEGER, PRIMARY KEY(object_id))") 60 cursor.execute("CREATE TABLE IF NOT EXISTS objects (object_id INTEGER, road_user_type INTEGER, n_objects INTEGER, PRIMARY KEY(object_id))")
61 61
62 def createObjectsFeaturesTable(cursor): 62 def createAssignmentTable(cursor, objectType1, objectType2, columnName1, columnName2):
63 cursor.execute("CREATE TABLE IF NOT EXISTS objects_features (object_id INTEGER, trajectory_id INTEGER, PRIMARY KEY(trajectory_id))") 63 cursor.execute("CREATE TABLE IF NOT EXISTS "+objectType1+"s_"+objectType2+"s ("+columnName1+" INTEGER, "+columnName1+" INTEGER, PRIMARY KEY("+columnName1+","+columnName2+"))")
64
65 def createObjectsFeaturesTable(cursor): # same as
66 cursor.execute("CREATE TABLE IF NOT EXISTS objects_features (object_id INTEGER, trajectory_id INTEGER, PRIMARY KEY(object_id, trajectory_id))")
64 67
65 68
66 def createCurvilinearTrajectoryTable(cursor): 69 def createCurvilinearTrajectoryTable(cursor):
67 cursor.execute("CREATE TABLE IF NOT EXISTS curvilinear_positions (trajectory_id INTEGER, frame_number INTEGER, s_coordinate REAL, y_coordinate REAL, lane TEXT, PRIMARY KEY(trajectory_id, frame_number))") 70 cursor.execute("CREATE TABLE IF NOT EXISTS curvilinear_positions (trajectory_id INTEGER, frame_number INTEGER, s_coordinate REAL, y_coordinate REAL, lane TEXT, PRIMARY KEY(trajectory_id, frame_number))")
68 71