Created
February 18, 2013 02:53
-
-
Save bkuhns/4974866 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Course : public Model { | |
[...] | |
public: | |
Field<std::string> name; | |
Field<long> weeks; | |
public: | |
Relation<Course, HasOne, Professor> professor; | |
}; | |
int main() { | |
Course course; | |
course.where(course.professor->name == "Carvalho" && (course.weeks == 2 || course.weeks == 3)); | |
return 0; | |
} | |
/* | |
SELECT * FROM `Course` WHERE (`Professor.name` = 'Carvalho') AND ((`Course.weeks` = 2) OR (`Course.weeks` = 3)) LEFT JOIN Professor ON `Course.Professor_id` = `Professor.id` | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment