xerial / sqlite-jdbc

SQLite JDBC Driver
Apache License 2.0
2.86k stars 619 forks source link

Cant retrieve multiple result sets from PreparedStatement.execute() #1062

Closed urosjarc closed 9 months ago

urosjarc commented 9 months ago

Describe the bug

If I run multiple queries per prepared statement...

val sql = """
    select * from Table1;
    select * from Table2;
    select * from Table3;
"""

And try to retrieve first 2 results I get only first result set per prepared statement. PS: This code works on postgresql driver and mariadb driver...

ps = conn.prepareStatement(sql)
var isResultSet = ps.execute()

var count = 0
do {
    if (isResultSet) {
        rs = ps.resultSet
        returned.add(decodeResultSet(count, rs)) // decodeResultSet extracts informations from result set to objects
        rs.close()
    } else {
        if (ps.updateCount == -1) break
    } //If there is no more result finish

    count++
    isResultSet = ps.moreResults //Get next result
} while (isResultSet)

return returned

Expected behavior

The result set should get more results not only 1.

Environment (please complete the following information):

gotson commented 9 months ago

Yes, this is a known limitation.

gotson commented 9 months ago

Duplicate of #277

urosjarc commented 9 months ago

Can you elaborate about this issue, I would really like to know more because I'm producing db library supporting many of known JDBC supported databases and some drivers have supported this, some not...

I would be more than happy if you provide some links related to this for further reading.

gotson commented 9 months ago

did you read #277 ? it has all the info

urosjarc commented 9 months ago

Yes I did... But I wonder if there is more informations related to this?

gotson commented 9 months ago

No