Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(5)  |  Derive(0)  |  Import(7)

        def create_database(driver, database, username=None, password=None, hostname=None):
    if driver == 'sqlite':
        db = SqliteDatabase(database)
        return db
    elif driver == 'mysql':
        db = MysqlDatabase(database, username, password, hostname)
    elif driver == 'postgres':
        # TODO
        raise DatabaseDriverNotSupported
    else:
        raise DatabaseDriverNotSupported

    # Try to connect to database
    try:
        db.connect().close()
        return db
    except AccessDenied, e:
        if password is None:
            import sys
            import getpass

            # FIXME: catch KeyboardInterrupt exception
            # FIXME: it only works on UNIX (/dev/tty),
            #  not sure whether it's bug or a feature, though
            oldout, oldin = sys.stdout, sys.stdin
            sys.stdin = sys.stdout = open('/dev/tty', 'r+')
            password = getpass.getpass()
            sys.stdout, sys.stdin = oldout, oldin

            return create_database(driver, database, username, password, hostname)
        raise e

    return db
        


src/c/v/CVSAnalY-HEAD/pycvsanaly2/DBContentHandler.py   CVSAnalY(Download)

src/m/i/MininGit-HEAD/pycvsanaly2/DBContentHandler.py   MininGit(Download)
    import sys
    from io import BytesIO
    from Database import create_database, ICursor
 
    uri = "http://svn.test-cvsanaly.org/svn/test"
 
    db = create_database('mysql', 'dbcontenthandler', sys.argv[1], None,

src/c/v/CVSAnalY-HEAD/pycvsanaly2/main.py   CVSAnalY(Download)

src/m/i/MininGit-HEAD/pycvsanaly2/main.py   MininGit(Download)
from ParserFactory import (create_parser_from_logfile,
    create_parser_from_repository)
from Database import (create_database, TableAlreadyExists, AccessDenied,
    DatabaseNotFound, DatabaseDriverNotSupported, DBRepository, statement,
    initialize_ids, DatabaseException)
    try:
        printdbg("Creating database")
        db = create_database(config.db_driver,
                             config.db_database,
                             config.db_user,