예제 #1
0
 def _open_table(self, name):
     schema_cur = Cursor(self, self.conn.schematab)
     schema_cur.set_key(name)
     if schema_cur.search():
         k, v, c, cset, idx = schema_cur.get_value()
         c = tuple(parse_config(c))
         cset = tuple(parse_config(cset))
         idx = tuple(parse_config(idx))
         self.tables[name] = Table(k, v, c, cset, idx)
예제 #2
0
 def create_table(self, name, config=''):
     schema = {}
     for k, v in parse_config(config):
         if k in ('key_format', 'value_format', 'columns'):
             schema[k] = v
         elif k.startswith('colgroup'):
             schema['colgroup'] = schema.get('colgroup', (,)) + (k[len('colgroup')+1:], v)
         elif k.startswith('index'):
             schema['indices'] = schema.get('indices', (,)) + (k[len('index')+1:], v)
         else:
             raise 'Unknown configuration "' + k + '"'
     if name in self.tables:
         self.tables[name].check_schema(**schema)