org.firebirdsql.gds
Class XSQLVAR

java.lang.Object
  extended by org.firebirdsql.gds.XSQLVAR

public class XSQLVAR
extends java.lang.Object

The class XSQLDA is a java mapping of the XSQLVAR server data structure used to represent one column for input and output.

Version:
1.0
Author:
Alejandro Alberola

Field Summary
 java.lang.String aliasname
           
 java.lang.Object cachedobject
           
protected  org.firebirdsql.encodings.Encoding coder
           
 java.lang.String ownname
           
 java.lang.String relaliasname
           
 java.lang.String relname
           
 byte[] sqldata
           
 int sqllen
           
 java.lang.String sqlname
           
 int sqlscale
           
 int sqlsubtype
           
 int sqltype
           
 
Constructor Summary
XSQLVAR()
           
 
Method Summary
 void copyFrom(XSQLVAR original)
          Copy constructor.
 void copyFrom(XSQLVAR original, boolean copyData)
          Copy constructor.
 boolean decodeBoolean(byte[] data)
          Decode boolean from supplied data.
 java.sql.Date decodeDate(byte[] byte_int)
          Decode a byte array into a Date value.
 java.sql.Date decodeDate(java.sql.Date d, java.util.Calendar cal)
          Decode a Date value using a given Calendar.
 java.sql.Date decodeDateCalendar(byte[] byte_int, java.util.Calendar c)
           
 double decodeDouble(byte[] byte_int)
          Decode a byte array into a double value.
 float decodeFloat(byte[] byte_int)
          Decode a byte array into a float value.
 int decodeInt(byte[] byte_int)
          Decode a byte array into an int value.
 long decodeLong(byte[] byte_int)
          Decode a byte array into a long value.
 short decodeShort(byte[] byte_int)
          Decode a byte array into a short value.
 java.lang.String decodeString(byte[] value, java.lang.String encoding, java.lang.String mappingPath)
          Decode an encoded byte array into a String using a given encoding.
 java.sql.Time decodeTime(byte[] int_byte)
          Decode a byte array into a Time value.
 java.sql.Time decodeTime(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)
          Decode a Time value using a given Calendar.
 java.sql.Time decodeTimeCalendar(byte[] int_byte, java.util.Calendar c)
           
 java.sql.Timestamp decodeTimestamp(byte[] byte_int)
          Decode a byte array into a Timestamp.
 java.sql.Timestamp decodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal)
          Decode a Timestamp value using a given Calendar.
 java.sql.Timestamp decodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)
          Decode a Timestamp value using a given Calendar.
 java.sql.Timestamp decodeTimestampCalendar(byte[] byte_int, java.util.Calendar c)
           
 XSQLVAR deepCopy()
          Get a deep copy of this object.
 byte[] encodeBoolean(boolean value)
          Encodes boolean to 1 byte data.
 byte[] encodeDate(java.sql.Date d)
          Encode a Date value into a byte array.
 java.sql.Date encodeDate(java.sql.Date d, java.util.Calendar cal)
          Encode a given Date value using a given Calendar.
 byte[] encodeDateCalendar(java.sql.Date d, java.util.Calendar c)
           
 byte[] encodeDouble(double value)
          Encode a double value as a byte array.
 byte[] encodeFloat(float value)
          Encode a float value as a byte array.
 byte[] encodeInt(int value)
          Encode an int value as a byte array.
 byte[] encodeLocalDate(int year, int month, int day)
          Encodes a java.time.LocalDate equivalent to date bytes.
 byte[] encodeLocalDateTime(int year, int month, int day, int hour, int minute, int second, int nanos)
          Encodes a java.time.LocalDateTime equivalent to timestamp bytes.
 byte[] encodeLocalTime(int hour, int minute, int second, int nanos)
          Encodes a java.time.LocalTime equivalent to time bytes.
 byte[] encodeLong(long value)
          Encode a long value as a byte array.
 byte[] encodeShort(short value)
          Encode a short value as a byte array.
 byte[] encodeString(byte[] value, java.lang.String encoding, java.lang.String mappingPath)
          Encode a byte array using a given encoding.
 byte[] encodeString(java.lang.String value, java.lang.String encoding, java.lang.String mappingPath)
          Encode a String value into a byte array using a given encoding.
 byte[] encodeTime(java.sql.Time d)
          Encode a Time value into a byte array.
 java.sql.Time encodeTime(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)
          Encode a given Time value using a given Calendar.
 byte[] encodeTimeCalendar(java.sql.Time d, java.util.Calendar c)
           
 byte[] encodeTimestamp(java.sql.Timestamp value)
          Encode a Timestamp as a byte array.
 java.sql.Timestamp encodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal)
          Encode a Timestamp using a given Calendar.
 java.sql.Timestamp encodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)
          Encode a Timestamp using a given Calendar.
 byte[] encodeTimestampCalendar(java.sql.Timestamp value, java.util.Calendar c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqltype

public int sqltype

sqlscale

public int sqlscale

sqlsubtype

public int sqlsubtype

sqllen

public int sqllen

sqldata

public byte[] sqldata

cachedobject

public java.lang.Object cachedobject

sqlname

public java.lang.String sqlname

relname

public java.lang.String relname

relaliasname

public java.lang.String relaliasname

ownname

public java.lang.String ownname

aliasname

public java.lang.String aliasname

coder

protected org.firebirdsql.encodings.Encoding coder
Constructor Detail

XSQLVAR

public XSQLVAR()
Method Detail

deepCopy

public XSQLVAR deepCopy()
Get a deep copy of this object.

Returns:
deep copy of this object.

copyFrom

public void copyFrom(XSQLVAR original)
Copy constructor. Initialize this instance of XSQLVAR with values from another instance.

Parameters:
original - The other instance of XSQLVAR to be used as the base for initializing this instance

copyFrom

public void copyFrom(XSQLVAR original,
                     boolean copyData)
Copy constructor. Initialize this instance of XSQLVAR with values from another instance.

Parameters:
original - The other instance of XSQLVAR to be used as the base for initializing this instance

encodeShort

public byte[] encodeShort(short value)
Encode a short value as a byte array.

Parameters:
value - The value to be encoded
Returns:
The value of value encoded as a byte array

decodeShort

public short decodeShort(byte[] byte_int)
Decode a byte array into a short value.

Parameters:
byte_int - The byte array to be decoded
Returns:
The short value of the decoded byte array

encodeInt

public byte[] encodeInt(int value)
Encode an int value as a byte array.

Parameters:
value - The value to be encoded
Returns:
The value of value encoded as a byte array

decodeInt

public int decodeInt(byte[] byte_int)
Decode a byte array into an int value.

Parameters:
byte_int - The byte array to be decoded
Returns:
The int value of the decoded byte array

encodeLong

public byte[] encodeLong(long value)
Encode a long value as a byte array.

Parameters:
value - The value to be encoded
Returns:
The value of value encoded as a byte array

decodeLong

public long decodeLong(byte[] byte_int)
Decode a byte array into a long value.

Parameters:
byte_int - The byte array to be decoded
Returns:
The long value of the decoded byte array

encodeFloat

public byte[] encodeFloat(float value)
Encode a float value as a byte array.

Parameters:
value - The value to be encoded
Returns:
The value of value encoded as a byte array

decodeFloat

public float decodeFloat(byte[] byte_int)
Decode a byte array into a float value.

Parameters:
byte_int - The byte array to be decoded
Returns:
The float value of the decoded byte array

encodeDouble

public byte[] encodeDouble(double value)
Encode a double value as a byte array.

Parameters:
value - The value to be encoded
Returns:
The value of value encoded as a byte array

decodeDouble

public double decodeDouble(byte[] byte_int)
Decode a byte array into a double value.

Parameters:
byte_int - The byte array to be decoded
Returns:
The double value of the decoded byte array

encodeString

public byte[] encodeString(java.lang.String value,
                           java.lang.String encoding,
                           java.lang.String mappingPath)
                    throws java.sql.SQLException
Encode a String value into a byte array using a given encoding.

Parameters:
value - The String to be encoded
encoding - The encoding to use in the encoding process
mappingPath - The character mapping path to be used in the encoding
Returns:
The value of value as a byte array
Throws:
java.sql.SQLException - if the given encoding cannot be found, or an error occurs during the encoding

encodeString

public byte[] encodeString(byte[] value,
                           java.lang.String encoding,
                           java.lang.String mappingPath)
                    throws java.sql.SQLException
Encode a byte array using a given encoding.

Parameters:
value - The byte array to be encoded
encoding - The encoding to use in the encoding process
mappingPath - The character mapping path to be used in the encoding
Returns:
The value of value encoded using the given encoding
Throws:
java.sql.SQLException - if the given encoding cannot be found, or an error occurs during the encoding

decodeString

public java.lang.String decodeString(byte[] value,
                                     java.lang.String encoding,
                                     java.lang.String mappingPath)
                              throws java.sql.SQLException
Decode an encoded byte array into a String using a given encoding.

Parameters:
value - The value to be decoded
encoding - The encoding to be used in the decoding process
mappingPath - The character mapping path to be used in the decoding
Returns:
The decoded String
Throws:
java.sql.SQLException - if the given encoding cannot be found, or an error occurs during the decoding

encodeTimestamp

public java.sql.Timestamp encodeTimestamp(java.sql.Timestamp value,
                                          java.util.Calendar cal)
Encode a Timestamp using a given Calendar.

Parameters:
value - The Timestamp to be encoded
cal - The Calendar to be used for encoding, may be null

encodeTimestamp

public java.sql.Timestamp encodeTimestamp(java.sql.Timestamp value,
                                          java.util.Calendar cal,
                                          boolean invertTimeZone)
Encode a Timestamp using a given Calendar.

Parameters:
value - The Timestamp to be encoded
cal - The Calendar to be used for encoding, may be null
invertTimeZone - If true, the timezone offset value will be subtracted from the encoded value, otherwise it will be added
Returns:
The encoded Timestamp

encodeTimestamp

public byte[] encodeTimestamp(java.sql.Timestamp value)
Encode a Timestamp as a byte array.

Parameters:
value - The Timestamp to be encoded
Returns:
The array of bytes that represents the given Timestamp value

encodeTimestampCalendar

public byte[] encodeTimestampCalendar(java.sql.Timestamp value,
                                      java.util.Calendar c)

decodeTimestamp

public java.sql.Timestamp decodeTimestamp(java.sql.Timestamp value,
                                          java.util.Calendar cal)
Decode a Timestamp value using a given Calendar.

Parameters:
value - The Timestamp to be decoded
cal - The Calendar to be used in decoding, may be null
Returns:
The decoded Timestamp

decodeTimestamp

public java.sql.Timestamp decodeTimestamp(java.sql.Timestamp value,
                                          java.util.Calendar cal,
                                          boolean invertTimeZone)
Decode a Timestamp value using a given Calendar.

Parameters:
value - The Timestamp to be decoded
cal - The Calendar to be used in decoding, may be null
invertTimeZone - If true, the timezone offset value will be subtracted from the decoded value, otherwise it will be added
Returns:
The encoded Timestamp

decodeTimestamp

public java.sql.Timestamp decodeTimestamp(byte[] byte_int)
Decode a byte array into a Timestamp.

Parameters:
byte_int - The byte array to be decoded
Returns:
A Timestamp value from the decoded bytes

decodeTimestampCalendar

public java.sql.Timestamp decodeTimestampCalendar(byte[] byte_int,
                                                  java.util.Calendar c)

encodeTime

public java.sql.Time encodeTime(java.sql.Time d,
                                java.util.Calendar cal,
                                boolean invertTimeZone)
Encode a given Time value using a given Calendar.

Parameters:
d - The Time to be encoded
cal - The Calendar to be used in the encoding, may be null
Returns:
The encoded Time

encodeTime

public byte[] encodeTime(java.sql.Time d)
Encode a Time value into a byte array.

Parameters:
d - The Time to be encoded
Returns:
The array of bytes representing the given Time

encodeTimeCalendar

public byte[] encodeTimeCalendar(java.sql.Time d,
                                 java.util.Calendar c)

decodeTime

public java.sql.Time decodeTime(java.sql.Time d,
                                java.util.Calendar cal,
                                boolean invertTimeZone)
Decode a Time value using a given Calendar.

Parameters:
d - The Time to be decoded
cal - The Calendar to be used in the decoding, may be null
Returns:
The decooded Time

decodeTime

public java.sql.Time decodeTime(byte[] int_byte)
Decode a byte array into a Time value.

Parameters:
int_byte - The byte array to be decoded
Returns:
The decoded Time

decodeTimeCalendar

public java.sql.Time decodeTimeCalendar(byte[] int_byte,
                                        java.util.Calendar c)

encodeDate

public java.sql.Date encodeDate(java.sql.Date d,
                                java.util.Calendar cal)
Encode a given Date value using a given Calendar.

Parameters:
d - The Date to be encoded
cal - The Calendar to be used in the encoding, may be null
Returns:
The encoded Date

encodeDate

public byte[] encodeDate(java.sql.Date d)
Encode a Date value into a byte array.

Parameters:
d - The Date to be encoded
Returns:
The array of bytes representing the given Date

encodeDateCalendar

public byte[] encodeDateCalendar(java.sql.Date d,
                                 java.util.Calendar c)

decodeDate

public java.sql.Date decodeDate(java.sql.Date d,
                                java.util.Calendar cal)
Decode a Date value using a given Calendar.

Parameters:
d - The Date to be decoded
cal - The Calendar to be used in the decoding, may be null
Returns:
The decoded Date

decodeDate

public java.sql.Date decodeDate(byte[] byte_int)
Decode a byte array into a Date value.

Parameters:
byte_int - The byte array to be decoded
Returns:
The decoded Date

decodeDateCalendar

public java.sql.Date decodeDateCalendar(byte[] byte_int,
                                        java.util.Calendar c)

decodeBoolean

public boolean decodeBoolean(byte[] data)
Decode boolean from supplied data.

Parameters:
data - (expected) 1 bytes
Returns:
false when 0, true for all other values

encodeBoolean

public byte[] encodeBoolean(boolean value)
Encodes boolean to 1 byte data.

Parameters:
value - Boolean value to encode
Returns:
true as 1, false as 0.

encodeLocalTime

public byte[] encodeLocalTime(int hour,
                              int minute,
                              int second,
                              int nanos)
Encodes a java.time.LocalTime equivalent to time bytes.

Parameters:
hour - Number of hours (is assumed to be 0..23)
minute - Number of minutes (is assumed to be 0..59)
second - Number of seconds (is assumed to be 0..59)
nanos - Sub-second nanoseconds (actual resolution is 100 microseconds, is assumed to be 0 .. 10^9 - 1 ns)
Returns:
Byte array for time

encodeLocalDate

public byte[] encodeLocalDate(int year,
                              int month,
                              int day)
Encodes a java.time.LocalDate equivalent to date bytes.

Parameters:
year - Year
month - Month (is assumed to be 1..12)
day - Day (is assumed to be valid for year and month)
Returns:
Byte array for date

encodeLocalDateTime

public byte[] encodeLocalDateTime(int year,
                                  int month,
                                  int day,
                                  int hour,
                                  int minute,
                                  int second,
                                  int nanos)
Encodes a java.time.LocalDateTime equivalent to timestamp bytes.

Parameters:
year - Year
month - Month (is assumed to be 1..12)
day - Day (is assumed to be valid for year and month)
hour - Number of hours (is assumed to be 0..23)
minute - Number of minutes (is assumed to be 0..59)
second - Number of seconds (is assumed to be 0..59)
nanos - Sub-second nanoseconds (actual resolution is 100 microseconds, is assumed to be 0 .. 10^9 - 1 ns)
Returns:
Byte array for timestamp


Copyright © 2001-2019 Jaybird (Firebird JDBC/JCA) team. All rights reserved.