canonical / dqlite

Embeddable, replicated and fault-tolerant SQL engine.
https://dqlite.io
Other
3.83k stars 216 forks source link

Refactor gateway.c #476

Closed cole-miller closed 1 year ago

cole-miller commented 1 year ago

This PR refactors gateway.c to store several pieces of request-scoped data in the request handle object instead of the gateway itself. In the process, I fixed (?) how we handle parameters to multi-statement EXEC_SQL requests.

codecov[bot] commented 1 year ago

Codecov Report

Merging #476 (3071ed3) into master (690818b) will decrease coverage by 0.14%. The diff coverage is 66.29%.

@@            Coverage Diff             @@
##           master     #476      +/-   ##
==========================================
- Coverage   58.86%   58.73%   -0.14%     
==========================================
  Files          33       33              
  Lines        5915     5869      -46     
  Branches     1768     1762       -6     
==========================================
- Hits         3482     3447      -35     
+ Misses       1366     1358       -8     
+ Partials     1067     1064       -3     
Impacted Files Coverage Δ
src/gateway.c 42.17% <66.29%> (-1.81%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

cole-miller commented 1 year ago

This should be ready to go. I removed the changes to parameter binding for multi-statement EXEC_SQL, since I couldn't figure out any approach that (1) is implementable using the sqlite3 API, and (2) doesn't have any weird footguns/corner cases. I think we should just document that multi-statement EXEC_SQL with no parameters is supported, and single-statement EXEC_SQL with parameters is supported, but multi-statement EXEC_SQL with parameters is not guaranteed to work or behave in any particular way.