public final class IfxToJavaType
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DAYS1900
Constant: number of days between 1/1/0000 and 1/1/1900
|
static int |
DAYS4CENT
Constant: 365*400 +100-3
|
static int |
DAYS4YEAR
Constant: 365*4 +1
|
| Constructor and Description |
|---|
IfxToJavaType() |
| Modifier and Type | Method and Description |
|---|---|
static int |
convertDateToDays(java.sql.Date dt)
Converts java.sql.Date to a int that encodes the number
of days since 1/1/1900 (as 1).
|
static java.sql.Date |
convertDaysToDate(int dt)
Does the actual conversion from days -> (yr, date, month)
|
static java.lang.String |
IfxToDateTimeUnloadString(byte[] b,
int offset,
int length,
short prec)
Convert Informix DateTime to string which is in format compatible with
SQL LOAD/UNLOAD format
solution adopted for now.
|
java.lang.String |
IfxToJavaChar(byte[] b,
boolean encoption) |
java.lang.String |
IfxToJavaChar(byte[] b,
int offset,
int length,
boolean encoption) |
static java.lang.String |
IfxToJavaChar(byte[] b,
int offset,
int length,
java.lang.String dbEnc,
boolean encoption)
Convert Informix CHAR (n)/ CHARACTER (n) to Java String
Conversion method: Create String from given bytes
|
java.lang.String |
IfxToJavaChar(byte[] b,
java.lang.String dbEnc,
boolean encoption) |
static java.sql.Date |
IfxToJavaDate(byte[] b) |
static java.sql.Date |
IfxToJavaDate(byte[] b,
int offset)
Convert Informix DATE to Java Date
IFX date arrives as a long encoding number of days since
Dec31, 1899 treated as 0.
|
static java.sql.Timestamp |
IfxToJavaDateTime(byte[] b,
int offset,
int length,
short prec)
Convert Informix DateTime to Java Timestamp
Note: IFX DateTime can specify a date in a subset of the full range
[YR ..
|
static java.sql.Timestamp |
IfxToJavaDateTime(byte[] b,
int offset,
int length,
short prec,
java.util.Calendar cal) |
static java.sql.Timestamp |
IfxToJavaDateTime(byte[] b,
short prec)
Convert Informix DateTime to Java Timestamp
|
static java.math.BigDecimal |
IfxToJavaDecimal(byte[] b,
int offset,
int length,
short prec)
Convert Informix Decimal to Java Bignum
|
static java.math.BigDecimal |
IfxToJavaDecimal(byte[] b,
short prec)
Convert Informix Decimal to Java Bignum
|
static double |
IfxToJavaDouble(byte[] b) |
static double |
IfxToJavaDouble(byte[] b,
int offset)
Convert Informix Double to Java Double
|
static int |
IfxToJavaInt(byte[] b) |
static int |
IfxToJavaInt(byte[] b,
int offset) |
static Interval |
IfxToJavaInterval(byte[] b,
int offset,
int length,
short prec) |
static Interval |
IfxToJavaInterval(byte[] b,
short prec) |
static long |
IfxToJavaLongBigInt(byte[] b) |
static long |
IfxToJavaLongBigInt(byte[] b,
int offset)
Convert Informix bigint to Java long
|
static long |
IfxToJavaLongInt(byte[] b) |
static long |
IfxToJavaLongInt(byte[] buf,
int offset)
Convert Informix int8 to Java long
|
static float |
IfxToJavaReal(byte[] b) |
static float |
IfxToJavaReal(byte[] b,
int offset)
Convert Informix Real to Java Real
|
static short |
IfxToJavaSmallInt(byte[] b) |
static short |
IfxToJavaSmallInt(byte[] b,
int offset)
Convert Informix SmallInt to Java short
|
static boolean |
rleapyear(int yr)
checks if yr is a leap year
|
protected static short |
widenByte(byte b)
Moves byte into short in such a way that the high bit is NOT
propagated
|
public static final int DAYS1900
public static final int DAYS4CENT
public static final int DAYS4YEAR
public java.lang.String IfxToJavaChar(byte[] b,
boolean encoption)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String IfxToJavaChar(byte[] b,
int offset,
int length,
boolean encoption)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String IfxToJavaChar(byte[] b,
java.lang.String dbEnc,
boolean encoption)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String IfxToJavaChar(byte[] b,
int offset,
int length,
java.lang.String dbEnc,
boolean encoption)
throws java.io.IOException
b - bytes encoding dataoffset - offset into byte arraylength - size of char datadbEnc - - JDK encodingencoption - - true if IFX_USE_STRENC connection property is set.java.io.IOExceptionpublic static java.sql.Date IfxToJavaDate(byte[] b)
public static java.sql.Date IfxToJavaDate(byte[] b,
int offset)
b - bytes encoding dataoffset - offset into the byte arraylength - data lengthpublic static final boolean rleapyear(int yr)
public static java.sql.Date convertDaysToDate(int dt)
dt - number of days since 1/1/1900 (as 1)
Does handle negative days, interp as backwards from 12/31/1899 as 0
No dates before 1/1/0000 allowed, however for now, relies on
IFX not generating out of allowed range date.public static int convertDateToDays(java.sql.Date dt)
dt - java.sql datepublic static java.sql.Timestamp IfxToJavaDateTime(byte[] b,
short prec)
public static java.sql.Timestamp IfxToJavaDateTime(byte[] b,
int offset,
int length,
short prec)
b - bytes encoding dataoffset - offset into the byte arraylength - data lengthprec - precision as received from IFXpublic static java.sql.Timestamp IfxToJavaDateTime(byte[] b,
int offset,
int length,
short prec,
java.util.Calendar cal)
public static java.lang.String IfxToDateTimeUnloadString(byte[] b,
int offset,
int length,
short prec)
b - bytes encoding dataoffset - offset into the byte arraylength - data lengthprec - precision as received from IFXpublic static Interval IfxToJavaInterval(byte[] b, short prec)
public static Interval IfxToJavaInterval(byte[] b, int offset, int length, short prec)
public static java.math.BigDecimal IfxToJavaDecimal(byte[] b,
short prec)
b - bytes encoding dataprec - precision as received from IFXpublic static java.math.BigDecimal IfxToJavaDecimal(byte[] b,
int offset,
int length,
short prec)
b - bytes encoding dataoffset - into byte arraylength - length of dataprec - precision as received from IFXpublic static double IfxToJavaDouble(byte[] b)
public static double IfxToJavaDouble(byte[] b,
int offset)
b - bytes encoding dataoffset - offset into byte arraylength - data lengthpublic static float IfxToJavaReal(byte[] b)
public static float IfxToJavaReal(byte[] b,
int offset)
b - bytes encoding dataprec - precision as received from IFXprotected static final short widenByte(byte b)
public static short IfxToJavaSmallInt(byte[] b)
public static short IfxToJavaSmallInt(byte[] b,
int offset)
b - bytes encoding dataoffset - into byte arraylength - data lengthprec - precision as received from IFXpublic static int IfxToJavaInt(byte[] b)
public static int IfxToJavaInt(byte[] b,
int offset)
public static long IfxToJavaLongInt(byte[] b)
public static long IfxToJavaLongInt(byte[] buf,
int offset)
b - bytes encoding dataoffset - offset into byte arraypublic static long IfxToJavaLongBigInt(byte[] b)
public static long IfxToJavaLongBigInt(byte[] b,
int offset)
b - bytes encoding dataoffset - offset into byte array