Class UnicodeRoundTripTest
This function takes a string and an array of ints constructed in PG, such
that PG believes the codepoints in the string to correspond exactly with the
ints in the array. The function compares the two, generates a new array from
the codepoints Java sees in the string and a new Java string from the
original array, and returns a tuple (matched, cparray, s) where
matched
indicates whether the original array and string matched
as seen by Java, and cparray
and s
are the new array and
string generated in Java.
The supplied test query generates all Unicode code points 1k at a time,
calls this function on each (1k array, 1k string) pair, and counts a failure
if matched
is false or the original and returned arrays or strings
do not match as seen in SQL.
This example sets an implementor
tag based on a PostgreSQL condition,
as further explained in the ConditionalDDR
example.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
unicodetest
(String s, int[] ints, ResultSet rs) This function takes a string and an array of ints constructed in PG, such that PG believes the codepoints in the string to correspond exactly with the ints in the array.
-
Constructor Details
-
UnicodeRoundTripTest
public UnicodeRoundTripTest()
-
-
Method Details
-
unicodetest
@Function(out={"matched boolean","cparray integer[]","s text"}, provides="unicodetest fn") public static boolean unicodetest(String s, int[] ints, ResultSet rs) throws SQLException This function takes a string and an array of ints constructed in PG, such that PG believes the codepoints in the string to correspond exactly with the ints in the array. The function compares the two, generates a new array from the codepoints Java sees in the string and a new Java string from the original array, and returns a tuple (matched, cparray, s) wherematched
indicates whether the original array and string matched as seen by Java, andcparray
ands
are the new array and string generated in Java.- Parameters:
s
- A string, whose codepoints should match the entries ofints
ints
- Array of ints that should match the codepoints ins
rs
- OUT (matched, cparray, s) as described above- Returns:
- true to indicate the OUT tuple is not null
- Throws:
SQLException
-