-
Notifications
You must be signed in to change notification settings - Fork 26
fix: impl and get affected rowcount from resp data #635
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
base: main
Are you sure you want to change the base?
Conversation
driver/src/rest_api.rs
Outdated
@@ -65,7 +65,10 @@ impl IConnection for RestAPIConnection { | |||
async fn exec(&self, sql: &str) -> Result<i64> { | |||
info!("exec: {}", sql); | |||
let page = self.client.query_all(sql).await?; | |||
Ok(page.stats.progresses.write_progress.rows as i64) | |||
|
|||
let affected_rows = page.affected_rows().map_err(Error::InvalidResponse)?; |
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.
affected_rows
and other helper functions could be located not in core
but also in this impl. Then we could take advantages of query_iter
.
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.
Maybe we can not take the advantage of query_iter
when we parse the affected rows, because we need to query_all
and use affected rows in the final page info.
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 could easily handle response in query_iter
in driver rather than query_all
in core.
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 could easily handle response in
query_iter
in driver rather thanquery_all
in core.
That sounds make sense.
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.
I mean we could make use of the value parser in driver.
c0acbcc
to
16d2dff
Compare
cfd37ba
to
5bde9a9
Compare
Get affected_rows from response data.