-
Notifications
You must be signed in to change notification settings - Fork 294
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
Add 'rawSql'. #34
Add 'rawSql'. #34
Conversation
And great cheer was heard throughout the land. Thanks Felipe, this will make a lot of people very happy :) |
Very nice! =D Note that there's one bug that I think that may be relatively easily fixable and we should go for it before releasing persistent 0.7. If one uses So I see two possible venues that may be explored for a solution: a) Somehow create placeholders for selectors. So the user may write something like
This is actually possible to be done for b) Somehow make SQL backends return the names of the columns in the result as well. Then our code would be able to re-order the column order before calling So b) is easier for our users in the sense that they don't need to learn about two different placeholder notations. However, a) should be more efficient and requires a lot less changes: namely only on code that was brought by this pull request. Note also that we could use the same placeholder Unfortunately this bug does happen in practice since I've been bitten by it myself =). What do you think? |
I have no real opinions on what's the best approach here. We could in theory be even more invasive, and automatically rewrite "Entity".* to the correct list of fields. That would likely solve the problems, though it starts to get into the area of being too smart for our own good. |
How about forcing the user to add new columns onto the end of the Entity? |
Greg, because their order also affects the order of the fields on the Haskell side, so that's a PITA. I'm leaning towards a). The only downside I see (namely having another kind of placeholder -- same symbol or not) does not outweights the benefits. OTOH, b)'s performance downside is a huge one, since I don't know off the top of my head an efficient method of doing this kind of reordering. Michael, on one hand I like your suggestion because we don't need to introduce unfamiliar placeholders. OTOH, once you get where to put |
I don't like b) as stated either until performance is first bench-marked. We are doing that in persistent-mongoDB out of necessity. Maybe it is possible (in conjunction with migration code?) to get a mapping of column order at startup time. Rails actually does this to some extent. |
I've implemented a) and sent a pull request (#35). Please take a look there and see what you think =). |
No description provided.