-
Notifications
You must be signed in to change notification settings - Fork 0
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
SQL Pattern Macros #19
Comments
Hmm. what is the use case? When do I need to do this? |
The original trigger for this issue was the impossibility to implement a generic When I encountered this, I also had the idea using the proposed feature to allow a serializer/type converter to reuse other serializers/type converters. For example, a The extension would also allow the user to define the patterns in a more flexible way. E.g., it would allow one to define an |
It is easy to define custom data types and serializers. What might lead to even more flexible tool are SQL pattern macros.
Let us consider a simple task: we want to implement a serializer to
IN (...)
where the type of values is inferred and serialized automatically by Ivory using the same mechanism as for auto-typed SQL placeholders (i.e., those not specifying the type, such as a mere%
). Today, this is not possible, just a serializer with a fixed type of values may be implemented.The task is to extend the type registers and type dictionaries with macros, or, alternatively, extend value serializers. Essentially, the only thing which would allow macros might be passing the type dictionary along with the serialized value.
Also, consider reuse of simple serializers (or even data types) in more complex ones. E.g., if
IValueSerializer::serializeValue()
was also given the type dictionary or anything able to interpret SQL patterns, implementing geometric types such asLineSegmentType
orCircleType
would allow for easier reuse of thePointType
. Even better, the%point
could be serialized using the possibly overridden serializer, not strictly the one shipped with Ivory. May be, this could also be applicable to arrays and other complex types, too.Still, do not extend the system with the possibility to pass multiple arguments to a single placeholder. Such flexibility could cause more harm than benefit. If something needs multiple values, just pass an array.
The text was updated successfully, but these errors were encountered: