-
Notifications
You must be signed in to change notification settings - Fork 346
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
[question/feature request] Should all contexts implement a reset()
method?
#605
Comments
I am not familiar with all the gory details of the contexts, but most likely the mock context just went out of sync with the real contexts. I remember that when I was trying to unify the APIs provided by the three connectors, I updated the actual connectors' code and the sample code in EDIT: Initially the connectors were separate (github) projects from the core sqlpp11 project, so their APIs varied quite a bit. So I guess this could be yet another reason why the APIs of the mock context and the real contexts diverged quite easily. |
Yepp, these kind of things easily happen. ;-) The question is if it should be fixed or not and how. Add |
Thanks for the discussion! I guess you will be happy to learn that the Your example would look like this:
It would just work[*]. For now, resetting the context as part of calling Cheers, [*] Unless you expressions contain parameters. |
Do you actually mean modifying the
? |
That particular implementation would yield an empty string, I think? But yes, modifying the WDYT? |
The greatness in this solution is that it surely will not contain results of previous calls. :) Yeah, without thinking I just put there this buffer reset which should be called before And just to be sure that we are talking about the same thing, I mean |
Oops, yeah, it is const. We should not change that. Otherwise we could have done something like
Please ignore my suggestion :-) |
It would feel really aggravating that I did not see your solution. :-[ But then what do we do? |
If you can cope for now, e.g. by using a new context each time you serialize something manually, I suggest we wait. |
Sure, I have a solution. It's just for the library as a whole. If you can address syncing the interfaces and mock in |
When I use the same context several times to seralize different expressions, e.g.
Then
str2
will actually be holdingstr1 + str2
.This is because the underlying stream buffer is never reset. Hence the suggestion to implement
reset()
which in turn could call_os.str("")
the same way as it is done forMockDb::_serializer_context_t
. (Side question: Why does the mock context have features that the real contexts do not?)Disclaimer: I need this way of using a serializer to dynamically build a where clause from sqlpp expressions, so when the new
dynamic()
function makes it to the main branch I will not need this any more. Nevertheless, it might not be a bad thing to add it ... at least making the real databases and the mock have the same interfaces.WDYT?
The text was updated successfully, but these errors were encountered: