Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register


Post subject: Objects in CUBRID

registered: 05/31/2011

IP: *.102.24.12

views: 45

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?
SELECT * FROM contracts WHERE prices.price1=100
And this?

$object=cubrid_fetch($req, CUBRID_OBJECT);

And here:

$object=cubrid_fetch($req, CUBRID_OBJECT);
$object->title='New title'; // - will this string update record in database?
$object->update(); // - or this?


# Post subject:Re: Objects in CUBRID


registered: 05/31/2011

IP: *.91.137.57

Hi oz_!

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?
SELECT * FROM contracts WHERE prices.price1=100
Yes, possible

$object=cubrid_fetch($req, CUBRID_OBJECT); // Yes, possible
$object->setErrHandler($ErrHandler); // No.

1. Yes, possible.
2. No.

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.

$object=cubrid_fetch($req, CUBRID_OBJECT);
$object->title='New title'; // - will this string update record in database?
$object->update(); // - or this?

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.


You are either using a very old browser or a browser that is not supported.
In order to browse you need to have one of the following browsers:

Internet Explorer: Mozilla Firefox: Google Chrome: