-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support QUERY and QUERY_SQL that modify the database #477
Conversation
80f731c
to
a51dc5e
Compare
Codecov Report
@@ Coverage Diff @@
## master #477 +/- ##
==========================================
+ Coverage 58.73% 58.85% +0.12%
==========================================
Files 33 33
Lines 5869 5916 +47
Branches 1762 1778 +16
==========================================
+ Hits 3447 3482 +35
Misses 1358 1358
- Partials 1064 1076 +12
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Cole Miller <cole.miller@canonical.com>
a51dc5e
to
d564cfd
Compare
Rebased and ready for review. |
|
||
is_readonly = (bool)sqlite3_stmt_readonly(stmt->stmt); | ||
if (is_readonly) { | ||
rv = leader__barrier(g->leader, &g->barrier, query_barrier_cb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't let it stop you (it's there in original code), but where do we send a failure
response if this call or leader__exec
in the other branch fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We end up returning nonzero from handle_query, which turns into a nonzero return from gateway__handle, which is handled here:
Lines 156 to 159 in 690818b
if (rv != 0) { | |
tracef("read gateway handle error %d", rv); | |
conn__stop(c); | |
} |
So we don't send a failure response and just close the connection instead.
Closes #471. This is based on #476, I'll rebase onto master once that merges.
As suggested by @freeekanayaka, we don't support modifying statements that also return rows (for now). Modifying statements submitted with QUERY or QUERY_SQL go through exactly the same codepath as if submitted with EXEC or EXEC_SQL, respectively, except that we send an empty ROWS response instead of a RESULT response.
Signed-off-by: Cole Miller cole.miller@canonical.com