Post subject: Objects in CUBRID
Post date: 2010.08.10
Hello. Please, explain about objects in CUBRID, with examples of PHP-code.
How to store objects in Database? (it is possible?)
Does database allow store methods in objects?
Can i get access to object's fields without fetching?
Is this code possible?
# Post subject:Re: Objects in CUBRID
Post date: 2010.15.08
First, it is not quite clear what do you understand by objects. Doe you mean to store PHP variable object directly to CUBRID Database? If so, no database server allows that unless you use certain ORM (Object Relational Mapping) tool.
If you intend to use CUBRID's OBJECT data type, here is a forum post ODBMS to RDBMS one of the users asked before about OBJECTs in CUBRID. Just make sure you are familiar with it as well.
Making some assumption on what you understand by objects, we are providing the answers for your questions. If you want to get more specific answers, please give us more detailed information about how you want to interact with CUBRID?
1. Yes, possible.
Also, refer to cubrid_fetch_object PHP function in the CUBRID 3.0 manuals to see an example how to fetch an object in PHP from a CUBRID database.
In CUBRID 3.0 we have introduced lots of new functions to work with OBJECTs in PHP, so make sure you have read the PHP API for CUBRID 3.0 documentation.
1. $object->title... // Maybe yes.
2. $object->update(); // No.
So, you cannot directly store php-objects in DB unless you use ORM.
And, database does not allow to store methods in objects, unless you use ORM.
Also, you cannot access to object's fields without fetching, unless you use ORM.