Download View this document as PDF

Transcript
Java-SQL string data
•
If the runtime value of the expression (home_addr) is the specified class
(Address2Line) or one of its subclasses, the value of the expression is
returned, with the specified datatype (Address2Line).
•
If the runtime value of the expression (home_addr) is a superclass of the
specified class (Address), then a null is returned.
Adaptive Server evaluates the select statement for each row of the result. For
each row:
•
If the value of the home_addr column is an Address2Line, then convert
returns that value, and the field reference extracts the line2 field. If convert
returns null, then the field reference itself is null.
•
When a convert returns null, then the field reference itself evaluates to null.
Hence, the results of the select shows the line2 value for those rows whose
home_addr column is an Address2Line and a null for those rows whose
home_addr column is an Address. As described in “Treatment of nulls in JavaSQL data” on page 50, the select also shows a null line2 value for those rows
in which the home_addr column is null.
Java-SQL string data
In Java-SQL columns, fields of type String are stored as Unicode.
When a Java-SQL String field is assigned to a SQL data item whose type is
char, varchar, nchar, nvarchar, or text, the Unicode data is converted to the
character set of the SQL system. Conversion errors are specified by the set
char_convert options.
When a SQL data item whose type is char, varchar, nchar, or text is assigned to
a Java-SQL String field that is stored as Unicode, the character data is
converted to Unicode. Undefined codepoints in such data cause conversion
errors.
Zero-length strings
In Transact-SQL, a zero-length character string is treated as a null value, and
the empty string ( ) is treated as a single space.
54
Adaptive Server Enterprise