home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / database / 8502 < prev    next >
Encoding:
Text File  |  1992-12-15  |  33.1 KB  |  842 lines

  1. Newsgroups: comp.databases
  2. Path: sparky!uunet!mcsun!inesc.inesc.pt!dec4pt.puug.pt!ul!news
  3. From: pb@fc.ul.pt (Paulo Batista)
  4. Subject: Re: Object-oriented RDBMS
  5. Message-ID: <1992Dec14.133206.21998@ul.pt>
  6. Sender: news@ul.pt
  7. Organization: Dept. Informatica - Fac. Ciencias da Universidade de Lisboa
  8. References: <1992Dec8.205346.1675@oracle.us.oracle.com>
  9. Date: Mon, 14 Dec 1992 13:32:06 GMT
  10. Lines: 830
  11.  
  12. In article <1992Dec8.205346.1675@oracle.us.oracle.com> rchiluvu@oracle.com  
  13. (Raju Chiluvuri) writes:
  14. >         I appreciate your opinion on the concept presented in
  15. >     the following document.
  16. >         I believe, It is relatively simple to incorporate the
  17. >     concept into RDBMS with the expertise available to day in the
  18. >     Object-oriented technology and I'm excited about the advantages
  19. >     I see, of the Object-oriented RDBMS.
  20. >         I welcome your valuable comments and criticism on the
  21. >     concept. Any information, If exists, on the research or products
  22. >     based on the concept is appreciated.
  23. >     Thanks In Advance,
  24. >     Raju.
  25. >     
  26. > ========================================================================
  27. >      +----------------------------------------------------+
  28. >      |  O.O.R.D.B : Object Oriented Relational Database.  |
  29. >      +----------------------------------------------------+
  30. >             --Raju Chiluvuri.
  31. >                 Home Ph # (408) 733 - 5775
  32. > ========================================================================
  33. >      Combination of the best and the most elegant concepts of both
  34. >      the Relational technology and the Object Oriented technology.
  35. > ========================================================================
  36. >     The objective of the document is to express my ideas about
  37. > the improvements we can make to RDBMS. This short document briefly
  38. > discuses the philosophy of how to incorporate object oriented
  39. > technology into RDBMS.  Although it is not required, knowledge of C++
  40. > (Object Oriented) will be help full in understanding this document.
  41. >     If the modifications discussed in this document are
  42. > incorporated in to the RDBMS, I believe RDBMS will become simple,
  43. > flexible and user friendly for users and developers of applications
  44. > and also provide very high level modular development environment
  45. > for RDBMS developers.
  46. > ========================================================================
  47. > OORDB model:
  48. > +-----------------------+
  49. > |                |
  50. > |  Application or API   |
  51. > |                |
  52. > |   +-------------------+  ----------------------------------
  53. > |   |                |  * Data Conversion & Interpretation.
  54. > |   | O.O. Interface.   |  * Object/Data Presentation.
  55. > |   |                |  * Object/Data Operations & Comparison.
  56. > |   +-------------------+  ----------------------------------
  57. > |   |                |  * Data Storage & Retrieval(Executing SQL)
  58. > |   | Data Base Engine. |  * Security & data integrity.
  59. > |   |                |  * Error recovery etc.
  60. > +---+--------+----+-----+  ----------------------------------
  61. >          |    ^
  62. >          |    |
  63. >          v    |
  64. >          .......
  65. >         +.......+
  66. >         |        |
  67. >         |  DATA |
  68. >         |Storage|
  69. >         |        |
  70. >         |.......|
  71. >         +.......+
  72. > ========================================================================
  73. >     The database should be divided logically(not physically) in
  74. > to two layers.
  75. >     (1).    The data base engine layer and 
  76. >     (2).    The object oriented(OORDB) interface layer.
  77. > --------------------------------------------------------------------
  78. >     In current RDBMS, all the objects data representation and
  79. > operation procedures are all hard coded in to the RDBMS. The RDBMS
  80. > is not providing any method for the application developer to define
  81. > abstract data objects. Adding this capability with out effecting
  82. > any transaction processing, data accessing(object schemas) power of
  83. > RDBMS (relational model), is the function of the Object Oriented
  84. > Interface.
  85. >     The SQL statements are executed/interpreted by the data
  86. > base engine. The SQL statements are divided in to four types.
  87. > Queries:
  88. >     Ex: SELECT ENAME, MGR
  89. >         FROM EMP
  90. >         WHERE    (MGR = 234) or (MGR = 123);
  91. >     To process Queries RDBMS needs procedure to compare objects.
  92. > The developer of the object should provide the procedures(Pointers
  93. > to functions and expected parameter format description) that performs
  94. > defined search operations.
  95. > Data Manipulation Statements:
  96. >     Ex: INSERT, UPDATE, DELETE etc.
  97. >         INSERT INTO emp
  98. >             VALUES(2, 'GORE', 'VICE-PRESIDENT',
  99. >                 1, '20-JAN-93',1000,500,10);
  100. >     DELETE FROM emp WHERE name IN ('BUSH', 'QUYLE');
  101. >     To process the SQL statements, RDBMS requires procedures to
  102. > validate(parse/check) the external object data (given in external
  103. > format) and convert to internal representation of the object.
  104. > Ex: If the object is date and given as a string "20-JAN-93".  The
  105. >     RDBMS needs a function that converts this to internal data
  106. >     representation format.
  107. >     
  108. > Data Definition Statements:
  109. > Data Control Statements:
  110. >     CREATE TABLE emp
  111. >         (    empno        NUMBER NOT NULL,
  112. >         job        CHAR(10),
  113. >         mgr        NUMBER(5),
  114. >         hiredate    DATE,
  115. >         sal        NUMBER(9,2),
  116. >         comm        NUMBER(9,2),
  117. >         deptno        NUMBER(5)    )
  118. >     To build a table with objects RDBMS needs the size of fields
  119. > and object type of fields and its properties.
  120. >     If developer provides all the information RDBMS required to
  121. > execute SQL statements for new objects, There is no reson RDBMS can
  122. > not support the new object just like any build in data types.
  123. >     The Object Oriented Interface should provide simple method
  124. > to define new objects for developers. He should provide all the 
  125. > required information for RDBMS to process the new objects just like
  126. > any other build in object types.
  127. > --------------------------------------------------------------------
  128. >     The RDBMS should provide the application developer the
  129. > capability of defining new object and how an object physically
  130. > represented in it's field.  In addition the developer should be
  131. > able to define what kind of operations are allowed on the new
  132. > object and the procedure how the operations should be performed.
  133. >     To achieve this goal the RDBMS should be modified, so that,
  134. > it recognizes new objects and it should use the information provided
  135. > for the object to perform any requested operations on the object.
  136. > That is, If RDBMS need to perform an operation on the new object, it
  137. > should use the information provided for the object to determine that
  138. > the operation is allowed and use it to perform the operation.
  139. >     The physical data in a DB field is nothing but a description
  140. > (or representation) of an object. The developer conceptualizes the
  141. > relationship between the object and physical data representation of
  142. > the object. He should have knowledge of properties and behavior of
  143. > the object to define the object specific operations and the procedure
  144. > how the operations should be carried out on the physical data.
  145. >     To make RDBMS developer life easy, In early phases of OORDB:
  146. > (1). It can have some restrictions like the user defined objects can
  147. >      not be used to create indexes.
  148. > (2). The RDBMS can keep the build in data types as it is.
  149. >     
  150. > --------------------------------------------------------------------
  151. > Note:    For an example look at the section titled "The scenario of
  152. >     how OORDBMS works".
  153. > ========================================================================
  154. > The Data Base Engine:
  155. > ---------------------
  156. >     The field or column data type of the data base table can be
  157. > divided in to two categories.
  158. > 1). fixed size types (Ex: "DATETYPE", "INTEGER" etc. whose size is
  159. >     predefined and fixed always.) and
  160. > 2). The variable size types.
  161. >     Data base engine should need the following information to do its
  162. > job, for every data/object type defined as a column in the data base.
  163. > 1). If the type is fixed size, the size in bytes.
  164. > 2). If the type is not fixed  size, maximum allowed size in bytes.
  165. > 3). If "=" (equals to) operation is allowed on the object, It needs
  166. >     a pointer to a function that takes two objects as parameters and
  167. >     returns 1 or 0 to indicate True or False.
  168. >     Note: Most of the cases bit/byte wise comparison is enough. But
  169. >     for some objects user may use some equality rules.
  170. > 4). If "<","==" and ">" operations are allowed on the type, It needs
  171. >     a pointer to a function that returns positive, zero and negative 
  172. >     values respectively.
  173. > 5). If user defined operations like "LIKE" are allowed on the type
  174. >     (with or with out wild cord like %), It needs a pointer to a
  175. >     function that performs the operation and returns the result etc.
  176. >     Notice this information is enough for each object used in
  177. > database table field(column) for database engine to perform search,
  178. > store and retrieval operations.
  179. >     When user defining a new object type, He should provide all
  180. > the required procedures code to process all the necessary operations
  181. > on the object and link into the OORDBMS.
  182. >     The Object-oriented interface should provide the RDBMS, a
  183. > list of the user defined objects for the application and for each
  184. > of the object all the information required by the RDBMS.
  185. > Example:
  186. >     For each new object defined in Object-oriented interface, it
  187. > builds a structure with the following data and pass it to RDBMS.
  188. > typedef struct
  189. >     {
  190. >      short type_code;         /* A code assigned to the type.*/
  191. >      char  type_name[16];   /* The name of the type. */
  192. >      short size;         /* -1; If type is not of fixed size. */
  193. >      int   (*is_same_func)();  /* NULL; If "==" is not allowed. */
  194. >      int   (*compare_func)();  /* NULL; If comparison not allowed.*/
  195. >      operation_info operation_abc; /* Look below. */
  196. >     :    :    :    :    
  197. >     :    :    :    :    
  198. >     :    :    :    :    
  199. >     }type_data_handlers;
  200. > typedef struct
  201. >     {
  202. >     char operation_name[16]; /* Operation name. Ex: LIKE. */
  203. >     short operation_type;    /* This may be used to categorize
  204. >         the operation to determine how the operation should
  205. >         be performed. Ex: Unary, Binary etc. */
  206. >     int (*operation_procedure)(); /* A pointer to the function,
  207. >                 which performs the operation. */
  208. >     short result_type;
  209. >     short parameter1_type;
  210. >     short parameter2_type;
  211. >     :    :    :    :    
  212. >     :    :    :    :    
  213. >     } operation_info;
  214. > The database engine saves the list of the type/object structures and
  215. > uses the information and handlers in them, to process SQL statements.
  216. > Note: The external data is converted by OORDB interface into internal
  217. >       data representation format for storage in the object field and
  218. >       internal data is converted by OORDB interface to external data
  219. >       format for presentation.
  220. > The Object Oriented Interface:
  221. > ------------------------------
  222. >     The object oriented interface should provide simple method
  223. > for the developer to define new objects. It should also enforce the
  224. > completeness and consistence of the object information provide by
  225. > the developer.
  226. >     The Object Oriented Interface provides all the required
  227. > information (the object data representation and the operation
  228. > procedures) about the object to the data base engine and also
  229. > performs some operations on objects on the requests of user or data
  230. > base engine.
  231. > Note:    Most of the object operation procedures are executed at the
  232. >     Data Base engine level.
  233. > * Data Interpretation & Conversion.
  234. >     If data is received from externally, It interprets the data
  235. >     and converts in to internal format to store in Database table.
  236. >     Note: The data in column fields are a representation of an object
  237. >     like DATE. When user assigning a value "6-SEP-88" to a date 
  238. >     field, The SQL reads the ascii string and converts into
  239. >     internal representation of the date and stores in the field.
  240. > * Object/Data Presentation.
  241. >     If data is obtained from the data base table, it converts
  242. >     into proper format for presentation.
  243. >     Note: To display a field, the database reads the internal data
  244. >     and converts into a string for presentations(in ascii mode).
  245. >     The presentation procedure is dependent on the object type.
  246. >     (It also dependent on user request, because same object can
  247. >     be presented in several ways.)
  248. > * Object/Data Operations & Conversion.
  249. >     It provides object operation functions like add, multiply and
  250. >     subtraction etc.. It also provides type conversion functions, If
  251. >     type conversion is allowed.
  252. > ========================================================================
  253. > AN EXAMPLE AND STARTING POINT:
  254. >     The architecture of the X11 server, the X11 library, the Xt
  255. > library and the Motif objects. Although this is not very good match
  256. > to our needs the work done in the following sections could help us
  257. > in pointing the right direction.
  258. > 1. The Xt library services to build graphical objects on top of raw
  259. >    primitive X11 library.
  260. > ========================================================================
  261. > OBJECT examples:
  262. >     consider an object "pie" chart. The data representation of a
  263. > income of a department in a company.
  264. > typedef struct
  265. >     { 
  266. >         int total_income; 
  267. >         int sales_share;
  268. >         int services_share;
  269. >         int consultancy_share;
  270. >     } income_pie_chart;
  271. >      In this case RDBMS engine needs 4*4 bytes fixed size storage
  272. > to store the data. The data is interpreted and presented by Object
  273. > Oriented interface. The presentation function draws the proper pie
  274. > chart object using data in the column.
  275. > Note: User can also implement operation "+" in the interface. This
  276. >       can be used to find the total pie chart of all departments.
  277. >       User can also define "/" operation to find average income pie
  278. >       of departments. These operations may take different objects
  279. >       and return new object, The Object-oriented interface should
  280. >       provide the information to RDBMS to process SQL.
  281. >     consider an other object "pie" chart. The data representation
  282. > of an expenditure of a department in a company. This is more general
  283. > "pie" chart with variable number of components.
  284. > typedef struct
  285. >     { 
  286. >         int    expenditure_item_count; 
  287. >         int    total_expenditure; 
  288. >         char    expenditure_title1[16];
  289. >         int    expenditure1;
  290. >         char    expenditure_title2[16];
  291. >         int    expenditure2;
  292. >         char    expenditure_title3[16];
  293. >         int    expenditure3;
  294. >         :    :    :
  295. >         :    :    :
  296. >         :    :    :
  297. >         :    :    :
  298. >     } income_pie_chart;
  299. >      In this case RDBMS engine needs variable size storage to
  300. > store the data. The size is calculated by Object Oriented Interface
  301. > using the value of "expenditure_item_count". The data is interpreted
  302. > and presented by Object Oriented interface.
  303. >     One object can have several presentation functions. The DBMS
  304. > uses proper presentation function depending on presentation control
  305. > parameter(s). Also object can have several operation procedures for
  306. > same operation(like operator overloading in C++). The DBMS uses
  307. > proper procedure depending on operands.
  308. > ========================================================================
  309. > (1).    OORDB:  This logical separation provides a solid simple
  310. >     flexible base and direction for engineers and VARs to
  311. >     develop next generation OORDBMS tools, utilities and
  312. >     applications that better suite customers real world needs.
  313. > (2).    Objects are building blocks of more complex applications.
  314. >     Well designed and implemented objects(the abstract nature
  315. >     of object) will provide reliable high level design and
  316. >     building blocks for more complex tools and applications.
  317. > (3).    RDBMS should provide a rich commonly used set of objects as
  318. >     part of the base RDBMS product. RDBMS also should provide a
  319. >     simple method for developers to define their objects and
  320. >     test the objects off line and integrate them in to RDBMS.
  321. >     (Note: These are the application specific objects defined by
  322. >     developers to use as building blocks in their applications.
  323. >     For example, in an Biological application an animal can be
  324. >     defined as an object and could support several operations
  325. >     to search or group them using common properties.)
  326. > (4).    This provides modular development for OORDBMS developers.
  327. >     That is, it allows the 2 layers can be modified and upgraded
  328. >     independently, as long as their interface is consistent.
  329. > ======================================================================
  330. > User Defined Operations:
  331. > ------------------------
  332. >     This document is not intended to provide specific details
  333. > of OORDBMS, but to explain briefly the general theory we can use
  334. > in implementing OORDBMS (with examples).  This resulted in some
  335. > inconsistences.
  336. >     For new object depending on the nature of the object the 
  337. > developer provides several operations and procedures.
  338. > Example:
  339. >     Consider a simple Text Retrieval system. The Text field of a
  340. > column in data base is defined as user defined object type "DOCUMENT"
  341. > of variable size up to "65,535(LONG)". This object supports an user
  342. > defined operation "LOOK_FOR_KEYS".
  343. > User can execute the following SQL statement for the following table.
  344. > SQL> DESC  DOCUMENT_TABLE
  345. >     -------------------     ---------------------
  346. >     Field Name        Type
  347. >     -------------------     ---------------------
  348. >     DOC_NUM            NUMBER
  349. >     WRITER_NAME        CHAR(32)
  350. >     DOC_DATE        DATE
  351. >     DOC_TITLE        CHAR(255)
  352. >     DOC_CONTENTS        DOCUMENT     /* User defined Obj.*/
  353. > SQL>
  354. > SQL> SELECT writer_name, doc_data, doc_title
  355. >     FROM document_table
  356. >     WHERE (writer_name LIKE '%RAJU%') and
  357. >         (doc_date > (SYSDATE - 30)) and
  358. >         (DOC_CONTENTS %LOOK_FOR_KEYS ('URGENT' or 'IMPORTANT'));
  359. > SQL>
  360. >     Note the symbol "%" is directive to the SQL/DBMS to indicate
  361. > that the following string is an user defined operation. (This % may
  362. > be optional to simplify the implementation of SQL extension). RDBMS
  363. > calls the proper handler function for "LOOK_FOR_KEYS" operation with
  364. > the information "('URGENT' or 'IMPORTANT')". The function parses the
  365. > data, stores the search information and performs the search.
  366. >     User defined object names and user defined operation names on
  367. > the object are incorporated in to SQL. The Object-oriented interface
  368. > provides all this information. A method how it can be done is briefly
  369. > discussed in the section titled "The scenario of how OORDBMS works".
  370. > Note:    In C++ the object should be defined before using the object
  371. >     or object operations in a source file. The compiler uses this
  372. >     information in object definition to compile the statements,
  373. >     which contains the object operations. In OORDBMS the object
  374. >     information is provided in advance to Object interface and SQL
  375. >     interpreter uses this information when executing SQL statements.
  376. > Note::    It is good practice to assign priority to search operations.
  377. >     In the above example obviously the "%LOOK_FOR_KEYS" is very
  378. >     slow. So it should be assigned lowest priority, so that DBMS
  379. >     can perform this operation last, if the ROW already satisfied
  380. >     "(writer_name LIKE '%RAJU') and (doc_date > (SYSDATE-30))".
  381. > ======================================================================
  382. > Object Information ::
  383. >     The well defined objects are the objects modeled ofter real
  384. > life objects with real life operations. Objects should be easy to
  385. > understand and use.
  386. >     To use any object in SQL statements, The User needs full
  387. > description of the object. This includes size, operations allowed to
  388. > perform on the object and the presentation methods.  It is also help
  389. > full, If some convenience functions are provided for the object for
  390. > commonly performed procedures.
  391. > --------------------------------------------------------------------
  392. > Example I:
  393. >     The following is a sample example DESCRIPTION for the object
  394. >     "DOCUMENT".
  395. > Type Name:    DOCUMENT
  396. > Size     :    Variable Size. Maximum Limit is 65,535 bytes.
  397. >     
  398. > Operations:
  399. >     JOIN:
  400. >         doc1 JOIN doc2: The contents of doc2 is added to the
  401. >         end of doc1.
  402. > Comparison Operations:
  403. >     LOOK_FOR_KEYS
  404. >         %LOOK_FOR_KEYS ('KEY1' or 'KEY2' ....)
  405. >     THESAURAL_RELATION
  406. >         %THESAURAL_RELATION ('WORD1' or 'WORD2' ....)
  407. >     WORD_PROXIMITY
  408. >         %WORD_PROXIMITY ('WORD1' ....)
  409. >     PHRASE_SEARCH
  410. >         %PHRASE_SEARCH .............
  411. >     SYNONYM_SEARCH
  412. >         ............................
  413. > Convenience Routines:
  414. >     document_top(doc):    This function just gets only the
  415. >                 first paragraph of the document.
  416. >     document_page(doc,page_no): This function just gets only
  417. >             one page of data given in "page_no".
  418. >     print_document(doc,file): This function prints the document
  419. >                 to the file given in "file".
  420. >         :    :    :    :    :
  421. >         :    :    :    :    :
  422. > Presentation Control:
  423. >         None.
  424. > Restrictions And Limitations:
  425. >         :    :    :    :    :
  426. >         :    :    :    :    :
  427. > --------------------------------------------------------------------
  428. > Example II:
  429. >     The following is a sample example DESCRIPTION for the object
  430. >     "SCIENTIFIC_TIME".
  431. > Type Name:    SCIENTIFIC_TIME
  432. > Size     :    8 bytes.
  433. >     typedef struct
  434. >       {
  435. >     int    seconds;    /* Maximum 2,000,000,000 */
  436. >     int    neno_seconds;    /* Maximum 999,999,999. */
  437. >       }scientific_time;
  438. >     
  439. > Operations:
  440. >     +, -, *, /,=:
  441. > Comparison Operations:
  442. >     ==, <=, >=, != .....
  443. > Convenience Routines:
  444. >         :    :    :    :    :
  445. >         :    :    :    :    :
  446. > Presentation Control:
  447. >     print_time(time,format): This function prints the time in
  448. >                 the given format.
  449. >     update_display(time,display): This function updates the
  450. >                 given graphical display object.
  451. >     If no presentation format is given, It prints the time
  452. >     using default print function provided for the object.
  453. > --------------------------------------------------------------------
  454. > Example III:
  455. >     The following is a sample example DESCRIPTION for the object
  456. >     "TELEPHONE_NO".
  457. > Type Name:    TELEPHONE_NO
  458. > Size     :    6 bytes.
  459. >     typedef struct
  460. >       {
  461. >     short    area_code;    /* Maximum 999. */
  462. >     short    middle_code;    /* Maximum 999. */
  463. >     short    last_num;    /* Maximum 9999. */
  464. >       }telephone_no;
  465. >     
  466. > Operations:
  467. >     None
  468. > Comparison Operations:
  469. >     == .....
  470. >     %AREA_CODE_IN (NUM1,NUM2,..)
  471. >     %MIDDLE_CODE_IN (NUM1,NUM2,..)
  472. > Convenience Routines:
  473. >         :    :    :    :    :
  474. >         :    :    :    :    :
  475. > Presentation Control:
  476. >     print_phone_nu(ph_no,format): This function prints the phone
  477. >                 number in the given format.
  478. >     If no presentation format is given, It prints the time using
  479. >     default print function provided for the object.
  480. > --------------------------------------------------------------------
  481. > Note: The syntax of the SQL is upto the choice of OORDBMS designer.
  482. >     SELECT * FROM emp WHERE area_code_of(ph_no) IN (408, 415);
  483. >     (or) SELECT * FROM emp WHERE ph_no %ARE_CODE_IN (408,415); 
  484. >     I choose the later one in this document examples.
  485. > --------------------------------------------------------------------
  486. >     The user defined searching operations like AREA_CODE_IN or
  487. > LOOK_FOR_KEYS is extremely powerful, yet simple.
  488. > i.  User can define simple but flexible searching operations and can
  489. >     add new searching operations as needs arise with out changing any
  490. >     structure of DATABASE physical object data.
  491. >     (Ex:These searching operations can be used to access the objects
  492. >     on the bases of some common property like two legged animals
  493. >     from animal description object data field or phone numbers
  494. >     from same area code etc..)
  495. > ii. The object structure design helps in packing less used several
  496. >     fields(columns) in to one field, results in saving access time
  497. >     and disk storage space.
  498. >     Ex: Database table designer can define a column "ADDRESS" of a
  499. >     customer as a object(field) instead of several fields like
  500. >     STREET, CITY, STATE and ZIP and still have the flexibility
  501. >     of performing searches on ZIP, STATE and/or CITY.
  502. >     (Note:    An extreme case!. For the sake of discussion(fun).
  503. >     Combine all the columns of a table in to 1 column(object).
  504. >     Then Provide a rich set of searching operations.
  505. >     ... Is this still a relational model?.)
  506. > iii.These searching operations are executed at RDBMS kernel level and
  507. >     application developer can implement fastest algorithm that meet
  508. >     his requitements.
  509. >     
  510. > ======================================================================
  511. > The scenario of how OORDBMS works:
  512. >     This following is not inteded as specification but to give
  513. > some details to help understand more.
  514. > Note:    I believe this document is not easy to understand. So I
  515. > am trying my best to give simple examples to explain as much as
  516. > I can.
  517. > --------------------------------------------------------------------
  518. > Implementation Part:
  519. > --------------------------------------------------------------------
  520. >     The OORDBMS vender provides a template "*.c" file to define
  521. > new object for application developers. It contains a struct of the
  522. > form given below.
  523. > typedef struct
  524. >     {
  525. >     char        obj_name[16];
  526. >     short        obj_code;
  527. >     short        obj_max_size;
  528. >     short        is_fixed_size;
  529. >     int        (*equal_op_func)();
  530. >     int        (*comp_op_func)();
  531. >     operations    *ops_list;
  532. >     short        ops_list_size;
  533. >     user_operations    *user_ops_list;
  534. >     short        user_ops_list_size;
  535. >     int        (*default_presentation_function)();
  536. >         :    :    :
  537. >         :    :    :
  538. >     }object_struct;
  539. > Where::
  540. >     typedef struct
  541. >         {
  542. >         char    operation[16];
  543. >         short    parameter_count;     /* Binary or unary */
  544. >         char    parameter1_name[16];
  545. >         short    obj_parameter1_code;
  546. >         char    parameter2_name[16];
  547. >         short    obj_parameter2_code;
  548. >         int    (*function_ptr)();
  549. >         char    return_obj_name[16];
  550. >         short    return_obj_code;
  551. >         }operations;
  552. >     typedef struct
  553. >         {
  554. >         char    operation[16];
  555. >         short    parameter_count;     /* Binary or unary */
  556. >         char    parameter1_name[16];
  557. >         short    obj_parameter1_code;
  558. >         char    parameter2_name[16];
  559. >         short    obj_parameter2_code;
  560. >         int    (*function_ptr)();
  561. >         char    return_obj_name[16];
  562. >         short    return_obj_code;
  563. >         }user_operations;
  564. > object_struct fields:
  565. > ---------------------
  566. > obj_name:: The maximum size is 15 char. This name is given to the
  567. >     object and used in SQL statements when creating tables using
  568. >     this object.
  569. >     Note::    This name is used as any other type like DATE or
  570. >         NUMBER. All the information SQL interpreter needs
  571. >         to do its job is provided in the "object_struct".
  572. > obj_code:: This code is not initialized by the user, and no interest
  573. >     to the user. This is the assigned code number to the object
  574. >     by the RDBMS and internally used by RDBMS.
  575. > is_fixed_size:: If this object data is fixed size set to 1 else 0.
  576. > obj_max_size::  The maximum data size required to store the object.
  577. > (*equal_op_func)():: This function takes 2 object's data as formal
  578. >     parameters and returns ZERO if both are equal, else ONE.
  579. > (*comp_op_func)()::  This function takes two objects data as formal
  580. >     parameters and returns 1, 0 or -1 depending on 1st object
  581. >     is greater, equal or less than the 2nd object respectively.
  582. > *ops_list:: This is the list of structs which contains information
  583. >     to perform operations.
  584. > ops_list_size:: The size of the above list.
  585. >         :    :    :    :
  586. >         :    :    :    :
  587. > user_operations fields:
  588. > -----------------------
  589. > operation:: The maximum size is 15 char. This name is given to the
  590. >     operation and used in SQL statements to perform searching
  591. >     or other operation on the object.
  592. >     Note::    The SQL interpreter calls the proper function with
  593. >         the parameter data depending on the operation name
  594. >         and the parameters, which performs the requested
  595. >         operation and returns the result of the operation.
  596. >         The SQL has all the information it needs to execute
  597. >         the operation in the structure "user_operations".
  598. >         :    :    :    :
  599. >         :    :    :    :
  600. >     The object developer initializes the structure with proper
  601. > data and sets the function pointers with developer implemented
  602. > specific object operation handler functions. (Developer tests his
  603. > object function off line before compiling in to RDBMS).
  604. >     When RDBMS starts running during initialization time it
  605. > builds internal structures which contains full object information
  606. > for all the known Objects and assigns them object codes. The RDBMS
  607. > during execution uses the information in these structures to process
  608. > SQL and PL/SQL statements. 
  609. > Note:    The object information includes the object name string and
  610. >     user defined object search operation name string and uses 
  611. >     these name strings in processing/parsing SQL statements.
  612. > Note:    All the object operation functions are very simple and can
  613. >     be tested completely off line with out any knowledge or help
  614. >     from RDBMS. This ensures high quality and modularity for
  615. >     object and application development.
  616. > --------------------------------------------------------------------
  617. > Using The Object:
  618. > -----------------
  619. >     The implementer of the object provides a description of
  620. > the object to user of the object. The example given above for the
  621. > object "DOCUMENT" is a simple example. This information for
  622. > most of the objects will be less than a page and easy to use.
  623. > --------------------------------------------------------------------
  624. > Using The Object From 3GL language("c") in client/server environment:
  625. > --------------------------------------------------------------------
  626. >     For every object the developer provides a "*.h" file and
  627. > a set of conversion functions to link with client application.
  628. > Note: These functions may be part of Object Oriented Interface.
  629. > Converting Internal data to External data:
  630. > ------------------------------------------
  631. > Consider an object "ADDRESS"
  632. > typedef struct
  633. >     {
  634. >     char    street[32];
  635. >     char    city[16];
  636. >     short    state;    /* 1-50 code numbers of states*/
  637. >     int    zip;
  638. >     } address;
  639. >     This information could be stored in DBAS file in 54 bytes.
  640. > (32 + 16 + 2 + 4 = 54). 
  641. >     To present this information to the application developer
  642. > in SUN/SPARC the data should be properly aligned on "4" byte
  643. > boundary (in this case). This could be done by the presentation
  644. > layer of the Object Oriented part.
  645. >     The presentation part is responsible for data conversion to
  646. > the client environment. This may be achieved by providing a "objx.h"
  647. > file and providing presentation function for the client environment.
  648. > example:
  649. > int present_postal_address(client, client_ptr, db_buf_ptr)
  650. > int    client;        /* The client code. */
  651. > address    *client_ptr;    /* the client data structure. */
  652. > char    *db_buf_ptr;    /* The data base object data ptr. */
  653. > {
  654. >     :    :    :
  655. >     switch(client)
  656. >     {
  657. >     case SUN_SPARC:
  658. >         memcpy((client_ptr->street),db_buf_ptr, 32);
  659. >         memcpy((client_ptr->city),&db_buf_ptr[32], 16);
  660. >         memcpy(&(client_ptr->state),&db_buf_ptr[48], 2);
  661. >         memcpy(&(client_ptr->zip),&db_buf_ptr[50], 4);
  662. >         /* Assuming Sun don't need Byte Swap. */
  663. >         break;
  664. >     case VAX_VMS:
  665. >         :    :    :
  666. >     }
  667. > }
  668. > address *add_ptr;
  669. >         :    :    :
  670. >     add_ptr = (address *) malloc(sizeof(address));
  671. >     SELECT emp_add INTO :add_ptr WHERE emp_num = 1234; 
  672. > --------------------------------------------------------------------
  673. > Converting external object data in to internal data:
  674. >     Developer provides several functions, precompiler uses proper
  675. > function to convert external data to DB internal data.
  676. >         EXAMPLES
  677. > Way 1:
  678. >     UPDATE emp
  679. >         SET ph_num = '408-555-1212'
  680. >         WHERE    ename = 'BUSH';
  681. >         In this way, If developer provides character string
  682. >     initialization procedure for the object call the procedure
  683. >     to convert the external data in to internal data.
  684. >     Note: If we want to make the precompiler happy, use:
  685. >         UPDATE emp
  686. >             SET ph_num = string_to_internal('408-555-1212')
  687. >             WHERE    ename = 'BUSH';
  688. > Way 2:
  689. >     short    last_num = 1212;    /* Host variable. */
  690. >     UPDATE emp
  691. >         SET ph_num = {408, 555, :last_num}
  692. >         WHERE    ename = 'BUSH';
  693. >         In this way, If developer provides a procedure to set
  694. >     each individual basic(char, string,int,float) types, call
  695. >     the corresponding function to set the data to the object.
  696. >     Note: If we want to make the precompiler happy, use:
  697. >         UPDATE emp
  698. >            SET ph_num = struct_to_internal(408,555,:last_num)
  699. >            WHERE    ename = 'BUSH';
  700. > Way 3:
  701. >     typedef struct
  702. >       {
  703. >     short    area_code;    /* Maximum 999. */
  704. >     short    middle_code;    /* Maximum 999. */
  705. >     short    last_num;    /* Maximum 9999. */
  706. >       }telephone_no;
  707. > telephone_no phone_no = {408, 555, 1212}; /*Declaring a variable.*/
  708. >     UPDATE emp
  709. >         SET ph_num = :phone_no
  710. >         WHERE    ename = 'BUSH';
  711. >         Use the conversion procedure to convert from host
  712. >     environment to data base internal format.
  713. > --------------------------------------------------------------------
  714. >     To automate the object development process, The OORDB can
  715. > provide a set of core object templates. Implementing most of the
  716. > objects can be as easy as implementing an object in "C"/"C++" and
  717. > filling the blanchs in appropriate core object template file.
  718. > ======================================================================
  719. > OORDBMS adds one more dimension of flexibility to RDBMS(3D-DBMS?).
  720. >     --    Each object may contain several pieces of information and
  721. >     several operations can be supported(defined) on the object.
  722. > Ease of Migration.
  723. >     --    The OORDBMS two layer approach provides easy migration 
  724. >     path for RDBMS and provides good back ward compatibility.
  725. >     Existing Objects can be supported as pre defined objects.
  726. > ======================================================================
  727. >     I believe the object-oriented concepts I discussed in the
  728. > document are already used in various fields and it is time that, the
  729. > RDBMS should make use of the existing object-oriented technology.
  730. >     Although, I have no experience in evolving Object-oriented
  731. > data bases, I believe the OORDBMS provides good balance of both the
  732. > relational(RDB) and the Object-oriented(OODB) models.
  733. > ======================================================================
  734. >         < End Of The Document >
  735. >                     --Raju Chiluvuri.
  736. > ======================================================================
  737.