Programming Interfaces Guide
CHAPTER 5. The Open Client Interface
Open Client has its own internal data types, which differ in some details from those available in Adaptive Server Anywhere. For this reason, Adaptive Server Anywhere internally maps some data types between those used by Open Client applications and those available in Adaptive Server Anywhere.
The following table illustrates the mapping of data types performed by Adaptive Server Anywhere between internal Adaptive Server Anywhere data types and Open Client data types.
The base data type column is for information only. Applications receive the data type information as in the ASA data type column. The base data type is hidden from the Open Client application.
Open Client data type |
ASA data type |
ASA base data type |
---|---|---|
binary (x) |
binary (x) |
|
bit |
bit |
|
char |
char |
|
datetime |
datetime |
timestamp |
smalldatetime |
smalldatetime |
timestamp |
decimal |
decimal |
|
numeric |
numeric |
|
real |
real |
|
float |
double |
|
image |
long binary |
|
tinyint |
tinyint |
|
smallint |
smallint |
|
int |
int |
|
bigint |
bigint |
|
money |
money |
decimal (19,4) |
smallmoney |
smallmoney |
decimal (10,4) |
text |
long varchar |
|
varchar |
varchar |
|
varbinary |
varbinary |
|
timestamp |
timestamp |
|
All others |
Error |
The following table lists the mappings of data types supported in Adaptive Server Anywhere that have no direct counterpart in Open Client.
ASA data type |
Open Client data type |
---|---|
unsigned short |
smallint |
unsigned int |
int |
unsigned bigint |
bigint |
date |
smalldatetime |
time |
smalldatetime |
serialization |
longbinary |
java |
longbinary |
string |
varchar |
timestamp struct |
datetime |
Some data types have different ranges in Adaptive Server Anywhere than in Open Client. In such cases, overflow errors can occur during retrieval or insertion of data.
The following table lists Open Client application data types that can be mapped to Adaptive Server Anywhere data types, but with some restriction in the range of possible values.
In most cases, the Open Client data type is mapped to a Adaptive Server Anywhere data type that has a greater range of possible values. As a result, it is possible to pass a value to Adaptive Server Anywhere that will be accepted and stored in a database, but one that is too large to be fetched by an Open Client application.
Data type |
Implementation |
Lower range |
Upper range |
---|---|---|---|
MONEY |
Open Client |
-922,337,203 |
922,337,203 |
MONEY |
Adaptive Server Anywhere |
-1e15 + 0.0001 |
1e15 - 0.0001 |
SMALLMONEY |
Open Client |
-214,748.3648 |
214,748.3647 |
DECIMAL (10,4) |
Adaptive Server Anywhere |
-1e6 + 0.0001 |
1e6 - 0.0001 |
TIMESTAMP |
Open Client |
N/A |
N/A |
DATETIME |
Open Client |
Jan 1, 1753 |
Dec 31, 9999 |
SMALLDATETIME |
Open Client |
Jan 1, 1900 |
June 6, 2079 |
DATETIME |
Adaptive Server Anywhere |
Jan 1, 0001 |
Dec 31, 9999 |
BIT |
Open Client |
0 |
1 |
TINYINT |
Adaptive Server Anywhere |
0 |
255 |
For example, the Open Client MONEY and SMALLMONEY data types do not span the entire numeric range of their underlying Adaptive Server Anywhere implementations. Therefore it is possible to have a value in a Adaptive Server Anywhere column which exceeds the boundaries of the Open Client data type MONEY. When the client fetches any such offending values via Adaptive Server Anywhere, an error is generated (Error 22: Invalid data format. Possible overflow or underflow).
The Adaptive Server Anywhere implementation of the Open Client TIMESTAMP data type, when such a value is passed in Adaptive Server Anywhere is different from that of Adaptive Server Enterprise. In Adaptive Server Anywhere the value is mapped to the Adaptive Server Anywhere DATETIME data type. The default value is NULL in Adaptive Server Anywhere, and no guarantee is made of its uniqueness. By contrast, Adaptive Server Enterprise ensures that the value is monotonically increasing in value, and so is unique.
By contrast, the Adaptive Server Anywhere TIMESTAMP data type contains year, month, day, hour, minute, second and fraction of second information, and the DATETIME data type has a greater range of possible values than the Open Client data types that are mapped to it by Adaptive Server Anywhere.
Adaptive Server Adaptive Server Anywhere defines SYSNAME as VARCHAR (30) and does not allow the Open Server client application to specify the length of the data field.
The following tables lists Open Client data types for which there is nosupport in Adaptive Server Anywhere.
Open Client application data type |
Problem |
---|---|
LONG |
Not supported |
SENSITIVITY |
Not supported |
BOUNDARY |
Not supported |
VOID |
Not supported |