Exemplo n.º 1
0
 def __init__(self, cfg, dbname):
     object.__init__(self)
     self.conn = QuickConn(cfg)
     self.cursor = StatementCursor(self.conn, name='AdminConnection')
     self.stmt = Statement('select')
     self.dbname = dbname
     self.set_path(cfg.get('database', 'export_path'))
Exemplo n.º 2
0
def select_multisuite_union(suites, table, fields=None, clause=None):
    stmt = Statement()
    if fields is not None:
        stmt.fields = fields
    if clause is not None:
        stmt.set_clause(clause)
    stmts = [stmt.select(table='%s_%s' % (s, table)) for s in suites]
    return ' UNION '.join(stmts)
Exemplo n.º 3
0
 def approve_disk(self, diskname):
     clause = Eq('diskname', diskname)
     workspace = 'partition_workspace'
     sql = Statement('select')
     sql.table = workspace
     sql.clause = clause
     new_rows = sql.select(order='partition')
     if diskname not in [
             r.diskname for r in self.cursor.select(table='disks')
     ]:
         self.cursor.insert(table='disks', data=dict(diskname=diskname))
     else:
         self.cursor.delete(table='partitions', clause=clause)
     self.cursor.execute('insert into partitions %s' % new_rows)
Exemplo n.º 4
0
 def __init__(self, conn, name=None):
     CommandCursor.__init__(self, conn, name=name)
     self.stmt = Statement('select')
Exemplo n.º 5
0
 def __init__(self, conn):
     self.cmd = StatementCursor(conn, name='TableBrowser')
     CList.__init__(self, 'Tables', name='TableBrowser')
     self.set_rows(self.cmd.tables(), ['table'])
     self.set_row_select(self.__hello__)
     self.statement = Statement('select')