10.07.2015 Views

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Implementing readSQL() and writeSQL() methods. When you create yourcustom Java class that implements SQLData, you must also implement thereadSQL() and writeSQL() methods.♦readSQL() method. You must implement readSQL() as follows:public void readSQL(SQLInput stream, String sql_type_name)throws SQLException- readSQL() must take as input an SQLInput stream and a string thatindicates the SQL type name of the data (in other words, the name ofthe <strong>Cincom</strong> ORDB class name, such as seashore).- When your Java application calls getObject(), the <strong>JDBC</strong> driver createsan SQLInput stream object (an instance of ordbObject) and populates itwith data from the database. The driver can also determine the SQLtype name of the data when it reads it from the database. When thedriver calls readSQL(), it passes in these parameters.- For each Java datatype that maps to an attribute of the <strong>Cincom</strong> ORDBobject, readSQL() must call the appropriate readXXX() method of theSQLInput stream that is passed in.- For example, if you are reading a database object that has a CHARattribute followed by an INTEGER attribute, you must have areadString() call and a readInt() call in your readSQL() method. <strong>JDBC</strong>calls these methods according to the order that the attributes appearin the schema definition of the <strong>Cincom</strong> ORDB class.- readSQL() assigns the data that the readXXX() methods read andconvert to the appropriate fields or elements of your custom Javaclass.<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 59Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Creating custom Java classes for <strong>Cincom</strong> ORDB objects

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!