()
Detect which is the target web application back-end database
    management system.
Detect which is the target web application back-end database
    management system.
Detect which is the target web application back - end database management system .
def setHandler():
    """
    Detect which is the target web application back-end database
    management system.
    """

    items = [
                  (DBMS.MYSQL, MYSQL_ALIASES, MySQLMap, MySQLConn),
                  (DBMS.ORACLE, ORACLE_ALIASES, OracleMap, OracleConn),
                  (DBMS.PGSQL, PGSQL_ALIASES, PostgreSQLMap, PostgreSQLConn),
                  (DBMS.MSSQL, MSSQL_ALIASES, MSSQLServerMap, MSSQLServerConn),
                  (DBMS.SQLITE, SQLITE_ALIASES, SQLiteMap, SQLiteConn),
                  (DBMS.ACCESS, ACCESS_ALIASES, AccessMap, AccessConn),
                  (DBMS.FIREBIRD, FIREBIRD_ALIASES, FirebirdMap, FirebirdConn),
                  (DBMS.MAXDB, MAXDB_ALIASES, MaxDBMap, MaxDBConn),
                  (DBMS.SYBASE, SYBASE_ALIASES, SybaseMap, SybaseConn),
                  (DBMS.DB2, DB2_ALIASES, DB2Map, DB2Conn),
                  (DBMS.HSQLDB, HSQLDB_ALIASES, HSQLDBMap, HSQLDBConn),
            ]

    _ = max(_ if (Backend.getIdentifiedDbms() or "").lower() in _[1] else None for _ in items)
    if _:
        items.remove(_)
        items.insert(0, _)

    for dbms, aliases, Handler, Connector in items:
        if conf.dbms and conf.dbms.lower() != dbms and conf.dbms.lower() not in aliases:
            debugMsg = "skipping test for %s" % dbms
            logger.debug(debugMsg)
            continue

        handler = Handler()
        conf.dbmsConnector = Connector()

        if conf.direct:
            logger.debug("forcing timeout to 10 seconds")
            conf.timeout = 10

            dialect = DBMS_DICT[dbms][3]

            if dialect:
                sqlalchemy = SQLAlchemy(dialect=dialect)
                sqlalchemy.connect()

                if sqlalchemy.connector:
                    conf.dbmsConnector = sqlalchemy
                else:
                    try:
                        conf.dbmsConnector.connect()
                    except NameError:
                        pass
            else:
                conf.dbmsConnector.connect()

        if handler.checkDbms():
            conf.dbmsHandler = handler
            break
        else:
            conf.dbmsConnector = None

    # At this point back-end DBMS is correctly fingerprinted, no need
    # to enforce it anymore
    Backend.flushForcedDbms()
def setHandler ( ) : items = [ ( DBMS . MYSQL , MYSQL_ALIASES , MySQLMap , MySQLConn ) , ( DBMS . ORACLE , ORACLE_ALIASES , OracleMap , OracleConn ) , ( DBMS . PGSQL , PGSQL_ALIASES , PostgreSQLMap , PostgreSQLConn ) , ( DBMS . MSSQL , MSSQL_ALIASES , MSSQLServerMap , MSSQLServerConn ) , ( DBMS . SQLITE , SQLITE_ALIASES , SQLiteMap , SQLiteConn ) , ( DBMS . ACCESS , ACCESS_ALIASES , AccessMap , AccessConn ) , ( DBMS . FIREBIRD , FIREBIRD_ALIASES , FirebirdMap , FirebirdConn ) , ( DBMS . MAXDB , MAXDB_ALIASES , MaxDBMap , MaxDBConn ) , ( DBMS . SYBASE , SYBASE_ALIASES , SybaseMap , SybaseConn ) , ( DBMS . DB2 , DB2_ALIASES , DB2Map , DB2Conn ) , ( DBMS . HSQLDB , HSQLDB_ALIASES , HSQLDBMap , HSQLDBConn ) , ] _ = max ( _ if ( Backend . getIdentifiedDbms ( ) or "" ) . lower ( ) in _ [ 1 ] else None for _ in items ) if _ : items . remove ( _ ) items . insert ( 0 , _ ) for dbms , aliases , Handler , Connector in items : if conf . dbms and conf . dbms . lower ( ) != dbms and conf . dbms . lower ( ) not in aliases : debugMsg = "skipping test for %s" % dbms logger . debug ( debugMsg ) continue handler = Handler ( ) conf . dbmsConnector = Connector ( ) if conf . direct : logger . debug ( "forcing timeout to 10 seconds" ) conf . timeout = 10 dialect = DBMS_DICT [ dbms ] [ 3 ] if dialect : sqlalchemy = SQLAlchemy ( dialect = dialect ) sqlalchemy . connect ( ) if sqlalchemy . connector : conf . dbmsConnector = sqlalchemy else : try : conf . dbmsConnector . connect ( ) except NameError : pass else : conf . dbmsConnector . connect ( ) if handler . checkDbms ( ) : conf . dbmsHandler = handler break else : conf . dbmsConnector = None # At this point back-end DBMS is correctly fingerprinted, no need # to enforce it anymore Backend . flushForcedDbms ( )