Results 1 to 7 of 7

Thread: Odbc

  1. #1
    Join Date
    May 2003
    Posts
    4

    Unanswered: Odbc

    Hello everyone,
    Newbie here,

    Got a question of course. I have searched the forum and found a few answers, but there is one that just does not seem to get answered. In C++/ODBC, there is are a few functions that will return information about a result set(ex. SQLDescribeCol, and SQLColAttribute). The problem is that most of the values, namely the data type is returned as a Numeric Pointer. It is returned as a number. How do I know what data type each number represents? Is there a chart somewhere that tells that? I need to know so I can make the necessary conversion to C data types. I know I can use SQL_C_CHAR as a substitute for most of the data types, but that is just a workaround. I want to do this correctly, and besides, it will give me more flexability. Any suggestions?????

    Thanks a million,
    Kendal

  2. #2
    Join Date
    May 2003
    Posts
    4
    Does anyone have any suggestions????
    Can anyone help me?????
    I have not received a reply from any of the forums I posted this question on.

    Thanks,
    Kendal

  3. #3
    Join Date
    Sep 2002
    Location
    Montreal, Canada
    Posts
    224
    Provided Answers: 1
    Originally posted by gvector1
    Does anyone have any suggestions????
    Can anyone help me?????
    I have not received a reply from any of the forums I posted this question on.

    Thanks,
    Kendal
    Probably included the source or documents that come with it...

    http://mysql.planetmirror.com/downlo...odbc-3.51.html

    Hope this helps.

  4. #4
    Join Date
    May 2003
    Posts
    4
    I appreciate the reply. I already have MYSQL ODBC 3.51 installed and configured. It works fine. I also have been through the ODBC documentation thoroughly, even on MSDN, and cannot find an answer to my question. If you go to the MSDN website

    http://msdn.microsoft.com/library/de...odch10pr_7.asp

    , it has a sample program there that is doing what I want to do. When using SQLBindCol, you have to know the data type in order to bind a variable with the result set column. The program is using SQLColAttribute to get the information from the statement handle. It then calls a function that is not documented "GetDefaultCType(SQLType)" to return the CType of the variable for the SQLType. I have tested teh SQLColAttribute and SQLDescribeCol functions and they return numeric values for the type parameter. QUESTION: How do I know what number stands for what variable type????????????????????

    Thanks,
    Kendal

  5. #5
    Join Date
    Sep 2002
    Location
    Montreal, Canada
    Posts
    224
    Provided Answers: 1

    ODBC Type values

    Originally posted by gvector1
    I appreciate the reply. I already have MYSQL ODBC 3.51 installed and configured. It works fine. I also have been through the ODBC documentation thoroughly, even on MSDN, and cannot find an answer to my question. If you go to the MSDN website

    http://msdn.microsoft.com/library/de...odch10pr_7.asp

    , it has a sample program there that is doing what I want to do. When using SQLBindCol, you have to know the data type in order to bind a variable with the result set column. The program is using SQLColAttribute to get the information from the statement handle. It then calls a function that is not documented "GetDefaultCType(SQLType)" to return the CType of the variable for the SQLType. I have tested teh SQLColAttribute and SQLDescribeCol functions and they return numeric values for the type parameter. QUESTION: How do I know what number stands for what variable type????????????????????

    Thanks,
    Kendal


    Did check some Smalltalk source code (Squeak environment) here and here it goes...


    -11 GUID
    -10 WLongVarChar
    -9 WVarChar
    -8 WChar
    -7 Bit
    -6 TinyInt
    -5 BigInt
    -4 LongVarBinary
    -3 VarBinary
    -2 Binary
    -1 LongVarChar
    0 TypeNull
    1 Char
    2 Numeric
    3 Decimal
    4 Integer
    5 SmallInt
    6 Float
    7 Real
    8 Double
    9 Date
    10 Time
    11 Timestamp
    12 VarChar

    Hope this helps!

  6. #6
    Join Date
    May 2003
    Posts
    4
    That is WONDERFUL!!!!!!!!!!!
    Thank you!
    I have run through and checked the list with the output I get from my program and MYSQL DB and everthing checks out except for a few things. So I will ask those questions.

    My database makes use of only a few types:
    int
    varchar
    char
    date
    bigint
    date
    decimal

    I was only able to test with these types. I tested using the SQLDescribe and SQLColAttribute functions. Both functions returned the correct values for all the variable types except for BigInt and Date
    SQLDescribeCol SQLColAttribute
    BigInt -5 FFFFFFFB
    Date 91 0000005B

    Any idea why I would get those values, especially the ColAttribute value.

    Thanks a million
    Kendal

  7. #7
    Join Date
    Sep 2002
    Location
    Montreal, Canada
    Posts
    224
    Provided Answers: 1

    ODBC Type values

    Originally posted by gvector1
    That is WONDERFUL!!!!!!!!!!!
    Thank you!
    I have run through and checked the list with the output I get from my program and MYSQL DB and everthing checks out except for a few things. So I will ask those questions.

    My database makes use of only a few types:
    int
    varchar
    char
    date
    bigint
    date
    decimal

    I was only able to test with these types. I tested using the SQLDescribe and SQLColAttribute functions. Both functions returned the correct values for all the variable types except for BigInt and Date
    SQLDescribeCol SQLColAttribute
    BigInt -5 FFFFFFFB
    Date 91 0000005B

    Any idea why I would get those values, especially the ColAttribute value.

    Thanks a million
    Kendal
    No idea but there used to be a forum for ODBC driver developers on www.mysql.com . You might have an answer to all your questions there...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •