marklogic-community / ml-jdbc-driver

Making JDBC connections to MarkLogic SQL/ODBC Server
Other
3 stars 4 forks source link

JDBC returns false for all booleans #11

Closed bshalke closed 3 years ago

bshalke commented 4 years ago

Describe the bug When requesting values from the ML JDBC server, all booleans will be returned as false

To Reproduce Install the ML JDBC driver Insert the test TDE found here: https://github.com/marklogic-community/ml-jdbc-driver/blob/master/TDE_JDBCTestDataTypes.xml View TDE Observe that all boolean values are false, even though the TDE explicitly sets them to true

Calling the same TDE from the Query Console results in the correct behavior.

Expected behavior Boolean values should match what is in the database

Screenshots Query Console DbVisualizer

Desktop (please complete the following information):

Additional context Reproduced on multiple ML clusters, with multiple TDE definitions, with DbVisualizer and Coveo consumers.

bobstarbird commented 4 years ago

ml-jdbc-driver\src\main\java\org\postgresql\jdbc\PgResultSet.java

if (Oid.BOOL == fields[col].getOID()) { final byte[] v = this_row[col]; return (1 == v.length) && (116 == v[0]); // 116 = 't' }

So PostgeSQL vs MarkLogic (xquery) would suggest a quick hack but not a kludge return (116 == v[0]); // 116 = 't'