public final class JavaToIfxType
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BYTEMASK |
static int |
BYTESHIFT |
static int |
DefDblScale |
static int |
DefFltScale |
static int |
IFX_DOUBLE_SIZE |
static int |
IFX_INT_SIZE |
static int |
IFX_LGINT_SIZE |
static int |
IFX_LONG_SIZE |
static int |
IFX_SMFLOAT_SIZE |
static int |
IFX_SMINT_SIZE |
static java.lang.String |
NO_ENCODING |
protected static boolean |
TruncateFractSec
if false then rounds up fractional seconds, possibly upto year
In order to do rounding, set this to false and uncomment
the series of ifs inside convertTimestampToDecimal() below.
|
| Constructor and Description |
|---|
JavaToIfxType() |
| Modifier and Type | Method and Description |
|---|---|
static Decimal |
convertIntervalToDecimal(IntervalDF intrvl) |
static Decimal |
convertIntervalToDecimal(IntervalYM intrvl) |
static java.lang.String |
convertIntervalToString(IntervalDF intrvl) |
static java.lang.String |
convertIntervalToString(IntervalYM intrvl) |
static java.lang.String |
convertNanosToFract(int nano)
Converts first to a number that retains high 5 digits
and reduces to a string.
|
static Decimal |
convertTimestampToDecimal(java.sql.Timestamp t)
Creates a Decimal from the Timestamp that represents its
value as a decimal number of the form:
yyyymmddhhmmss.fffff
Note: For now truncates fractional digits 6-9 instead of rounding
Since rounding could in worst case propagate all the way to year
we will hold off on doing it until need is clearly expressed.
|
static Decimal |
convertTimestampToDecimal(java.sql.Timestamp t,
java.util.Calendar cal) |
static Decimal |
convertTimeToDecimal(java.sql.Time t)
Creates Decimal from the Time that represents its
value as a decimal number of the form:
hhmmss.0
|
byte[] |
JavaToIfx4BytesChar(java.lang.String s,
boolean usestrenc) |
byte[] |
JavaToIfx4BytesChar(java.lang.String s,
java.lang.String dbEnc,
boolean usestrenc) |
byte[] |
JavaToIfxChar(java.lang.String s,
boolean usestrenc)
Converts a Java String to an Informix Char (n) (in a byte array)
The first 2 bytes encode the length of the string.
|
byte[] |
JavaToIfxChar(java.lang.String s,
java.lang.String dbEnc,
boolean usestrenc) |
static byte[] |
JavaToIfxDate(java.sql.Date d)
Converts a Java java.sql.Date to an Informix date (in a byte array)
|
static byte[] |
JavaToIfxDateTime(java.sql.Time t)
Converts a Java dateTime (java.sql.Time)
to an Informix datetime (in a byte array)
|
static byte[] |
JavaToIfxDateTime(java.sql.Timestamp t)
Converts a Java dateTime (java.sql.Timestamp)
to an Informix datetime (in a byte array)
|
static byte[] |
JavaToIfxDateTime(java.sql.Timestamp t,
java.util.Calendar cal) |
static byte[] |
JavaToIfxDecimal(java.math.BigDecimal n)
Converts a Java Bignum to an Informix decimal (in a byte array)
|
static byte[] |
JavaToIfxDecimalNull(short qual) |
static byte[] |
JavaToIfxDouble(double d)
Converts a Java double to an Informix double
|
static byte[] |
JavaToIfxDouble(java.lang.Double d)
Converts a Java Double to an Informix double
|
static byte[] |
JavaToIfxInt(int i)
Converts a Java int to an Informix int (in a byte array)
Conversion method: Shifts the int into 4 bytes
|
static byte[] |
JavaToIfxInterval(IntervalDF t)
Converts a Java interval (IntervalDF)
to an Informix interval (in a byte array)
Conversion path: IntervalDF->String->Decimal->Interval
|
static byte[] |
JavaToIfxInterval(IntervalYM t)
Converts a Java interval (IntervalYM)
to an Informix interval (in a byte array)
Conversion path: IntervalYM->String->Decimal->Interval
|
static byte[] |
JavaToIfxLongBigInt(long val)
Converts a Java long to an Informix bigint (in a byte array)
|
static byte[] |
JavaToIfxLongInt(long l)
Converts a Java long to an Informix int8 (in a byte array)
|
byte[] |
JavaToIfxLvarchar(java.lang.String s,
java.lang.String dbEnc,
boolean usestrenc) |
static byte[] |
JavaToIfxReal(float f)
Converts a Java float to an Informix real
|
static byte[] |
JavaToIfxReal(java.lang.Float f)
Converts a Java Float to an Informix real
|
static byte[] |
JavaToIfxSmallInt(short s)
Converts a Java short to an Informix smallint (in a byte array)
|
byte[] |
JavaToIfxVarChar(java.lang.String s,
java.lang.String dbEnc,
int leng,
boolean usestrenc) |
public static final int IFX_INT_SIZE
public static final int BYTESHIFT
public static final int BYTEMASK
public static final int IFX_LGINT_SIZE
public static final int IFX_SMINT_SIZE
public static final int IFX_SMFLOAT_SIZE
public static final int IFX_LONG_SIZE
public static final int IFX_DOUBLE_SIZE
public static final int DefDblScale
public static final int DefFltScale
public static final java.lang.String NO_ENCODING
protected static final boolean TruncateFractSec
public static byte[] JavaToIfxInt(int i)
i - int to be convertedpublic byte[] JavaToIfxChar(java.lang.String s,
boolean usestrenc)
throws java.io.UnsupportedEncodingException,
java.sql.SQLException
s - String to be converted
TBD ??? Shouldnt we use 2 bytes per char due to Unicode?java.io.UnsupportedEncodingExceptionjava.sql.SQLExceptionpublic byte[] JavaToIfxChar(java.lang.String s,
java.lang.String dbEnc,
boolean usestrenc)
throws java.io.UnsupportedEncodingException,
java.sql.SQLException
java.io.UnsupportedEncodingExceptionjava.sql.SQLExceptionpublic byte[] JavaToIfx4BytesChar(java.lang.String s,
boolean usestrenc)
throws java.io.UnsupportedEncodingException,
java.sql.SQLException
java.io.UnsupportedEncodingExceptionjava.sql.SQLExceptionpublic byte[] JavaToIfx4BytesChar(java.lang.String s,
java.lang.String dbEnc,
boolean usestrenc)
throws java.io.UnsupportedEncodingException,
java.sql.SQLException
java.io.UnsupportedEncodingExceptionjava.sql.SQLExceptionpublic byte[] JavaToIfxVarChar(java.lang.String s,
java.lang.String dbEnc,
int leng,
boolean usestrenc)
throws java.io.UnsupportedEncodingException,
java.sql.SQLException
java.io.UnsupportedEncodingExceptionjava.sql.SQLExceptionpublic byte[] JavaToIfxLvarchar(java.lang.String s,
java.lang.String dbEnc,
boolean usestrenc)
throws java.io.UnsupportedEncodingException,
java.sql.SQLException
java.io.UnsupportedEncodingExceptionjava.sql.SQLExceptionpublic static byte[] JavaToIfxDate(java.sql.Date d)
public static java.lang.String convertNanosToFract(int nano)
nano - number representing nano secondspublic static Decimal convertTimestampToDecimal(java.sql.Timestamp t)
public static Decimal convertTimestampToDecimal(java.sql.Timestamp t, java.util.Calendar cal)
public static Decimal convertTimeToDecimal(java.sql.Time t)
public static java.lang.String convertIntervalToString(IntervalDF intrvl)
public static Decimal convertIntervalToDecimal(IntervalDF intrvl)
public static java.lang.String convertIntervalToString(IntervalYM intrvl)
public static Decimal convertIntervalToDecimal(IntervalYM intrvl)
public static byte[] JavaToIfxDateTime(java.sql.Timestamp t)
t - Timestamp to be convertedpublic static byte[] JavaToIfxDateTime(java.sql.Timestamp t,
java.util.Calendar cal)
public static byte[] JavaToIfxDateTime(java.sql.Time t)
t - Time to be convertedpublic static byte[] JavaToIfxInterval(IntervalDF t)
t - Interval to be convertedpublic static byte[] JavaToIfxInterval(IntervalYM t)
t - Interval to be convertedpublic static final byte[] JavaToIfxDecimalNull(short qual)
public static final byte[] JavaToIfxDecimal(java.math.BigDecimal n)
public static final byte[] JavaToIfxDouble(java.lang.Double d)
public static final byte[] JavaToIfxDouble(double d)
public static final byte[] JavaToIfxReal(java.lang.Float f)
public static byte[] JavaToIfxReal(float f)
public static byte[] JavaToIfxSmallInt(short s)
public static byte[] JavaToIfxLongInt(long l)
public static byte[] JavaToIfxLongBigInt(long val)