ChemOffice.Com - CambridgeSoft
ChemOffice.Com - CambridgeSoft
ChemOffice.Com - CambridgeSoft
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
act accordingly. A full list of the tables and fields<br />
maintained by the cartridge can be found in the<br />
heading Data Structures.<br />
The AUX package of the cartridge can be used to<br />
avoid compatibility problems with later versions.<br />
The AUX package contains trivial functions, which<br />
return the names of the tables and fields to be used<br />
to access the tables in the cartridge schema. With<br />
this extra care, future incompatibility can be<br />
avoided. The functions in that package will be<br />
explained later in the chapter. Generally, using these<br />
functions is more complicated than using operators<br />
returning the same value.<br />
The best way to use data stored by the cartridge is<br />
to create synonyms for the tables stored in the<br />
CsCartridge schema.<br />
CREATE SYNONYM MyWeight FOR<br />
CsCartridge.sch_ix_W; for accessing<br />
molecular weight<br />
CREATE SYNONYM MyCode FOR<br />
CsCartridge.sch_ix_A; for accessing<br />
formula and canonical code<br />
This way, the fields of MyMol and MyCode tables<br />
can be used simply as if they were defined in the<br />
user's schema. Both of these tables have a field<br />
called RID. It contains the ROWID of the original<br />
table. The original table and the table maintained by<br />
the cartridge can be joined by an inner join by an<br />
original_table.ROWID = MyCode.rid condition in<br />
the WHERE clause. When the tables are joined, the<br />
data fields maintained can be used. Among them<br />
are:<br />
• MyMol.MolWeight which stores the molecular<br />
weight of the structure.<br />
• MyCode.Formula contains the formula of the<br />
structure<br />
• MyCode.CText contains the canonical code of<br />
the structure<br />
These fields are indexed, so using them in the<br />
WHERE clause of a SELECT statement may yield<br />
enormous speed improvement compared to nonindexed<br />
fields.<br />
Example:<br />
CREATE TABLE mx(id, NUMBER, m CLOB);<br />
CREATE INDEX mxix ON mx(m) INDEXTYPE IS<br />
CsCartridge.MoleculeIndexType;<br />
CREATE SYNONYM MxWeight FOR<br />
CsCartridge.schemaname_mxix_W; -<br />
- replace schemaname with the name of your<br />
schema<br />
CREATE SYNONYM MxCode FOR<br />
CsCartridge.schemaname_mxix_A; --<br />
replace schemaname with the name of your<br />
schema<br />
SELECT mx.id, MxWeight.MolWeight FROM<br />
mx, MxWeight WHERE mx.rowid =<br />
MxWeight.rid; -- to list the identifiers and<br />
molweights for the table<br />
SELECT mx.id, MxCode.CText FROM mx,<br />
MxCode WHERE mx.rowid = MxCode.rid; -<br />
- to list the identifiers and canonical codes for the<br />
table<br />
SELECT mx.id, MxCode.Formula FROM mx,<br />
MxCode WHERE mx.rowid = MxCode.rod; --<br />
to list the identifiers and formula for the table<br />
If two tables are to be joined by chemical identity,<br />
then there is no better way to join them than the<br />
CText field maintained by the cartridge. The CText<br />
field is an index field, join by that this field saves one<br />
table scan.<br />
The functions of the AUX package:<br />
• MWTabName(SchemaName VARCHAR2,<br />
IndexName VARCHAR2)<br />
• MWRidNameMWFldName<br />
• FMTabName(SchemaName VARCHAR2,<br />
IndexName VARCHAR2)<br />
• FMRidName<br />
<strong>ChemOffice</strong> Enterprise Workgroup & Databases 2005 CS Oracle Cartridge • 195<br />
Using data maintained by the cartridge