Title: Oracle Object Interface
1Oracle Object Interface
Zhen Xie CERN-EP/CMC
2Object interface
- Object
- At database level, Oracle9i supports object by
object-relational mapping. - Support object identity, navigation,inheritance.
- Interface (our main concern)
- A generic interface that shields application from
SQL and other database operations. - OCCIOTT model
- Our model OCCIclass library
3Huh?Ill tell you next week. This object
includes 10 other objects and they may include
other other objects.
OCCI/OTT
OCCI
PObject (abstract )
Is a
Is a
Is a
Your data model
OTT
..
Is a
Is a
Is a
Data Base
..
Your objects here
What?! My job is to make Vincenzos object
persistent. He will kill me if I change his
original classes.
4Problems of using OTT
- Data model drives object model. But we want the
other way around. - Force changes in existing code which we cannt
afford. - Even if we could write software from scratch, we
couldnt afford to train object-oriented
programmers to be data-oriented programmers.
5Our current prototype
- Extract data model from object model using a C
compiler front-end. - Provide a template class library for common
services. - User implements a very simple wrapper class of
the transient object class.
6Our current prototype
OCCI
PObject (abstract )
Middle layer
Is a
PObjectHandle ltTgt
Generic StreamIn
Generic StreamOut
C Parser library
AST
uses
uses
uses
knows
AST-SQL interpreter
Vincenzos T.h file
Data Base
Ah! I just need to write a class T that clones
Vincenzos object T and tell the generic
Streamer what to stream
7An example
Class aPoint_C public aPoint_C (aPoint
p)clone_(p) void write(OCCIAnyData
stream) StreamInltfloat,float,floatgt st
st(stream,clone_-gtx(), clone_-gty(),
clone_-gtz()) //a similar thing for
read. Private aPoint clone_
8Conclusions
- As a database, Oracle9i supports objects
- OCCI provides C language binding and basic
services. - A middle layer missing between OCCI and
application - OTT has data-oriented applications in C in
mind, thus not suitable for our object-oriented
system. - Our prototype proves that building such a middle
layer is not mission impossible.