Setup database

    :param config dict: is the db adapter config
    :param key string: the key to identify dabtabase
    :param adapter string: the dabtabase adapter current support mysql only
    :param minconn int: the min connection for connection pool
    :param maxconn int: the max connection for connection pool
    :param slave boolean: If True the database can be read only.

def setup(config,  minconn=5, maxconn=10,  adapter='mysql', key='default', slave=False):
    """Setup database

    :param config dict: is the db adapter config
    :param key string: the key to identify dabtabase
    :param adapter string: the dabtabase adapter current support mysql only
    :param minconn int: the min connection for connection pool
    :param maxconn int: the max connection for connection pool
    :param slave boolean: If True the database can be read only.


    """
    global __db

    if '.' in key:
        raise TypeError('The DB Key: "%s" Can\'t Contain dot' % (key))

    if slave == False and key in __db:
        raise DBError('The Key: "%s" was set' % (key))

    database = DB(config, minconn, maxconn, key, adapter)

    master_key = key
    slave_key = key + '.slave'

    if not slave:
        __db[master_key] = database
        if slave_key not in __db:
            __db[slave_key] = [database]
    else:
        if key in __db:
            databases = __db[slave_key]
            if len(databases) == 1 and __db[master_key] == databases[0]:
                __db[slave_key] = [database]
            else:
                __db[slave_key].append(database)
        else:
            __db[slave_key] = [database]