Issue Details (XML | Word | Printable)

Key: ODBC-61
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Alexander Potapchenko
Reporter: Andrei Litvin
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ODBC Driver

SQL_C_BIT selection support

Created: 21/Apr/09 05:39 AM   Updated: 09/Jul/13 11:00 AM
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.0.2

Environment: Windows, MFC RFX functions


 Description  « Hide
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.

 All   Comments   Change History   Subversion Commits      Sort Order: Descending order - Click to sort in ascending order
Alexander Potapchenko added a comment - 14/Aug/12 12:04 PM
applied in CVS

Andrei Litvin added a comment - 21/Apr/09 05:41 AM
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;