Closed ivanzoid closed 10 years ago
I appreciate the request, but must decline for now.
We discussed freeform SELECTs and JOINs in issues #17 and #15. The problem, in brief, is two big assumptions in FCModel:
SELECT *
statement. The potential bugs that could result from partially-loaded model instances are exacerbated by FCModel's current unique-in-memory instance design.a + b AS total
being read into the model's @property int total
, then the value of .total
was changed and save
was called, it would try and fail to write that back to nonexistent column total
in the database.Problem 1 will be partially alleviated by FCModel's future direction in the non-unique-instances
branch, but I'd rather not take on the additional complexity and bug potential of trying to work around the other issues.
Thanks.
I think I solved my problem another way!
I created a view for my original table where I added 2 columns from other table (CREATE VIEW C AS SELECT A.*, B.foo, B.bar FROM A, B WHERE A.baz = B.baz
) and created subclass of class for original table and named it the same as view. I assume this should work (however didn't test it yet).
Useful if you want to make join with other table to apply some conditions, or if you wish to create a view of original table with additional columns (exactly my case). I was trying to find a way to do it using only public api, but, hm, didn't find.