1.1

Table Of Contents
Chapter 16
Using Table Functions to Import Data as
a SQLFire Tables
A SQLFire table function lets you efciently import foreign data into SQLFire tables. Table functions let you join
SQLFire tables with any of the following data sources:
XML-formatted reports and logs
Queries that run in foreign databases
Streaming data from sensors
RSS feeds
The data imported by a table function acts like a SQLFire replicated table that has no indexes. All data is fetched on
every SQLFire member where a query against the table is executed. Outer joins that involve a partitioned table and a
table function have limitations similar to joins with replicated tables (duplicate values are returned from the replicated
table or table function).
See CREATE FUNCTION on page 467 for the complete syntax needed to declare SQLFire table functions. The
following topics provide information on how to write Java methods that wrap foreign data sources inside JDBC
ResultSets.
Overview of SQLFire Table Functions
A SQLFire table function is a Java method that returns a JDBC ResultSet.
Most of the ResultSet methods can be written as stubs that simply raise exceptions. However, a SQLFire table
function must implement the following ResultSet methods:
next()
close()
wasNull()
getXXX() - When invoking a SQLFire table function at runtime, SQLFire calls a getXXX() method on each
referenced column. The particular getXXX() method is based on the column's data type as declared in the
CREATE FUNCTION statement. Preferred getXXX() methods for SQLFire Table Functions on page 104
explains how SQLFire selects an appropriate getXXX() method. However, nothing prevents application code
from calling other getXXX() methods on the ResultSet. The returned ResultSet needs to implement the getXXX()
methods which SQLFire will call as well as all getXXX() methods which the application will call.
103