diff 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
line wrap: on
line diff
--- a/python/storage.py	Wed Jun 28 16:51:17 2017 -0400
+++ b/python/storage.py	Wed Jun 28 17:57:06 2017 -0400
@@ -59,8 +59,11 @@
 def createObjectsTable(cursor):
     cursor.execute("CREATE TABLE IF NOT EXISTS objects (object_id INTEGER, road_user_type INTEGER, n_objects INTEGER, PRIMARY KEY(object_id))")
 
-def createObjectsFeaturesTable(cursor):
-    cursor.execute("CREATE TABLE IF NOT EXISTS objects_features (object_id INTEGER, trajectory_id INTEGER, PRIMARY KEY(trajectory_id))")
+def createAssignmentTable(cursor, objectType1, objectType2, columnName1, columnName2):
+    cursor.execute("CREATE TABLE IF NOT EXISTS "+objectType1+"s_"+objectType2+"s ("+columnName1+" INTEGER, "+columnName1+" INTEGER, PRIMARY KEY("+columnName1+","+columnName2+"))")
+
+def createObjectsFeaturesTable(cursor): # same as 
+    cursor.execute("CREATE TABLE IF NOT EXISTS objects_features (object_id INTEGER, trajectory_id INTEGER, PRIMARY KEY(object_id, trajectory_id))")
 
 
 def createCurvilinearTrajectoryTable(cursor):