Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> ODBC binding to C++ long int

ODBC binding to C++ long int

From: Steve Owens <sowens_at_coop-tech.com>
Date: 17 Jun 1998 11:15:21 GMT
Message-ID: <01bd99e1$3808bcf0$6e16e426@owens_nt>


We are trying to add Oracle support for our VC++ 1.52 app that uses ODBC. It's native database is Access 2.0, with support for SQL Server, Sybase, and Access97. We are brand new to Oracle and have installed 8.04. We used the supplied program to convert an Access database and are having trouble with ints, particularly those defined as either short or long.

There seems to be some disagreement between ODBC drivers as to interpretation of the NUMBER datatype. In our app, the MFC RFX_Long function expects to see an ANSI type of 4 or SQL_INTEGER to correspond to a C long int type, or it refuses to bind the column.

Here's what we've found in trying to get the function SQLDescribeCol() to recognize the column in question as an SQL_INTEGER. The Oracle 32-bit ODBC drivers of recent vintage return different values, as follows:

Column def. ODBC ver. Returned type


NUMBER(0,0)   8.0.4.0   6 - SQL_FLOAT
NUMBER(0,0)   8.0.4.4   8 - SQL_DOUBLE
NUMBER(10,0)  8.0.4.0   4 - SQL_INTEGER  (what the app needs!)
NUMBER(10,0)  8.0.4.4   3 - SQL_DECIMAL

Most other column definitions are described as SQL_DECIMAL. In fact, only NUMBER(5,0) is recognized as SQL_SMALLINT, and then only by 8.0.4.4. All other drivers call this a SQL_DECIMAL.

This would not be such a problem save that when using 8.0.4.0, Crystal Reports fails to use tables with an underscore in the name (e.g. "LB_Address"). Since that API is our compiled-in reporting mechanism, we would like to have both features working at once :^)

We have also tried other drivers, Microsoft MSORCL32.DLL 2.73.7356, Visigenic VSORAC32.DLL 2.00.0300. These describe a NUMBER(10,0) as SQL_DECIMAL and therefore also fail to bind the column.

What options do we have? Is there a way to define a column that will reliably cause ODBC to treat it as a long or short int? Are 3rd-party drivers better at differentiating between datatypes?

Thanks for any leads.

--
Steve Owens
Cooperative Technologies, Inc.
http://www.coop-tech.com Received on Wed Jun 17 1998 - 06:15:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US