This module defines CORBA IDL constants and types for dynamic result set handling, with the intention of supporting easy conversion from and to java.sql.ResultSet (or jdbc.sql.ResultSet for JDK 1.0.2).
No interface types are defined for result set handling. When an operation returns a result set, the entire result set must be transmitted from server to client before the client can begin processing the results.
This approach has the potential to be much more efficient in a wide-area
network environment than the use of interface types, which would result in a
large number of small requests from client to server to fetch an entire
result set. It is also preferable to streaming the result set into an
octet sequence, since the IDL language mappings for the ResultSet
type allow for convenient manipulation of result set data and meta-data.
If a client requires the ability to process some results before all the results have been transmitted, the result set can be explicitly broken into batches by the server programmer using an IDL interface such as:
interface SampleInterface { TabularResults::ResultSet operationWhichReturnsResultSet(...); TabularResults::ResultSet getMoreResults(); };
const unsigned long FLAG_AUTO_INCREMENT = 1;
const unsigned long FLAG_CASE_SENSITIVE = 2;
const unsigned long FLAG_CURRENCY = 4;
const unsigned long FLAG_DEFINITELY_WRITABLE = 512;
const unsigned long FLAG_NOT_NULLABLE = 8;
const unsigned long FLAG_NULLABLE = 16;
const unsigned long FLAG_READONLY = 32;
const unsigned long FLAG_SEARCHABLE = 64;
const unsigned long FLAG_UNSIGNED = 128;
const unsigned long FLAG_WRITABLE = 256;
const long TYPE_BIGINT = -5;
const long TYPE_BINARY = -2;
const long TYPE_BIT = -7;
const long TYPE_BLOB = 2004;
const long TYPE_CHAR = 1;
const long TYPE_CLOB = 2005;
const long TYPE_DATE = 91;
const long TYPE_DECIMAL = 3;
const long TYPE_DOUBLE = 8;
const long TYPE_FLOAT = 6;
const long TYPE_INTEGER = 4;
const long TYPE_LONGVARBINARY = -4;
const long TYPE_LONGVARCHAR = -1;
const long TYPE_NUMERIC = 2;
const long TYPE_REAL = 7;
const long TYPE_SMALLINT = 5;
const long TYPE_TIME = 92;
const long TYPE_TIMESTAMP = 93;
const long TYPE_TINYINT = -6;
const long TYPE_VARBINARY = -3;
const long TYPE_VARCHAR = 12;
typedef sequence < BCD::Binary > BinarySeq;
typedef sequence < boolean > BooleanSeq;
A result column consists of meta data and data values, as well as a sequence indicating which rows contain null values. The length of 'nulls' may be less than the number of result rows. The default value if a row's 'nulls' entry is not present is false (i.e. non-null). This optimisation is particularly useful when the column's 'flags' contains the FLAG_NOT_NULLABLE bit.
struct Column { unsigned long flags; unsigned long width; unsigned long scale; string name; string label; TabularResults::Data values; TabularResults::BooleanSeq nulls; };
The precision for floating-point decimal values is calculated as 'width - sign - dot', where sign = 1 if the flags bit FLAG_UNSIGNED is set (otherwise sign = 0), and dot = 1 if scale > 0 (otherwise dot = 0).
The scale must be zero for TYPE_BIGINT.
typedef sequence < TabularResults::Column > ColumnSeq;
The Data
type represents an entire column in a result set.
Data is stored in a result set in column-major order. This means the
column data type (the union discriminator) only needs to be transmitted
over the network once, and minimises padding when using GIOP.
union Data switch (long) { case TYPE_BIT: TabularResults::BooleanSeq booleanValues; case TYPE_TINYINT: TabularResults::OctetSeq octetValues; case TYPE_SMALLINT: TabularResults::ShortSeq shortValues; case TYPE_INTEGER: TabularResults::LongSeq longValues; case TYPE_REAL: TabularResults::FloatSeq floatValues; case TYPE_DOUBLE: case TYPE_FLOAT: TabularResults::DoubleSeq doubleValues; case TYPE_CHAR: case TYPE_LONGVARCHAR: case TYPE_VARCHAR: case TYPE_CLOB: TabularResults::StringSeq stringValues; case TYPE_BINARY: case TYPE_LONGVARBINARY: case TYPE_VARBINARY: case TYPE_BLOB: TabularResults::BinarySeq binaryValues; case TYPE_BIGINT: case TYPE_DECIMAL: case TYPE_NUMERIC: TabularResults::DecimalSeq decimalValues; case TYPE_DATE: TabularResults::DateSeq dateValues; case TYPE_TIME: TabularResults::TimeSeq timeValues; case TYPE_TIMESTAMP: TabularResults::TimestampSeq timestampValues; };
Notes:
typedef sequence < MJD::Date > DateSeq;
typedef sequence < BCD::Decimal > DecimalSeq;
typedef sequence < double > DoubleSeq;
typedef sequence < float > FloatSeq;
typedef sequence < long > LongSeq;
typedef sequence < octet > OctetSeq;
The ResultSet
type may be used as the return type
for an operation returning a single result set.
struct ResultSet { unsigned long rows; TabularResults::ColumnSeq columns; };
The ResultSets
type may be used as the return type
for an operation returning multiple result sets.
typedef sequence < TabularResults::ResultSet > ResultSets;
typedef sequence < short > ShortSeq;
typedef sequence < string > StringSeq;
typedef sequence < MJD::Time > TimeSeq;
typedef sequence < MJD::Timestamp > TimestampSeq;