![]()
![]() ![]() ![]() ![]() ![]() ![]() ![]() Documentation Top ![]() Global Index ![]() Reference Manual ![]() ![]() ![]() Developer's Guide ![]() ![]() Tuning Cloudscape ![]() ![]() |
ExternalVirtualTableCloudscapes Virtual Table Interface (VTI) allows an object that implements the java.sql.ResultSet interface (and meets other minimal requirements) to appear as an ExternalVirtualTable, a legal form of a TableExpression in the FROM clause of a SELECT statement. As far as the rest of the query is concerned, there this no difference between an ExternalVirtualTable and a table, view, or other virtual table such as a subquery or VALUES clause. The SELECT statement can reference any column from an ExternalVirtualTable in any of its clauses. The use of a VTI in SQL-J, similar to the way Java objects can be referenced in other constructs, is dynamic, not declarative; there is no CREATE EXTERNAL VIRTUAL TABLE statement. Instead, you call the constructor of the class that implements the VTI requirements, to instantiate an ExternalVirtualTable on the fly within the statement. The VTI is a powerful tool that can be used to make any external data source, such as a flat text file, a live data feed, or a gateway to an operational RDBMS, appear as a table to Cloudscape. NOTE: For information on the requirements for a VTI class and how to develop one, see Programming VTIs in the Cloudscape Developers Guide. Syntax
As with other derived tables, you must give an ExternalVirtualTable a CorrelationName. Names of derived columns are optional. NOTE: Column names returned by a VTI are treated as case-sensitive, delimited identifiers. Provide names of derived columns in the correlation name to treat them as case-insensitive names, or program your VTI to return all uppercase column names. Examples
-- jarvti is a class alias for a sample VTI class Dependency SystemA statement is not dependent on a VTI. The statement that references the VTI is not dependent on any of the objects referenced within the VTI. (As in a java method call, any statements nested within the VTI are dependent on the objects that they reference.) Inserting from Table in Same DatabaseBe careful when using an ExternalVirtualTable to reference a table in the current database. If the ExternalVirtualTable is accessing a table in the current database, and you are using that ExternalVirtualTable as the source of an INSERT, the query could result in an infinite loop. Cloudscape does not detect that situation. For example, the following statement would result in an infinite loop:
NEW: Beginning in Version 3.0, the optimizer chooses the correct join order for statements involving a join with an ExternalVirtualTable. You no longer have to specify the join order. If the statement involves two ExternalVirtualTables, each of which references the other, the statement cannot be evaluated and is not permitted, as in the following example: NOTE: If a VTI cannot be instantiated more than once and it takes a join column as a parameter, no legal join order is possible, and an exception is thrown. | ||
![]() ![]() ![]() ![]() ![]() ![]() | ![]() ![]() Cloudscape Version 3.0 ![]() For technical support, go to: www.cloudscape.com and click Support. Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved. |