-
Notifications
You must be signed in to change notification settings - Fork 478
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
Allow passing rvalues to soci::use() #1102
base: master
Are you sure you want to change the base?
Conversation
CI env problem:
|
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.
Sorry, I don't have time to really review the new code, but it seems clear that at least some comments explaining what it does would be helpful. Could you please try to add them?
TIA!
@@ -180,39 +180,68 @@ struct basic_table_creator : public table_creator_base | |||
} | |||
}; | |||
|
|||
TEST_CASE("Oracle nested statement", "[oracle][blob]") | |||
TEST_CASE("Oracle nested statement", "[oracle][cursors]") |
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.
Is the change to this test case really related to the main topic of the PR?
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.
No, this addition is an "incidental correction" )))
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.
Can we leave it out and/or at least extract it into a separate commit (but a separate PR might be even better)?
AppVeyor probably updated their MySQL version... Also not sure why did we suddenly start getting deprecation warnings in the GitHub CI builds. This is clearly unrelated to this PR, of course. |
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'm sorry but I'm still unable to understand how does this code work. Maybe it seems obvious to you even without any comments, but this is not at all the case for me. Please consider adding some comments (and updating existing ones which are out of date now) to help me -- and the other people reading this code -- understand it.
TIA!
@@ -180,39 +180,68 @@ struct basic_table_creator : public table_creator_base | |||
} | |||
}; | |||
|
|||
TEST_CASE("Oracle nested statement", "[oracle][blob]") | |||
TEST_CASE("Oracle nested statement", "[oracle][cursors]") |
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.
Can we leave it out and/or at least extract it into a separate commit (but a separate PR might be even better)?
@@ -48,10 +48,16 @@ struct use_container<T, no_indicator> | |||
|
|||
// soci::use is deleted for rvalues because it will likely lead to subtle stack-use-after-scope bugs. |
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.
This comment is not true any more and really should be updated, it's just too confusing otherwise.
template <typename T> | ||
class by_value_conversion_use_type : value_holder<T>, public conversion_use_type<T> |
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.
It would be really great to have at least some explanation about what this class is used for.
It is a useful when we can write soci::use( 3 ) or soci::use (string_holder("once used string"))
So, for rvalue case we have to use a specific type of use_container. And the overload of the exchange() and do_use() functions. As a result we have a "use_type" object of new derived class "by_value_use_type" (or "by_value_conversion_use_type"), which contains the copy of the rvalue