Skip to content
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

Prevent SetProduct from being used for a tuple #3

Merged
merged 3 commits into from Jul 16, 2016
Merged

Conversation

tarao
Copy link
Owner

@tarao tarao commented Jul 16, 2016

SetProduct finally uses slick.jdbc.SetParameter.SetSimpleProduct to set product elements. SetSimpleProduct handles only a few primitive types, which are determined at run time. There is no room to make SetSimpleProduct to handle a user-defined type.

In contrast, tuples are handled by slick.jdbc.SetParameter.createTupleN, in which case the element types of a tuple are subject to searching implicit SetParameters at compile time. This gives us a chance to inject our custom SetParameter implicits for element types of tuples.

The problem was that createSetProduct had accidentally shadowed implicits of createTupleN. This pull request fixes the problem by excluding tuples from targets of createSetProduct.

`SetProduct` finally uses `slick.jdbc.SetParameter.SetSimpleProduct`
to set the product elements.  `SetSimpleProduct` handles only a
few primitive types, which are determined at run time.  There is
no room to make `SetSimpleProduct` to handle a user-defined type.

In contrast, tuples are handled by `slick.jdbc.SetParameter.createTupleN`,
in which case the element types of a tuple are subject to searching
implicit `SetParameter`s at compile time.  This gives us a chance
to inject our custom `SetParameter` implicits for element types of
tuples.

The problem was that `createSetProduct` had accidentally shadowed
implicits of `createTupleN`.  This commit fixes the problem by
excluding tuples from targets of `createSetProduct`.
@coveralls
Copy link

Coverage Status

Coverage decreased (-10.2%) to 78.235% when pulling 4ad31b7 on nontuple-products into 8b07202 on master.

@coveralls
Copy link

coveralls commented Jul 16, 2016

Coverage Status

Coverage increased (+2.9%) to 91.304% when pulling d42a47e on nontuple-products into 8b07202 on master.

@tarao tarao merged commit fa8af5d into master Jul 16, 2016
@tarao tarao deleted the nontuple-products branch July 16, 2016 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants