tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
289 stars 37 forks source link

Add tests for naive INSERT/UPDATE/DELETE parsing #41

Closed honzasp closed 1 year ago

honzasp commented 1 year ago

Some server implementations (including the Hrana test server v1) naively parse incoming statements to distinguish between INSERT/UPDATE/DELETE (which return no rows and set rowsAffected) and SELECT (which can return rows and does not set rowsAffected). But this does not work, because INSERT/UPDATE/DELETE can return rows with a RETURNING clause.

Also, these statements can contain a WITH clause, so the INSERT/UPDATE/DELETE keyword does not have to be the first token in the SQL string.