libsql-client-go icon indicating copy to clipboard operation
libsql-client-go copied to clipboard

Deal with multiple statements at once for all kinds of connections

Open luisfvieirasilva opened this issue 2 years ago • 1 comments

Right now (after this PR is merger) we have three kinds of connections: file://, ws:// and http://. Each one of them has a different behavior when we query multiple statements at once. For instance, if I run select 1; select 2;

  • file://: It's just run the first statement and silently ignores the other ones, so just select 1; would be executed. ps: for this one we're using sqlite3 driver.
  • ws://: It doesn't accept multiple statements at once and returns an error instead of executing
  • http://: It accepts multiple statements, running both select 1; and select 2;. User can call NextResultSet to get all the results.

The idea is to standardized this pattern, following http behavior. That is the closest one to go database/sql standard

luisfvieirasilva avatar May 04 '23 14:05 luisfvieirasilva

I'm also dealing with this problem when I'm trying to run my schema.sql at the start of the application. Multiple statements are failing when using libsql, but working when using sqlite3. Is there a better or different way to handle it?

daibertdiego avatar Apr 08 '25 15:04 daibertdiego