2021-12-30 19:43:52 +01:00
#coding:utf-8
2022-01-27 20:08:36 +01:00
"""
ID : issue - 7045
ISSUE : 7045
TITLE : International characters in table or alias names causes queries of MON $ STATEMENTS to fail
DESCRIPTION :
Blob column mon $ explained_plan seems to be source of problem , but only for mon $ statements table .
Other blob columns ( e . g . rdb $ exceptions . rdb $ description or sec $ users . sec $ description ) not affected .
2021-12-30 19:43:52 +01:00
2022-01-27 20:08:36 +01:00
Confirmed bug on 5.0 .0 .310 .
Checked on 5.0 .0 .311 - all fine .
"""
2021-12-30 19:43:52 +01:00
2022-01-27 20:08:36 +01:00
import pytest
from firebird . qa import *
db = db_factory ( )
2021-12-30 19:43:52 +01:00
2022-01-27 20:08:36 +01:00
act = python_act ( ' db ' )
2021-12-30 19:43:52 +01:00
2022-01-27 20:08:36 +01:00
@pytest.mark.skip ( ' FIXME: Not IMPLEMENTED ' )
@pytest.mark.version ( ' >=5.0 ' )
def test_1 ( act : Action ) :
pytest . fail ( " Not IMPLEMENTED " )
2021-12-30 19:43:52 +01:00
# test_script_1
#---
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# import os
# import subprocess
# import time
# import codecs
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# db_conn.close()
# os.environ["ISC_USER"] = user_name
# os.environ["ISC_PASSWORD"] = user_password
2022-01-25 22:55:48 +01:00
#
#
2021-12-30 19:43:52 +01:00
# #--------------------------------------------
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# def flush_and_close( file_handle ):
# # https://docs.python.org/2/library/os.html#os.fsync
2022-01-25 22:55:48 +01:00
# # If you're starting with a Python file object f,
# # first do f.flush(), and
2021-12-30 19:43:52 +01:00
# # then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk.
# global os
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# file_handle.flush()
# if file_handle.mode not in ('r', 'rb') and file_handle.name != os.devnull:
# # otherwise: "OSError: [Errno 9] Bad file descriptor"!
# os.fsync(file_handle.fileno())
# file_handle.close()
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# #--------------------------------------------
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# def cleanup( f_names_list ):
# global os
# for f in f_names_list:
# if type(f) == file:
# del_name = f.name
# elif type(f) == str:
# del_name = f
# else:
# print('Unrecognized type of element:', f, ' - can not be treated as file.')
# del_name = None
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# if del_name and os.path.isfile( del_name ):
# os.remove( del_name )
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# #--------------------------------------------
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# non_ascii_char = 'á'
# conn_charset = 'iso8859_1'
# sql_cmd=''' set list on;
# set blob all;
# set names %(conn_charset)s;
# connect '%(dsn)s';
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# select mon$explained_plan -- BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET UTF8
# from mon$statements as "%(non_ascii_char)s" where mon$attachment_id = current_connection
# ;
# ''' % dict(globals(), **locals())
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# # >>> do not (ordinal not in range(128)" >>> f_sql_chk = codecs.open( os.path.join(context['temp_directory'],'tmp_7045_run.sql'), 'w', encoding = 'latin-1')
# f_sql_chk = open( os.path.join(context['temp_directory'],'tmp_7045_run.sql'), 'w')
# f_sql_chk.write(sql_cmd.decode('utf8').encode('latin-1'))
# flush_and_close( f_sql_chk )
2022-01-25 22:55:48 +01:00
#
#
2021-12-30 19:43:52 +01:00
# f_sql_log = open( ''.join( (os.path.splitext(f_sql_chk.name)[0], '.log' ) ), 'w')
# f_sql_err = open( ''.join( (os.path.splitext(f_sql_chk.name)[0], '.err' ) ), 'w')
# subprocess.call( [ context['isql_path'], '-q', '-i', f_sql_chk.name ], stdout = f_sql_log, stderr = f_sql_err)
# flush_and_close( f_sql_log )
# flush_and_close( f_sql_err )
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# if os.path.getsize(f_sql_err.name):
# print('UNEXPECTED STDERR:')
# with open(f_sql_err.name, 'r') as f:
# print(f.read())
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
# cleanup((f_sql_chk, f_sql_log, f_sql_err))
2022-01-25 22:55:48 +01:00
#
2021-12-30 19:43:52 +01:00
#---