How Informix Stored LONG data type?
Posted in 2000
Topics: Server Administration, Data Types & Schema Design
Hi,
Does anyone know how informix stored long data type value? As i
understand that informix has only SMALLINT and INTEGER which correspond
to short and long in C data types. Besides, how to translate/decipher
the value stored in informix to C long data type value using dbaccess so
that i can verify the value stored in informix database is correct?
Best regards
kitming
9.x has int-8 (64 bit).
Prior versions had
int (32 bit)
smallint (16 bit)
Kit Ming wrote:
> Hi,
>
> Does anyone know how informix stored long data type value? As i
> understand that informix has only SMALLINT and INTEGER which correspond
> to short and long in C data types. Besides, how to translate/decipher
> the value stored in informix to C long data type value using dbaccess so
> that i can verify the value stored in informix database is correct?
>
> Best regards
> kitming
Hi,
I have an unsigned long integer data type variable in ESQL/C code and would
like to store this variable in one of the informix table. What data type
should i use when creating the column for this variable?
Hope to hear from you, thanks!
kitming
Kit Ming wrote:
> Hi,
>
> Does anyone know how informix stored long data type value? As i
> understand that informix has only SMALLINT and INTEGER which correspond
> to short and long in C data types. Besides, how to translate/decipher
> the value stored in informix to C long data type value using dbaccess so
> that i can verify the value stored in informix database is correct?
>
> Best regards
> kitming
Kit Ming wrote:
> Hi,
>
> I have an unsigned long integer data type variable in ESQL/C code and would
> like to store this variable in one of the informix table. What data type
> should i use when creating the column for this variable?
>
> Hope to hear from you, thanks!
> kitming
You will need to use DECIMAL(10,0) to store an unsigned long as it has a max.
value of 4294967296.
Rudy
>
>
> Kit Ming wrote:
>
> > Hi,
> >
> > Does anyone know how informix stored long data type value? As i
> > understand that informix has only SMALLINT and INTEGER which correspond
> > to short and long in C data types. Besides, how to translate/decipher
> > the value stored in informix to C long data type value using dbaccess so
> > that i can verify the value stored in informix database is correct?
> >
> > Best regards
> > kitming
Kit Ming wrote:
>
> Hi,
>
> I have an unsigned long integer data type variable in ESQL/C code and would
> like to store this variable in one of the informix table. What data type
> should i use when creating the column for this variable?
You CAN use INTEGER, which is signed, if you are only accessing it from
ESQL/C and are willing to live with losing the use of ULONG_MAX which
Informix uses internally as the NULL value indicator. In dbaccess values
over LONG_MAX will show as negative values so you will not be able to
verify data that way. In ESQL/C just use DESCRIBE and point the
sqlda.sqlvar.sqldata pointer to your unsigned long and the sqltype field to
CLONGTYPE and it will work fine.
If you do not want to sacrifice dbaccess access to the column's data or the
high value use DECIMAL(10,0) instead. You can still fetch it into an
unsigned long using DESCRIBE so that you can avoid dealing with the DECIMAL
functions if you want to.
Art S. Kagel
> Hope to hear from you, thanks!
> kitming
>
> Kit Ming wrote:
>
> > Hi,
> >
> > Does anyone know how informix stored long data type value? As i
> > understand that informix has only SMALLINT and INTEGER which correspond
> > to short and long in C data types. Besides, how to translate/decipher
> > the value stored in informix to C long data type value using dbaccess so
> > that i can verify the value stored in informix database is correct?
> >
> > Best regards
> > kitming