Thread: Numeric data type conversion in from CT-Lib to ODBC

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    5

    Numeric data type conversion in from CT-Lib to ODBC

    Hi
    I am working on migration project. C application having ODBC layer to access SQL server.
    My application get data from SQL server to ODBC data type and then convert ODBC data type to CT-library data type. This way I only need to change data access layer to achive migration from Sybase to Sql Server
    In Conversion from ODBC to CT-Library types, I am getting error in Numeric type. The numeric type defination is as follow:
    ODBC defination
    Code:
    #define SQL_MAX_NUMERIC_LEN		16typedef struct tagSQL_NUMERIC_STRUCT{	SQLCHAR		precision;	SQLSCHAR	scale;	SQLCHAR		sign;	/* 1 if positive, 0 if negative */	SQLCHAR		val[SQL_MAX_NUMERIC_LEN];} SQL_NUMERIC_STRUCT;
    Sybase CT-Lib defination:

    Code:
    typedef struct _cs_numeric{	CS_BYTE		precision;	CS_BYTE		scale;	CS_BYTE		array[CS_MAX_NUMLEN];} CS_NUMERIC;

    I am trying to convert each variable of struct but conversion is unsuccessful.

    how can I convert value from SQL_NUMERIC_STRUCT to CS_NUMERIC type?


    I am able to get value from MS SQl server succesesfully in long format. Can I assign this value to "array" field in CS_NUMERIC struct?

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    396
    Can you post your conversion code?
    Why is it "unsuccessful"?
    the structure definitions look close enough to allow a conversion without too much problem I guess.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data type conversion issue
    By SDhiraj in forum C Programming
    Replies: 3
    Last Post: 07-02-2012, 06:41 AM
  2. Replies: 3
    Last Post: 02-26-2008, 02:12 PM
  3. only accept numeric data
    By willc0de4food in forum Windows Programming
    Replies: 6
    Last Post: 08-19-2005, 03:38 AM
  4. ODBC Local Data source?
    By Robert602 in forum Windows Programming
    Replies: 1
    Last Post: 01-21-2002, 10:33 AM
  5. conversion for binary data type
    By DMaxJ in forum C++ Programming
    Replies: 2
    Last Post: 10-23-2001, 12:57 PM

Tags for this Thread