diff --git a/src/DatabaseLibrary/query.py b/src/DatabaseLibrary/query.py index 3649203..39a1222 100644 --- a/src/DatabaseLibrary/query.py +++ b/src/DatabaseLibrary/query.py @@ -827,7 +827,11 @@ def _log_query_results(self, col_names, result_rows, log_head: Optional[int] = N msg += f"" msg += f'{i}' for cell in row: - msg += f'{cell}' + try: + cell_string = str(cell) + except TypeError as e: + cell_string = f"Unable printing the value: {e}" + msg += f'{cell_string}' msg += "" msg += "" if table_truncated: diff --git a/src/DatabaseLibrary/version.py b/src/DatabaseLibrary/version.py index 4260069..5dfae46 100644 --- a/src/DatabaseLibrary/version.py +++ b/src/DatabaseLibrary/version.py @@ -1 +1 @@ -VERSION = "2.1.3" +VERSION = "2.1.4" diff --git a/test/tests/custom_db_tests/oracle_blob.robot b/test/tests/custom_db_tests/oracle_blob.robot new file mode 100644 index 0000000..aae973c --- /dev/null +++ b/test/tests/custom_db_tests/oracle_blob.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation Tests for querying a table with BLOB data type. +... The data type naming is DB specific, these tests are designed for Oracle DB only. + +Resource ../../resources/common.resource + +Suite Setup Connect To DB +Suite Teardown Disconnect From Database +Test Setup Execute Sql String +... CREATE TABLE blob_table (id integer not null unique, data blob) +Test Teardown Execute Sql String DROP TABLE blob_table + + +*** Variables *** +${DB_MODULE} oracledb +${DB_HOST} 127.0.0.1 +${DB_PORT} 1521 +${DB_PASS} pass +${DB_USER} db_user +${DB_NAME} db +${ORACLE_LIB_DIR} ${EMPTY} + + +*** Test Cases *** +Blob Data Type - Logging Results Causes No Error + [Documentation] See https://github.com/MarketSquare/Robotframework-Database-Library/issues/244 + ${binary_data}= Evaluate b'abc' + Execute Sql String INSERT INTO blob_table VALUES(1, '${binary_data}') + ${result}= Query SELECT data FROM blob_table WHERE id=1