Ejemplo n.º 1
0
 def test_destroy(self):
     self.assertFalse(hstore.exists(connection_uri, 'test'))
     c = self.open_connection(connection_uri)
     d = hstore.open(c, 'test')
     self.assertTrue(hstore.exists(connection_uri, 'test'))
     d.destroy()
     self.assertFalse(hstore.exists(connection_uri, 'test'))
Ejemplo n.º 2
0
 def test_destroy_after_close(self):
     self.assertFalse(hstore.exists(connection_uri, 'test'))
     c = self.open_connection(connection_uri)
     d = hstore.open(c, 'test')
     self.assertTrue(hstore.exists(connection_uri, 'test'))
     d.close()
     with self.assertRaises(ValueError):
         d.destroy() # must be open to destroy
Ejemplo n.º 3
0
 def dbopen(name):
     if create:
         return hstore.open(self.__connection, name)
     if hstore.exists(self.__connection, name):
         return hstore.open(self.__connection, name)
     raise ValueError('hstore {} does not exist'.format(name))
Ejemplo n.º 4
0
 def open_hstore(self, connection_or_uri, name, table='hstores'):
     d = hstore.open(connection_or_uri, name, table=table)
     self.hstores.append(d)
     return d