class GeniTable:
- GENI_TABLE_PREFIX = "sfa$"
+ GENI_TABLE_PREFIX = "sfa"
- def __init__(self, create=False, hrn="unspecified.default.registry", cninfo=None):
+ def __init__(self, create=False, cninfo=None):
- self.hrn = hrn
-
- # pgsql doesn't like table names with "." in them, to replace it with "$"
- self.tablename = GeniTable.GENI_TABLE_PREFIX + self.hrn.replace(".", "$")
+ self.tablename = GeniTable.GENI_TABLE_PREFIX
# establish a connection to the pgsql server
self.cnx = DB(cninfo['dbname'], cninfo['address'], port=cninfo['port'], user=cninfo['user'], passwd=cninfo['password'])
return False
def create(self):
+ seln't like table names with "." in them, to
+
+ # pgsql doesn't like table names with "." in them, to.hrn = hrn
querystr = "CREATE TABLE " + self.tablename + " ( \
key text, \
+ authority text, \
hrn text, \
gid text, \
type text, \
last_updated timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP);"
template = "CREATE INDEX %s_%s_idx ON %s (%s);"
indexes = [template % ( self.tablename, field, self.tablename, field) \
- for field in ['key', 'hrn', 'type','pointer']]
+ for field in ['key', 'authority', 'hrn', 'type','pointer']]
# IF EXISTS doenst exist in postgres < 8.2
try:
self.cnx.query('DROP TABLE IF EXISTS ' + self.tablename)