BUG SOLVED : [unixODBC-support] Re: Postgres 7.2 SQL_C_DOUBLE

Roger M Strandberg / Unisoft roger.strandberg at unisoft.se
Thu Aug 12 20:52:09 BST 2004


Hi


I'm sorry for the problem with so many email, but i have a deadline.


Thow i think i found the bug.

( remark: I'm a rather novis programmer, don't know CVS or how patch work.)
(             I'm a flow programmer, and works maily with preformance problem.)


in pgtypes.c

Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type)
{
  alskdjlaKSJDLAJSLDÖJALSDJLASDJFLAS
  ......

        case PG_TYPE_FLOAT4:        return SQL_REAL;
        case PG_TYPE_FLOAT8:        return SQL_FLOAT;

  ALSKFJLDAJFLASJDFLÖJSADLFSD
}

Here the problem lay's, some how the driver get's to now the wrong type for a FLOAT8.

I don't even know what this function do.

but to change the line to:

Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type)
{
  alskdjlaKSJDLAJSLDÖJALSDJLASDJFLAS
  ......

        case PG_TYPE_FLOAT4:        return SQL_REAL;
        case PG_TYPE_FLOAT8:        return SQL_DOUBLE;

  ALSKFJLDAJFLASJDFLÖJSADLFSD
}

Makes the driver to return 8 with the SQLDescribeCol.

Actually

The SQLDescribeCol say's that a BIGINT in database is '-5'
but SQL_C_BIGINT is -25, so if i don't do SQLDescribeCol before SQLGetData or SQLBindCol
then BIGINT does not work.
Perhaps BIGINT has the same fault as float8.


This what float8 thing was found on unixODBC-2.2.9


Thanks for a GREAT PRODUCT!!!


/Roger
Sweden















  ----- Original Message ----- 
  From: Roger M Strandberg / Unisoft 
  To: Support for the unixODBC project 
  Sent: Thursday, August 12, 2004 12:47 PM
  Subject: Re: [unixODBC-support] Re: Postgres 7.2 SQL_C_DOUBLE 


  More info:

  The driver reports 
  via SQLDescribeCol
  that  the DataType for float8 is 6 => SQL_FLOAT and not SQL_DOUBLE = 8.
  But the size is 15, but that is same for both......

  /R

    ----- Original Message ----- 
    From: Roger M Strandberg / Unisoft 
    To: Support for the unixODBC project 
    Sent: Thursday, August 12, 2004 8:00 AM
    Subject: Re: [unixODBC-support] Re: Postgres 7.2 SQL_C_DOUBLE 


    Hehe

    Okej i found out a way that works.
    If i uses float in my application and float4 in sql and SQL_C_DOUBLE.

    Then I get 1.1 from database.

    If I use double in my application the it becomes some thing really small.

    if i uses float8 in sql then i can't Fetch.

    i se in the connect.c that it's uses atof() for both double and float.

    Some thing is wrong or i'm just don't do it ringt.

    /Roger 



      ----- Original Message ----- 
      From: Roger M Strandberg / Unisoft 
      To: Support for the unixODBC project 
      Sent: Thursday, August 12, 2004 7:02 AM
      Subject: Re: [unixODBC-support] Re: Postgres 7.2 SQL_C_DOUBLE 


      I have more info now.

      If i only run float8, and nothing else, then i some times get it to run.

      I don't change any thing then it run, i recompile it, the it don't work.
      I just add ar line att begining and takes it away.

      Could all this have somthing with g++ ?

      I'm running FreeBSD 4.7

      I tested it on a 4.9 but then i got "Broken Pipe".

      Any one have those problems before?
      /R

        ----- Original Message ----- 
        From: Roger M Strandberg / Unisoft 
        To: Support for the unixODBC project 
        Sent: Thursday, August 12, 2004 6:20 AM
        Subject: [unixODBC-support] Re: Postgres 7.2 SQL_C_DOUBLE 


        More info:

        -bash-2.05b$ ./test_bigint
        error: unable to fetch data
        RecNumber:1
        SQLSTATE:07006
        NativeErrorptr:14
        MessageText:[unixODBC]Received an unsupported type from Postgres.
        RecNumber:2
        SQLSTATE:00000
        NativeErrorptr:14
        MessageText:[unixODBC]Received an unsupported type from Postgres.


        Any one????

        /R

          ----- Original Message ----- 
          From: Roger M Strandberg / Unisoft 
          To: Support for the unixODBC project 
          Sent: Thursday, August 12, 2004 5:51 AM
          Subject: Postgres 7.2 SQL_C_DOUBLE 


          Hello

          I have a problem to bind and fetch SQL_C_DOUBLE from a database.

          I have this table
          CREATE TABLE "test" (
                  "test_long" bigint,
                  "test_int" integer,
                  "test_float" double precision
          );

          int and bigint goes just fine, but when i come to SQL_C_DOUBLE then the SQL_Fetch gives SQL_ERROR

          How should i found out whats wrong?

          /Roger


------------------------------------------------------------------------


        _______________________________________________
        unixODBC-support mailing list
        unixODBC-support at mail.easysoft.com
        http://mail.easysoft.com/mailman/listinfo/unixodbc-support



--------------------------------------------------------------------------


      _______________________________________________
      unixODBC-support mailing list
      unixODBC-support at mail.easysoft.com
      http://mail.easysoft.com/mailman/listinfo/unixodbc-support



----------------------------------------------------------------------------


    _______________________________________________
    unixODBC-support mailing list
    unixODBC-support at mail.easysoft.com
    http://mail.easysoft.com/mailman/listinfo/unixodbc-support



------------------------------------------------------------------------------


  _______________________________________________
  unixODBC-support mailing list
  unixODBC-support at mail.easysoft.com
  http://mail.easysoft.com/mailman/listinfo/unixodbc-support
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20040812/636cc191/attachment.html>


More information about the unixODBC-support mailing list