def apply_driver_hacks(self, app, sa_url, options):
if sa_url.drivername.startswith('<STR_LIT>'):<EOL><INDENT>sa_url.query.setdefault('<STR_LIT>', '<STR_LIT:utf8>')<EOL>if sa_url.drivername != '<STR_LIT>':<EOL><INDENT>options.setdefault('<STR_LIT>', <NUM_LIT:10>)<EOL>options.setdefault('<STR_LIT>', <NUM_LIT>)<EOL><DEDENT><DEDENT>elif sa_url.drivername == '<STR_LIT>':<EOL><INDENT>pool_size = options.get('<STR_LIT>')<EOL>detected_in_memory = False<EOL>if sa_url.database in (None, '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>detected_in_memory = True<EOL>from sqlalchemy.pool import StaticPool<EOL>options['<STR_LIT>'] = StaticPool<EOL>if '<STR_LIT>' not in options:<EOL><INDENT>options['<STR_LIT>'] = {}<EOL><DEDENT>options['<STR_LIT>']['<STR_LIT>'] = False<EOL>if pool_size == <NUM_LIT:0>:<EOL><INDENT>raise RuntimeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT>elif not pool_size:<EOL><INDENT>from sqlalchemy.pool import NullPool<EOL>options['<STR_LIT>'] = NullPool<EOL><DEDENT>if not detected_in_memory:<EOL><INDENT>sa_url.database = os.path.join(app.root_path, sa_url.database)<EOL><DEDENT><DEDENT>unu = app.config['<STR_LIT>']<EOL>if unu is None:<EOL><INDENT>unu = self.use_native_unicode<EOL><DEDENT>if not unu:<EOL><INDENT>options['<STR_LIT>'] = False<EOL><DEDENT>if app.config['<STR_LIT>'] is not None:<EOL><INDENT>warnings.warn(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>DeprecationWarning<EOL>)<EOL><DEDENT>if not self.use_native_unicode:<EOL><INDENT>warnings.warn(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>DeprecationWarning<EOL>)<EOL><DEDENT>
This method is called before engine creation and used to inject
        driver specific hacks into the options.  The `options` parameter is
        a dictionary of keyword arguments that will then be used to call
        the :func:`sqlalchemy.create_engine` function.

        The default implementation provides some saner defaults for things
        like pool sizes for MySQL and sqlite.  Also it injects the setting of
        `SQLALCHEMY_NATIVE_UNICODE`.