Oracle8i Data Cartridge Developer's Guide
Release 8.1.5

A68002-01

Library

Product

Contents

Index

Prev Next

15
Reference -- Extensible Indexing Interface

The following ODCI (Oracle Data Cartridge Interface) interfaces are described:


Extensible Indexing -- System Defined Interface Routines


Caution:

These routines are invoked by Oracle at the appropriate times based on SQL statements executed by the end user. The user should not try to invole these routines directly as this may result in corruption of index data.  



ODCIGetInterfaces

Syntax

ODCIGetInterfaces(ifclist OUT ODCIObjectList) RETURN NUMBER

Purpose

The ODCIGetInterfaces function is invoked when an INDEXTYPE is created by a CREATE INDEXTYPE... statement.

Table 15-1 OCDIGetInterfaces Arguments
Argument  Meaning 
ifclist
 

Contains information about the list of interfaces it supports  

Returns

Usage Notes

This function should be implemented as a static type method.

This function must return 'SYS.ODCIINDEX1' in the ODCIObjectList. This indicates that the indextype uses the first version of the ODCIIndex interface.


ODCIIndexAlter

Syntax

ODCIIndexAlter(ia ODCIIndexInfo, parms IN OUT VARCHAR2, alter_option NUMBER) 
RETURN NUMBER

Purpose

The ODCIIndexAlter procedure is invoked when a domain index is altered using an ALTER INDEX statement.

Table 15-2 ODCIIndexAlter Arguments
Argument  Meaning 
ia
 

Contains information about the indexed column(s)  

parms (IN)
 

Parameter string

if ALTER INDEX PARAMETERS or ALTER INDEX REBUILD contains the user specified parameter string

if ALTER INDEX RENAME contain the new name of the domain index  

parms (OUT)
 

Parameter string

is only valid if ALTER INDEX PARAMETERS or ALTER INDEX REBUILD. Contains the resultant string to be stored in system catalogs  

alter_option
 

Specifies one of the following options:

AlterIndexNone if ALTER INDEX PARAMETERS

AlterIndexRename if ALTER INDEX RENAME

AlterIndexRebuild if ALTER INDEX REBUILD  

Returns

Usage Notes


OCDIIndexCreate

Syntax

OCDIIndexCreate(ia ODCIIndexInfo, parms VARCHAR2) RETURN NUMBER

Purpose

The OCDIIndexCreate procedure is invoked when a domain index is created by a CREATE INDEX ... INDEXTYPE IS .... PARAMETERS ... statement issued by the user.


Table 15-3 OCDIIndexCreate Arguments
Argument  Meaning 
ia
 

Contains information about the indexed column  

parms
 

Is the PARAMETERS string passed in uninterpreted by Oracle. The maximum size of the parameter string is 1000 characters.  

Returns

Usage Notes


ODCIIndexClose

Syntax

ODCIIndexClose(self IN <impltype>) RETURN NUMBER

Purpose

This procedure is invoked to end the processing of an operator.


Table 15-4 ODCIIndexClose Arguments
Argument  Meaning 
self(IN)
 

Is the value of the context returned by the previous invocation of ODCIIndexFetch  

Returns

Usage Notes


ODCIIndexDelete

Syntax

ODCIIndexDelete(ia ODCIIndexInfo, rid VARCHAR2, oldval <icoltype>) RETURN NUMBER

Purpose

This procedure is invoked when a row is deleted from a table that has a domain index defined on one of its columns.


Table 15-5 ODCIIndexDelete Arguments
Argument  Meaning 
ia
 

Contains information about the indexed column  

rid
 

Is the row identifier of the deleted row  

oldval
 

Is the value of the indexed column in the deleted row. The datatype is the same as that of the indexed column.  

Returns

Usage Notes


ODCIIndexDrop

Syntax

ODCIIndexDrop(ia ODCIIndexInfo) RETURN NUMBER

Purpose

The ODCIIndexDrop procedure is invoked when a domain index is dropped explicitly using a DROP INDEX statement, or implicitly through a DROP TABLE, or DROP USER statement.


Table 15-6 ODCIIndexDrop Arguments
Argument  Meaning 
ia
 

Contains information about the indexed column  

Returns

Usage Notes


ODCIIndexFetch

Syntax

ODCIIndexFetch(self IN [OUT] <impltype>, nrows IN NUMBER, rids OUT ODCIRidList) 
RETURN NUMBER

