Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL_C_BIT selection support [ODBC61] #62

Closed
firebird-automations opened this issue Apr 21, 2009 · 7 comments
Closed

SQL_C_BIT selection support [ODBC61] #62

firebird-automations opened this issue Apr 21, 2009 · 7 comments

Comments

@firebird-automations
Copy link

Submitted by: Andrei Litvin (andy_asigra)

Microsoft MFC will perform RFX_BOOL by trying to bing a result column as a SQL_C_BIT. However the Firebird ODBC driver does create any conversions from some data type to SQL_C_BIT, resulting in a failed transfer. Not even converting to char(1) (which is documented as the bit data type alternative) works.

Commits: 138eaa9 adee1d4

@firebird-automations
Copy link
Author

Commented by: Andrei Litvin (andy_asigra)

Maybe not the nicest solution, however one possibility would be to allow conversion from numeric types to SQL_C_BIT. At least on Windows, the BOOL data type is used, which occupies a byte, and on Firebird TinyInt is one byte long as well. As such, this patch works:

Index: O:/devel/FirebirdODBC/OdbcConvert.cpp

--- O:/devel/FirebirdODBC/OdbcConvert.cpp (revision 50726)
+++ O:/devel/FirebirdODBC/OdbcConvert.cpp (revision 50727)
@@ -147,6 +147,7 @@
case SQL_C_TINYINT:
case SQL_C_UTINYINT:
case SQL_C_STINYINT:
+ case SQL_C_BIT:
bIdentity = true;
return &OdbcConvert::convTinyIntToTinyInt;
case SQL_C_SHORT:
@@ -191,6 +192,7 @@
case SQL_C_TINYINT:
case SQL_C_UTINYINT:
case SQL_C_STINYINT:
+ case SQL_C_BIT:
if ( from->scale || to->scale )
return &OdbcConvert::convShortToTinyIntWithScale;
return &OdbcConvert::convShortToTinyInt;
@@ -244,6 +246,7 @@
case SQL_C_TINYINT:
case SQL_C_UTINYINT:
case SQL_C_STINYINT:
+ case SQL_C_BIT:
if ( from->scale || to->scale )
return &OdbcConvert::convLongToTinyIntWithScale;
return &OdbcConvert::convLongToTinyInt;
@@ -291,6 +294,7 @@
case SQL_C_TINYINT:
case SQL_C_UTINYINT:
case SQL_C_STINYINT:
+ case SQL_C_BIT:
return &OdbcConvert::convFloatToTinyInt;
case SQL_C_SHORT:
case SQL_C_USHORT:
@@ -323,6 +327,7 @@
case SQL_C_TINYINT:
case SQL_C_UTINYINT:
case SQL_C_STINYINT:
+ case SQL_C_BIT:
return &OdbcConvert::convDoubleToTinyInt;
case SQL_C_SHORT:
case SQL_C_USHORT:
@@ -359,6 +364,7 @@
case SQL_C_TINYINT:
case SQL_C_UTINYINT:
case SQL_C_STINYINT:
+ case SQL_C_BIT:
return &OdbcConvert::convBigintToTinyInt;
case SQL_C_SHORT:
case SQL_C_USHORT:
@@ -401,6 +407,7 @@
case SQL_C_TINYINT:
case SQL_C_UTINYINT:
case SQL_C_STINYINT:
+ case SQL_C_BIT:
if ( to->isIndicatorSqlDa )
return &OdbcConvert::convTagNumericToTinyInt;
return &OdbcConvert::convNumericToTinyInt;

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

assignee: Alexander Potapchenko [ lightfore ]

@firebird-automations
Copy link
Author

Commented by: @alexpotapchenko

applied in CVS

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0.2 [ 10465 ]

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Resolved [ 5 ] => Reopened [ 4 ]

resolution: Fixed [ 1 ] =>

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Reopened [ 4 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants