This is a discussion thread for the proposals to change the Hrana protocol. Feel free to add anything you want to discuss.
To start with:
1. Add information about state of autocommit to every response
Currently (as of #759) we do it manually, by appending GetAutocommitReq to every batch, as it's required by libsql client in order to properly inform about the state of connection as perceived by the server. We could add it to ResponseOkMsg instead.
2. Use capabilities of StoreSql at Stmt level
Currently we use StoreSqlReq to cache SQL text under a specific (stream scoped) int identifier - later on we can reuse this id to avoid sending the same SQL text around. My guess is that it was supposed to work with prepared statements.
However current protocol has significant limitations:
SequenceReq that is supposed to be used for stored sql ids doesn't allow to pass parameters.
- It also doesn't allow to return responses.
- It cannot be used in batches.
The idea was to expand Stmt struct definition to enable using optional sql_id, that would work just like StoreSql command, but since it's defined at Stmt level, it could be used in all contexts that SequenceReq couldn't (meaning also all of the points above). I'm not sure how doable it is on the server side. Any feedback @MarinPostma ?
This is a discussion thread for the proposals to change the Hrana protocol. Feel free to add anything you want to discuss.
To start with:
1. Add information about state of autocommit to every response
Currently (as of #759) we do it manually, by appending
GetAutocommitReqto every batch, as it's required by libsql client in order to properly inform about the state of connection as perceived by the server. We could add it toResponseOkMsginstead.2. Use capabilities of
StoreSqlatStmtlevelCurrently we use
StoreSqlReqto cache SQL text under a specific (stream scoped) int identifier - later on we can reuse this id to avoid sending the same SQL text around. My guess is that it was supposed to work with prepared statements.However current protocol has significant limitations:
SequenceReqthat is supposed to be used for stored sql ids doesn't allow to pass parameters.The idea was to expand
Stmtstruct definition to enable using optional sql_id, that would work just likeStoreSqlcommand, but since it's defined atStmtlevel, it could be used in all contexts thatSequenceReqcouldn't (meaning also all of the points above). I'm not sure how doable it is on the server side. Any feedback @MarinPostma ?