Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register


2
(click on this box to dismiss)

How can I resolve OID's in SQL?

I've seen that serials have an owner similar to classes, i.e. db_serial.owner seems to relate to users, just like db_class.owner. Unfortunately, db_serial.owner returns an OID, unlike db_class.owner, which shows the user name. How can I resolve that OID in a SQL statement? Or in other words, how can I join db_serial with db_user?

Note, I have seen, that the cubrid manager can do it:

http://www.cubrid.org/manual/841/en/OID%20Navigator

link comment (0) accepted answer
asked 2 years ago
lukaseder
63
7 Answers
1

Actually, the db_serial and db_user classes are already "joined". If you want to find something from db_user you can just write:

 SELECT name, owner.id as user_id, owner.name as username from db_serial;


Since the owner column in db_serial is an object, you can directly access it's members.

OID's are not directly exposed in the SQL syntax but you can use them in JDBC:

ResultSet rs = stmt.executeQuery("SELECT tbl FROM tbl"); // this gives you the OID of each row in tbl
CUBRIDOID oid = (CUBRIDOID) rs.getObject(1); 

// use the oid in another query:
PreparedStatement pstmt = connection.prepareQuery("SELECT * FROM tbl WHERE tbl = ?");
pstmt.setObject(1, oid); //this will point to the actual location on disk of the record, this will not perform a search
ResultSet rs = pstmt.executeQuery();




link comment (1)
answered 2 years ago
ginarrbrik
516
tagged




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



Internet Explorer: Mozilla Firefox: Google Chrome: