78
78
StateResult , SrvDbInfoOption , ServerAction , CB_OUTPUT_LINE , FILESPEC ,
79
79
SrvBackupOption , SrvRestoreOption , SrvNBackupOption , SrvRepairOption ,
80
80
SrvPropertiesOption , SrvPropertiesFlag , SrvValidateOption ,
81
- SrvUserOption , SrvTraceOption , UserInfo , TraceSession )
81
+ SrvUserOption , SrvTraceOption , UserInfo , TraceSession , ReqInfoCode ,
82
+ StmtInfoCode )
82
83
from .interfaces import iAttachment , iTransaction , iStatement , iMessageMetadata , iBlob , \
83
84
iResultSet , iDtc , iService , iCryptKeyCallbackImpl
84
85
from .hooks import APIHook , ConnectionHook , ServerHook , register_class , get_callbacks , add_hook
@@ -1409,7 +1410,7 @@ def firebird_version(self) -> str:
1409
1410
def implementation (self ) -> Implementation :
1410
1411
"""Implementation (old format).
1411
1412
"""
1412
- return Implementation (self .get_info (DbInfoCode .IMPLEMENTATION_OLD )[0 ])
1413
+ return Implementation (self .get_info (DbInfoCode .IMPLEMENTATION_OLD )[1 ])
1413
1414
@property
1414
1415
def provider (self ) -> DbProvider :
1415
1416
"""Database Provider.
@@ -4035,10 +4036,10 @@ def affected_rows(self) -> int:
4035
4036
StatementType .UPDATE ,
4036
4037
StatementType .DELETE )):
4037
4038
info = create_string_buffer (64 )
4038
- self ._stmt ._istmt .get_info (bytes ([23 , 1 ]), info ) # bytes(isc_info_sql_records, isc_info_end )
4039
- if ord (info [0 ]) != 23 : # pragma: no cover
4039
+ self ._stmt ._istmt .get_info (bytes ([StmtInfoCode . RECORDS , isc_info_end ]), info )
4040
+ if ord (info [0 ]) != StmtInfoCode . RECORDS : # pragma: no cover
4040
4041
raise InterfaceError ("Cursor.affected_rows:\n "
4041
- "first byte must be 'isc_info_sql_records '" )
4042
+ "first byte must be 'StmtInfoCode.RECORDS '" )
4042
4043
res_walk = 3
4043
4044
while ord (info [res_walk ]) != isc_info_end :
4044
4045
cur_count_type = ord (info [res_walk ])
@@ -4047,10 +4048,10 @@ def affected_rows(self) -> int:
4047
4048
res_walk += 2
4048
4049
count = (0 ).from_bytes (info [res_walk :res_walk + size ], 'little' )
4049
4050
# pylint: disable=R0916
4050
- if ((cur_count_type == 13 and self ._stmt .type == StatementType .SELECT )
4051
- or (cur_count_type == 14 and self ._stmt .type == StatementType .INSERT )
4052
- or (cur_count_type == 15 and self ._stmt .type == StatementType .UPDATE )
4053
- or (cur_count_type == 16 and self ._stmt .type == StatementType .DELETE )):
4051
+ if ((cur_count_type == ReqInfoCode . SELECT_COUNT and self ._stmt .type == StatementType .SELECT )
4052
+ or (cur_count_type == ReqInfoCode . INSERT_COUNT and self ._stmt .type == StatementType .INSERT )
4053
+ or (cur_count_type == ReqInfoCode . UPDATE_COUNT and self ._stmt .type == StatementType .UPDATE )
4054
+ or (cur_count_type == ReqInfoCode . DELETE_COUNT and self ._stmt .type == StatementType .DELETE )):
4054
4055
result = count
4055
4056
res_walk += size
4056
4057
return result
@@ -5588,7 +5589,8 @@ def connect_server(server: str, *, user: str=None, password: str=None,
5588
5589
spb = SPB_ATTACH (user = user , password = password , config = srv_config .config .value ,
5589
5590
trusted_auth = srv_config .trusted_auth .value ,
5590
5591
auth_plugin_list = srv_config .auth_plugin_list .value ,
5591
- expected_db = expected_db , role = role )
5592
+ expected_db = expected_db , encoding = srv_config .encoding .value ,
5593
+ errors = srv_config .encoding_errors .value , role = role )
5592
5594
spb_buf = spb .get_buffer ()
5593
5595
with a .get_api ().master .get_dispatcher () as provider :
5594
5596
if crypt_callback is not None :
0 commit comments