예제 #1
0
def connect():
    global db
    db = webpy_db.database(port=port,
                           host=host,
                           dbn='postgres',
                           db=the_db,
                           user=user,
                           pw=pw)
    print '开始连接数据库 %s' % host
예제 #2
0
파일: test_pg.py 프로젝트: Jasonfloy/lib
def connect():
    global db
    db = webpy_db.database(
        port=5432,
        host=DB_IP,
        dbn='postgres',
        db='base',
        user='******',
        pw='base')
    print '开始连接数据库 %s' % DB_IP
예제 #3
0
def connect():
    global db
    db = webpy_db.database(
        port=5432,
        host=host,
        dbn='postgres',
        db=the_db,
        user=user,
        pw=pw)
    print '开始连接数据库 %s' % host
예제 #4
0
파일: shard.py 프로젝트: xianhuawei/utils
 def gen_db(self, node_cfg):
     pool_policy = node_cfg.get('pool_policy', 'default')
     node_cfg['pooling'], node_cfg['dbn'] = True, 'mysql'
     node_cfg.update(_pool_policy[pool_policy])
     if 'port' in node_cfg:
         node_cfg['port'] = int(node_cfg['port'])
     else:
         node_cfg['port'] = 3306
     return database(
         **{k: v
            for k, v in node_cfg.items() if k not in _config_fields})