예제 #1
0
def make_conn_dict(url):
    "Make a dict that can be used by mysqldb"
    match = SQL_URL_RE.match(url)
    if match:
        conndict = match.groupdict()
        conndict['port'] = int(conndict['port'])
        conndict['use_unicode'] = True
        del conndict['db']
        del conndict['name']
    else:
        conndict = dict(host='127.0.0.1',
                        port=9306,
                        use_unicode=True,
                        user='******')
    return conndict
예제 #2
0
파일: query.py 프로젝트: TetraAsh/baruwa2
def make_conn_dict(url):
    "Make a dict that can be used by mysqldb"
    match = SQL_URL_RE.match(url)
    if match:
        conndict = match.groupdict()
        conndict['port'] = int(conndict['port'])
        conndict['use_unicode'] = True
        del conndict['db']
        del conndict['name']
    else:
        conndict = dict(host='127.0.0.1',
                        port=9306,
                        use_unicode=True,
                        user='******')
    return conndict
예제 #3
0
def extract_sphinx_opts(dburl):
    """Extract a dict of sphinx options from a DBI url"""
    match = SQL_URL_RE.match(dburl)
    if match:
        return match.groupdict()
    return {}