CraZySacX / node-jdbc

JDBC Wrapper for node.js
140 stars 107 forks source link

Use column names instead of column indices in result set getters #211

Closed mologna closed 3 years ago

mologna commented 3 years ago

Summary

Problem

The latest version of the Presto JDBC driver does not support getting data from the result set by boxed integer (java.lang.Integer), but only by the primitive int type. The node-java interop code converts all integers to boxed java.lang.Integer types. This creates a paradox whereby the codebase cannot be successfully utilized to connect to Presto.

Solution

JDBC drivers support data retrieval from result sets by passing in either the column index OR the column name / label. Data retrieval by column name also has more widespread support as it is more explicit. By updating the getters to use the cmd.label (column name) we are able to avoid the boxed integer issue and successfully utilize the presto JDBC driver.