3 #text |
request = <SubRequest 'act' for <Function test_1>>
@pytest.fixture
def isql_act_fixture(request: pytest.FixtureRequest) -> Action:
> db: Database = request.getfixturevalue(db_fixture_name)
src\firebird\qa\plugin.py:2695:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'db' for <Function test_1>>
db_path = WindowsPath('H:/QA/temp/qa2024.tmp/fbqa/test_11807')
db_cache = <firebird.qa.plugin.DbCache pytest object at [hex]>
@pytest.fixture
def database_fixture(request: pytest.FixtureRequest, db_path, db_cache) -> Database:
db = Database(db_path, filename, user, password, charset, debug=str(request.module),
config_name=config_name, utf8filename=utf8filename)
if not do_not_create:
if from_backup is None and copy_of is None:
> db.create(page_size, sql_dialect, db_cache)
src\firebird\qa\plugin.py:971:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
database = 'pytest'
def create_database(database: str, *, user: str=None, password: str=None, role: str=None,
no_gc: bool=None, no_db_triggers: bool=None, dbkey_scope: DBKeyScope=None,
crypt_callback: iCryptKeyCallbackImpl=None, charset: str=None,
overwrite: bool=False, auth_plugin_list=None,
session_time_zone: str=None) -> Connection:
"""Creates new database.
Arguments:
database: DSN or Database configuration name.
user: User name.
password: User password.
role: User role.
no_gc: Do not perform garbage collection for this connection.
no_db_triggers: Do not execute database triggers for this connection.
dbkey_scope: DBKEY scope override for connection.
crypt_callback: Callback that provides encryption key for the database.
charset: Character set for connection.
overwrite: Overwite the existing database.
auth_plugin_list: List of authentication plugins override
session_time_zone: Session time zone [Firebird 4]
Hooks:
Event `.ConnectionHook.ATTACHED`: Executed before `Connection` instance is
returned. Hook must have signature::
hook_func(connection: Connection) -> None
Any value returned by hook is ignored.
"""
db_config = driver_config.get_database(database)
if db_config is None:
db_config = driver_config.db_defaults
db_config.database.value = database
if db_config.server.value is None:
srv_config = driver_config.server_defaults
else:
srv_config = driver_config.get_server(db_config.server.value)
if srv_config is None:
raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
else:
if db_config.server.value is None:
srv_config = driver_config.server_defaults
else:
srv_config = driver_config.get_server(db_config.server.value)
if srv_config is None:
raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
if user is None:
user = db_config.user.value
if user is None:
user = srv_config.user.value
if password is None:
password = db_config.password.value
if password is None:
password = srv_config.password.value
if role is None:
role = db_config.role.value
if charset is None:
charset = db_config.charset.value
if charset:
charset = charset.upper()
if auth_plugin_list is None:
auth_plugin_list = db_config.auth_plugin_list.value
if session_time_zone is None:
session_time_zone = db_config.session_time_zone.value
dsn = _connect_helper(db_config.dsn.value, srv_config.host.value, srv_config.port.value,
db_config.database.value, db_config.protocol.value)
dpb = DPB(user=user, password=password, role=role, trusted_auth=db_config.trusted_auth.value,
sql_dialect=db_config.db_sql_dialect.value, timeout=db_config.timeout.value,
charset=charset, cache_size=db_config.cache_size.value,
no_linger=db_config.no_linger.value, utf8filename=db_config.utf8filename.value,
no_gc=no_gc, no_db_triggers=no_db_triggers, dbkey_scope=dbkey_scope,
dummy_packet_interval=db_config.dummy_packet_interval.value,
config=db_config.config.value, auth_plugin_list=auth_plugin_list,
session_time_zone=session_time_zone, set_bind=db_config.set_bind.value,
decfloat_round=db_config.decfloat_round.value,
decfloat_traps=db_config.decfloat_traps.value,
overwrite=overwrite, db_cache_size=db_config.db_cache_size.value,
forced_writes=db_config.forced_writes.value, page_size=db_config.page_size.value,
reserve_space=db_config.reserve_space.value, sweep_interval=db_config.sweep_interval.value,
db_sql_dialect=db_config.db_sql_dialect.value, db_charset=db_config.db_charset.value)
> return __make_connection(True, dsn, db_config.utf8filename.value,
dpb.get_buffer(for_create=True), db_config.sql_dialect.value,
charset, crypt_callback)
C:\Python3x\Lib\site-packages\firebird\driver\core.py:2232:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
create = True
dsn = 'localhost/33337:H:\\QA\\temp\\qa2024.tmp\\fbqa\\test_11807\\test.fdb'
utf8filename = False
dpb = b'\x01\x1c\x06SYSDBA\x1d\tmasterkey0\x04NONED\x04NONED\x04NONE'
sql_dialect = 3, charset = 'NONE', crypt_callback = None
def __make_connection(create: bool, dsn: str, utf8filename: bool, dpb: bytes,
sql_dialect: int, charset: str,
crypt_callback: iCryptKeyCallbackImpl) -> Connection:
with a.get_api().master.get_dispatcher() as provider:
if crypt_callback is not None:
provider.set_dbcrypt_callback(crypt_callback)
if create:
> att = provider.create_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
C:\Python3x\Lib\site-packages\firebird\driver\core.py:2052:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iProvider pytest object at [hex]>
filename = 'localhost/33337:H:\\QA\\temp\\qa2024.tmp\\fbqa\\test_11807\\test.fdb'
dpb = b'\x01\x1c\x06SYSDBA\x1d\tmasterkey0\x04NONED\x04NONED\x04NONE'
encoding = 'utf-8'
def create_database(self, filename: str, dpb: bytes, encoding: str = 'ascii') -> iAttachment:
"Replaces `isc_create_database()`"
result = self.vtable.createDatabase(self, self.status, filename.encode(encoding), len(dpb), dpb)
> self._check()
C:\Python3x\Lib\site-packages\firebird\driver\interfaces.py:1300:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iProvider pytest object at [hex]>
def _check(self) -> None:
state = self.status.get_state()
if StateFlag.ERRORS in state:
> raise self.__report(DatabaseError, self.status.get_errors())
E firebird.driver.types.DatabaseError: Unable to complete network request to host "localhost".
E -Failed to establish a connection.
C:\Python3x\Lib\site-packages\firebird\driver\interfaces.py:113: DatabaseError
|