Home > Archive > SQL Anywhere database > April 2005 > Re: Wrong datatype returned SQLGetTypeInfo()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Wrong datatype returned SQLGetTypeInfo()
Nick Elson

2005-03-31, 8:02 pm

I think I see the problem. Running this in ODBCTest from the SDK
reveals that function now returns multiple rows, of which you are only
looking at the first one

SQLGetTypeInfo:
In: StatementHandle = 0x003A1938, DataType = SQL_NUMERIC=2
Return: SQL_SUCCESS=0

Get Data All:
"TYPE_NAME", "DATA_TYPE", "COLUMN_SIZE", "LITERAL_PREFIX",
"LITERAL_SUFFIX", "CREATE_PARAMS", "NULLABLE", "CASE_SENSITIVE",
"SEARCHABLE", "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE", "AUTO_UNIQUE_VALUE",
"LOCAL_TYPE_NAME", "MINIMUM_SCALE", "MAXIMUM_SCALE", "SQL_DATA_TYPE",
"SQL_DATETIME_SUB", "NUM_PREC_RADIX", "INTERVAL_PRECISION"
"money", 2, 19, <Null>, <Null>, <Null>, 1, 0, 3, 0, 1, 0, "money", 4, 4,
2, <Null>, 10, <Null>
"numeric", 2, 20, <Null>, <Null>, "precision, scale", 1, 0, 3, 0, 0, 0,
"numeric", 0, <Null>, 2, <Null>, 10, <Null>
"smallmoney", 2, 10, <Null>, <Null>, <Null>, 1, 0, 3, 0, 1, 0,
"smallmoney", 4, 4, 2, <Null>, 10, <Null>
3 rows fetched from 19 columns.


So the SQLGetTypeInfo( 2 ) call to the 9.0.2 ODBC driver does return
"numeric" still, but as the **second result set row**. This is really not
much different for the version 7.0.4 (tested in build 3526) which returns
numeric 1st only but otherwise the result set is exactly the same:


Full Connect(Default)
Env. Attr. SQL_ATTR_ODBC_VERSIO
N set to SQL_OV_ODBC3

Successfully connected to DSN 'ASA 7.0 Sample'.
SQLGetTypeInfo:
In: StatementHandle = 0x003A1938, DataType = SQL_NUMERIC=2
Return: SQL_SUCCESS=0

Get Data All:
"TYPE_NAME", "DATA_TYPE", "COLUMN_SIZE", "LITERAL_PREFIX",
"LITERAL_SUFFIX", "CREATE_PARAMS", "NULLABLE", "CASE_SENSITIVE",
"SEARCHABLE", "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE", "AUTO_UNIQUE_VALUE",
"LOCAL_TYPE_NAME", "MINIMUM_SCALE", "MAXIMUM_SCALE", "SQL_DATA_TYPE",
"SQL_DATETIME_SUB", "NUM_PREC_RADIX", "INTERVAL_PRECISION"
"numeric", 2, 20, <Null>, <Null>, "precision, scale", 1, 0, 3, 0, 0, 0,
"numeric", 0, <Null>, 2, <Null>, 10, <Null>
"money", 3, 19, <Null>, <Null>, <Null>, 1, 0, 3, 0, 1, 0, "money", 4, 4,
3, <Null>, 10, <Null>
"smallmoney", 3, 10, <Null>, <Null>, <Null>, 1, 0, 3, 0, 1, 0,
"smallmoney", 4, 4, 3, <Null>, 10, <Null>
3 rows fetched from 19 columns.

While the type for money and smallmoney may have changed, the nature of the
call
has not.


HTH









<Peter Simonsen> wrote in message news:423edae3$3@foru
ms-2-dub...
> Our application moves data from one database to another based on a select.
>
> We use Win API ODBC32 calls to determine column datatypes in the select.
> These are then used to create a table on the destination database.
>
> When the client is connected to the server using an ASA7 connection,
> the api calls work just fine:
>
> numeric is returned as 2 from SQLColAttributes() and SQLGetTypeInfo(2)
> returns numeric
>
> However when connecting to the server using an ASA9 connection,
> SQLGetTypeInfo(2) returns money instead of numeric.
> Other datatypes seem be correct.
>
> Any help would be highly appreciated, as we need to solve this issue ASAP.
>
> regards/Peter Simonsen
>
> NB!
> The server was recently upgraded from ASA7 to ASA9.
> Continuing to use an ASA7 connection is not an option.
>
>



2005-04-15, 3:23 am

Thanks a million Nick!

We can make it work now, however I do have some questions that a quick
search on
the net didn't provide, but I'll start a new thread.

Thanks again!

"Nick Elson" < no_spam_nicelson@syb
ase.com> wrote in message
news:424c60ef$1@foru
ms-1-dub...
> I think I see the problem. Running this in ODBCTest from the SDK
> reveals that function now returns multiple rows, of which you are only
> looking at the first one
>
> SQLGetTypeInfo:

:
:
> While the type for money and smallmoney may have changed, the nature of

the
> call has not.



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com