Purpose

This procedure is invoked repeatedly to retrieve the rows satisfying the operator predicate.


Table 15-7 ODCIIndexFetch Arguments
Argument  Meaning 
self(IN)
 

Is the value of the context returned by the previous call (to ODCIIndexFetch or to ODCIIndexStart if this is the first time fetch is being called for this operator instance  

self(OUT)
 

The context that is passed to the next query-time call.Note that this parameter does not have to be defined as OUT if the value is not modified in this routine.  

nrows
 

Is the maximum number of result rows that can be returned to Oracle in this call  

rids
 

Is the array of row identifiers for the result rows being returned by this call  

Returns

Usage Notes


ODCIIndexGetMetadata

Syntax

FUNCTION ODCIIndexGetMetadata(
     
ia          IN    ODCIIndexInfo,
version     IN    VARCHAR2,
new_block   OUT   PLS_INTEGER)
     
RETURN VARCHAR2;

Purpose

This routine is called repeatedly to return a series of strings of PL/SQL code that comprise the non-dictionary metadata associated with the index in ia. The routine can pass whatever information is required at import time; that is, policy, version, preferences, and so on. This method on the ODCIIndex interface is required in version 8.1.3 and must be implemented by all domain index implementation types. If ODCIIndexGetMetadata is not found, export will abort the creation of the index. However, for the final release of 8.1, this method will be optional if no implementation-specific metadata is required.

Table 15-8 ODCIIndexGetMetadata Arguments
Argument  Description 
ia
 

Specifies the index on which export is currently working.  

version
 

Version of export making the call in the form 08.01.03.00.00.  

new_block
 

Non-zero (TRUE): Returned string starts a new PL/SQL block. Export will terminate the current block (if any) with END; and open a new block with BEGIN before writing strings to the dump file. The routine is called again.

0 (FALSE): Returned string continues current block. Export writes only the returned string to the dump file then calls the routine again.  

Developers of domain index implementation types in 8.1.3 must implement ODCIIndexGetMetadata even if only to indicate that no PL/SQL metadata exists or that the index is not participating in fast rebuild.

For informational on the PL/SQL interfaces in SYS.DBMS that export will call, see Oracle8i Supplied Packages Reference.

Returns

Usage Notes

This function should be implemented as a static type method.

The routine will be called repeatedly until the return string length is 0. If an index has no metadata to be exported using PL/SQL, it should return an empty string upon first call.

This routine can be used to build one or more blocks of anonymous PL/SQL code for execution by import.Each block returned will be invoked independently by import. That is, if a block fails for any reason at import time, subsequent blocks will still be invoked. Therefore any dependent code should be incorporated within a single block. The size of an individual block of PL/SQL code is limited only by the size of import's read buffer controlled by its BUFFER parameter.

The execution of these PL/SQL blocks at import time will be considered part of the associated domain index's creation. Therefore, their execution will be dependent upon the successful import of the index's underlying base table and user's setting of import's INDEXES=Y/N parameter, as is the creation of the index.

The routine should not pass back the BEGIN/END strings that open and close the individual blocks of PL/SQL code; export will add these to mark the individual units of execution.

The parameter version is the version number of the currently executing export client. Since export and import can be used to downgrade a database to the previous functional point release, it also represents the minimum server version you can expect to find at import time; it may be higher, but never lower.

The cartridge developer can use this information to determine what version of information should be written to the dump file. For example, assume the current server version is 08.02.00.00.00, but the export version handed in is 08.01.04.00.00. If a cartridge's metadata changed formats between 8.1 and 8.2, it would know to write the data to the dump file in 8.1 format anticipating an import into an 8.1.4 system. Server versions starting at 8.2 and higher will have to know how to convert 8.1 format metadata.

Some points of caution:

  1. The data contained within the strings handed back to export must be completely platform-independent. That is, they should contain no binary information that may reflect the endian nature of the export platform which may be different from the import platform. Binary information may be passed as hex strings and converted via RAWTOHEX and HEXTORAW.

  2. The strings are translated from the export server to export client character set and are written to the dump file as such. At import time, they are translated from export client character set to import client character set, then from import client char set to import server character set when handed over the UPI interface.

  3. Specifying a specific target schema in the execution of any of the PL/SQL blocks should be avoided as it will most likely cause an error if you exercise import's FROMUSER -> TOUSER schema replication feature. For example, a procedure prototype such as:

    PROCEDURE AQ_CREATE ( schema IN VARCHAR2, que_name IN VARCHAR2) ...
    

    Should be avoided since this will fail if you have remapped schema A to schema B on import. You can assume at import time that you are already connected to the target schema.

  4. Export dump files from a particular version must be importable into all future versions. This means that all PL/SQL routines invoked within the anonymous PL/SQL blocks written to the dump file must be supported for all time. You may wish to encode some version information to assist with detecting when conversion may be required.

  5. Export will be operating in a read-only transaction if its parameter CONSISTENT=Y. In this case, no writes are allowed from the export session. Therefore, this method must not write any database state.

  6. You can attempt to import the same dump file multiple times, especially when using import's IGNORE=Y parameter. Therefore, this method must produce PL/SQL code that is idempotent, or at least deterministic when executed multiple times.

  7. Case on database object names must be preserved; that is, objects named 'Foo' and 'FOO' are distinct objects. Database object names should be enclosed within double quotes ("") to preserve case.

Error Handling

Any unrecoverable error should raise an exception allowing it to propagate back to get_domain_index_metadata and thence back to export. This will cause export to abort the creation of the current index's DDL in the dump file and to move on to the next index.

At import time, failure of the execution of any metadata PL/SQL block will cause the associated index to not be created under the assumption that the metadata creation is an integral part of the index creation.


ODCIIndexInsert

Syntax

ODCIIndexInsert(ia ODCIIndexInfo, rid VARCHAR2, newval <icoltype>) RETURN NUMBER

Purpose

This procedure is invoked when a new row is inserted into a table that has a domain index defined on one of its columns.

Table 15-9 ODCIIndexInsert Arguments
Argument  Meaning 
ia
 

Contains information about the indexed column  

rid
 

Is the row identifier of the new row in the table  

newval
 

Is the value of the indexed column in the inserted row.  

Returns

Usage Notes

This function should be implemented as a static type method.

This procedure should insert index data corresponding to the new row into the appropriate tables/files storing index data.


ODCIIndexStart

Syntax

ODCIIndexStart(scanctx IN OUT <impltype>, ia ODCIIndexInfo, pi ODCIPredInfo, qi 
ODCIQueryInfo, strt <opbndtype>, stop <opbndtype>, <valargs>) RETURN NUMBER

Purpose

This procedure is invoked to start the evaluation of an operator on an indexed column.

Table 15-10 ODCIIndexStart Arguments
Argument  Meaning 
scanctx(IN)
 

Is the value of the context returned by some previous related query-time call (e.g., the corresponding ancillary operator, if invoked before the primary operator), NULL otherwise  

scanctx(OUT)
 

The context that is passed to the next query-time call; the next query-time call will be to ODCIIndexFetch  

ia
 

Contains information about the indexed column  

pi
 

Contains information about the operator predicate  

qi
 

Contains query information (hints plus list of ancillary operators referenced)  

strt
 

Is the start value of the bounds on the operator return value. The datatype is the same as that of the operator's return value  

stop
 

Is the stop value of the bounds on the operator return value. The datatype is the same as that of the operator's return value.  

valargs
 

Are the value arguments of the operator invocation. The number and datatypes of these arguments are the same as those of the value arguments to the operator.  

Returns

Usage Notes


ODCIIndexTruncate

Syntax

ODCIIndexTruncate(ia ODCIIndexInfo) RETURN NUMBER

Purpose

The ODCIIndexTruncate procedure is invoked when a TRUNCATE statement is issued against a table that has a domain index defined on one of its columns.

Table 15-11 ODCIIndexTruncate Arguments
Argument  Meaning 
ia
 

Contains information about the indexed column  

Returns

Usage Notes


OCIIndexUpdate

Syntax

OCIIndexUpdate(ia ODCIIndexInfo, rid VARCHAR2, oldval <icoltype>, newval 
<icoltype>) RETURN NUMBER

Purpose

This procedure is invoked when a column is updated that has a domain index defined on it.

Table 15-12 OCIIndexUpdate Arguments
Argument  Meaning 
ia
 

Contains information about the indexed column  

rid
 

Is the row identifier of the updated row  

oldval
 

Is the value of the indexed column before the update. The datatype is the same as that of the indexed column.  

newval
 

Is the value of the indexed column after the update. The datatype is the same as that of the indexed column.  

Returns

Usage Notes




Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index