Exemplo n.º 1
0
def init_database():
    from globaldb import global_conn as db
    for table_name in config.BASE_TABLE :
        with open(config.SQL_TPL_DIR+'argo_'+table_name+'.sql') as f:
            sql = f.read()
            print sql
            db.execute(sql)
Exemplo n.º 2
0
def init_table(table_name):
    from globaldb import global_conn as db
    with open(config.SQL_TPL_DIR+'argo_'+table_name+'.sql') as f:
        sql = f.read()
        print sql
        try:
            db.execute(sql)
        except Exception as e:
            print e
            raw_input('>> ')
Exemplo n.º 3
0
def init_table(table_name):
    from globaldb import global_conn as db
    with open(config.SQL_TPL_DIR + 'argo_' + table_name + '.sql') as f:
        sql = f.read()
        print sql
        try:
            db.execute(sql)
        except Exception as e:
            print e
            raw_input('>> ')
Exemplo n.º 4
0
def init_table(table_name):
    from globaldb import global_conn as db

    with open(argo_conf.SQL_DIR + "argo_" + table_name + ".sql") as f:
        sql = f.read()
        print sql
        try:
            db.execute(sql)
        except Exception as e:
            print e
            raw_input(">> ")
Exemplo n.º 5
0
def set_up_new_board(boardname,keys):
    keys['boardname'] = boardname
    db.execute(new_board_text % { "boardname":boardname})
    insert_dict('argo_boardhead',keys)
Exemplo n.º 6
0
def insert_dict(table,kv_pairs):
    exist_attr = kv_pairs.keys()
    exist_val = map(lambda x : "'%s'" % x,kv_pairs.values())
    sql = "INSERT INTO %s(%s) values(%s)" % (table, ','.join(exist_attr), ','.join(exist_val))
    db.execute(sql)