|Version 2 (modified by vaibhav, 10 months ago)|
QCubed - ORM Classes
Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.
QCubed helps make sure that when you are dealing with your databases, it remains easy for you. For example, it will map all your tables as classes and the rows in the tables as the objects of those classes. So the table named 'student_info' becomes the <EM>StudentInfo?</EM> class in QCubed and a row in the table becomes an object of the StudentInfo? class. This makes programming real easy as now you are dealing with classes and their properties rather than tables and columns of rows in them. Not only this, during the code generation process, QCubed makes sure that it maps well the relations between those classes and creates functions which can be used to load data from other tables using simple functions. We will talk about that in a little more depth in another article.</p>
It will also allow you to load rows from a table with foreign key to another table without writing a single SQL Query - you are dealing with classes now after all :D If you have another table named student_login and the student_info table refers to the student_login table via a foreign key, you can do something like this:
// Student Info object $objStudentInfo = StudentInfo::Load($intStudentId); // Get the student's username from the login table $strStudentUsername = $objStudentInfo->StudentLoginObject->Username; // In the above line, we assume that the column containing the username // of the student in 'student_login' table is 'username'.
Can you try to think of some other way you can write something even more easily? I guess not. ORM Mapping also provides you an opportunity to load data from a referenced table using a single function call. To learn more, go to: http://www.thetrozone.com/qcubed-orm-classes