If the CHAR option is passed to oaexecsql in the options
parameter, it is passed to the underlying OmniAccess function.
For example:
oaexecsql (cursor, "CHAR=AUTO", status,
"SELECT * FROM ORDERS WHERE STATUS='BACK'")
In this example, the CHAR=AUTO option is passed to oaselect
where the select statement will actually be processed.
CHAR=AUTO - returns all data
back in CHARACTER datatype, however it sets the size on a
per-column basis to the smallest size that can safely return
all possible values.
CHAR=n - returns all data
back in CHARACTER datatype and sets the buffer size to length
n.
The CHAR option automatically converts between alphanumeric
and numeric data, thus eliminating any concern for byte-ordering
and integer conversion across hardware platforms.
For example, when a client application on a PC requests numeric
data using the CHAR, OmniAccess automatically converts the
data from its numeric format to character data.
Conversely, when a client application sends information to
a server, the character representation of the number is converted
to a numeric type and byte order appropriate for the server
operating system.
When using the CHAR option, the buffer must reflect the length
of the ASCII character representation, not its binary storage
format, and should be padded with blanks up to length n.
The CHAR option supports ASCII representations of numeric
values that contain a leading + or -. It also supports exponential
values, like 6.02e23, for numeric columns defined as TYPE
FLOAT.
Character
representations of floating point data may lose precision.
top
Examples
CHAR can be passed in a SQL SET statement, in the options
parameter of an OAAPI function, or in a WITH options clause
in a SQL statment.
ODXSQL
>connect orders.env
>SET CHAR 32
or
>SELECT * FROM ORDERS WHERE STATUS='BACK' WITH
CHAR=32
oaexecsql
oaexecsql (cursor, ";", status, "SET
CHAR AUTO")
or
oaexecsql (cursor, "CHAR AUTO", status,
"SELECT * FROM ORDERS WHERE STATUS='BACK'")
or
oaexecsql (cursor, ";", status, "SELECT
* FROM ORDERS WHERE STATUS='BACK' WITH CHAR=AUTO")
JDBC
Statement stmt = connection.createStatement();
String sql = "SET CHAR AUTO";
stmt.execute(sql);
or
Statement stmt = connection.createStatement();
String sql = "SELECT * FROM ORDERS WHERE STATUS='BACK'
WITH CHAR=AUTO";
ResultSet rs = stmt.executeQuery(sql);
top
|