-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
If sql call more that one results, like this:
select 1 aaa; select 2 bbb;
this module returns only [{"aaa":1}]
some changes in Query.java resolve that: [[{"aaa":1}],[{"bbb":2}]]
Query.java
///add
import com.facebook.react.bridge.Arguments;
///replace
protected Void doInBackground(String... params) {
String driverClass = "net.sourceforge.jtds.jdbc.Driver";
String query = params[0];
try {
Class.forName(driverClass);
Statement stmt = dbConnection.createStatement();
ResultSet rs = stmt.executeQuery(query);
WritableArray resultArray = Arguments.createArray();
WritableArray writableArray;
int n = 0;
do
{
if(n>0) rs = stmt.getResultSet();
n++;
JSONArray json = JSON.toJSON(rs);
Object[] array = ArrayUtil.toArray(json);
writableArray = ArrayUtil.toWritableArray(array);
resultArray.pushArray(writableArray);
rs.close();
}
while(stmt.getMoreResults());
sqlResponse = resultArray;
} catch (SQLException e) {
Log.e(eTag, "exception", e);
sqlError = e.getMessage();
} catch (ClassNotFoundException e) {
Log.e(eTag, "exception", e);
sqlError = e.getMessage();
} catch (Exception e) {
Log.e(eTag, "exception", e);
sqlError = e.getMessage();
}
return null;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels