microsoft / ODBC-Specification

Microsoft ODBC Specification
Other
121 stars 40 forks source link

The Data type has been returned as -5 for count(*) in PostgreSQL #131

Open jaydeept opened 6 years ago

jaydeept commented 6 years ago

Hello,

I am running below query with PostgreSQL database.

select count(*) "bcount" from ABC;

When I call the function SQLDescribeCol, it returns me -5 as the type which isn't mapped to anything. Any idea what's going wrong?

edwig commented 6 years ago

Hello jaydeep,

Most probably because in ODBC 3.x and higher you get a

Added to your datatype. In case your database DOES recognize the difference (And PostgreSQL does!) and in case you are using the newer interface (see the login options) you can get anything from -1 to -21 for an answer.

And keep in mind: the new INTERVAL types range from -80 to -93

And other newer datatypes are using negative types

If everything went well: -5 corresponds to SQLBIGINT. So an integer with 64 bits.

See the header in your development kit.

So that is most probably your answer for “bcount”

Edwig Huisman

Van: jaydeep notifications@github.com Verzonden: maandag 23 april 2018 15:18 Aan: Microsoft/ODBC-Specification ODBC-Specification@noreply.github.com CC: Subscribed subscribed@noreply.github.com Onderwerp: [Microsoft/ODBC-Specification] The Data type has been returned as -5 for count(*) in PostgreSQL (#131)

Hello,

I am running below query with PostgreSQL database.

select count(*) "bcount" from ABC;

When I call the function SQLDescribeCol, it returns me -5 as the type which isn't mapped to anything. Any idea what's going wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/ODBC-Specification/issues/131 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEo5b9UFBsR43J7sGR36Ki8yI19pFym0ks5trdR7gaJpZM4Tf4G- . https://github.com/notifications/beacon/AEo5b0wp8o60TXiY6LDSQZwseh-Retd9ks5trdR7gaJpZM4Tf4G-.gif


Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. https://www.avast.com/antivirus

jaydeept commented 6 years ago

Thanks for reply @edwig ,

I am having this kind of file in my source code (it's really old C++ code). I am not seeing -5 is mapped to anything in that.