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:
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();