Package: libgnadeodbc1.6.1
Version: 1.6.1-2lenny1
Severity: normal
Tags: patch

*** Please type your report below this line ***
The generic versions of SQLBindCol and SQLBindParameter in 
GNU.DB.SQLCLI.IntegerBinding compare the sizes of subtypes instead of the size 
of the actual object that was passed in. If I instantiate a package like this:

   package Natural_Binding is new IntegerBinding(Natural);

then I get a Constraint_Error because SQLBindCol and SQLBindParameter expect 
the subtype's size to be 8, 16, 32 or 64, but Natural'Size is 31. Checking the 
size of the object would work better. If I declare "N : Natural" then N'Size 
is 32, so it will be treated as an SQLINTEGER.

Upstream report:
http://sf.net/tracker/?func=detail&aid=1875874&group_id=23045&atid=377333

--- dbi/odbc/gnu-db-sqlcli.gpb.orig     2008-01-19 23:08:19.000000000 +0100
+++ dbi/odbc/gnu-db-sqlcli.gpb  2008-01-20 02:33:11.000000000 +0100
@@ -826,14 +826,15 @@
                           return SQLRETURN;
          pragma Import ($CALLCONVENTION, BindCol, "SQLBindCol");
          DT  : SQL_C_DATA_TYPE;
+         Size : constant Positive := TargetValue.all'Size;
       begin
-         if Int'Size = SQLTINYINT'Size then
+         if Size = SQLTINYINT'Size then
             DT := SQL_C_TINYINT;
-         elsif Int'Size = SQLSMALLINT'Size then
+         elsif Size = SQLSMALLINT'Size then
             DT := SQL_C_SHORT;
-         elsif Int'Size = SQLINTEGER'Size then
+         elsif Size = SQLINTEGER'Size then
             DT := SQL_C_LONG;
-         elsif Int'Size = SQLBIGINT'Size then
+         elsif Size = SQLBIGINT'Size then
             DT := SQL_C_SBIGINT;
          else
             raise Constraint_Error;
@@ -842,7 +843,7 @@
                          ColumnNumber,
                          DT,
                          TargetValue,
-                         SQLINTEGER (Int'Size / 8),
+                         SQLINTEGER (Size / 8),
                          IndPtr);
       end SQLBindCol;

@@ -872,20 +873,21 @@
          C_DataType   : SQL_C_DATA_TYPE;
          SQL_DataType : SQL_DATA_TYPE;
          ColumnSize   : SQLUINTEGER;
+         Size         : constant Positive := Value.all'Size;
       begin
-         if Int'Size = SQLTINYINT'Size then
+         if Size = SQLTINYINT'Size then
             C_DataType   := SQL_C_TINYINT;
             SQL_DataType := SQL_TINYINT;
             ColumnSize   := 3;
-         elsif Int'Size = SQLSMALLINT'Size then
+         elsif Size = SQLSMALLINT'Size then
             C_DataType   := SQL_C_SHORT;
             SQL_DataType := SQL_SMALLINT;
             ColumnSize   := 5;
-         elsif Int'Size = SQLINTEGER'Size then
+         elsif Size = SQLINTEGER'Size then
             C_DataType   := SQL_C_LONG;
             SQL_DataType := SQL_INTEGER;
             ColumnSize   := 10;
-         elsif Int'Size = SQLBIGINT'Size then
+         elsif Size = SQLBIGINT'Size then
             C_DataType   := SQL_C_SBIGINT;
             SQL_DataType := SQL_BIGINT;
             ColumnSize   := 19;
@@ -939,14 +941,15 @@
                           return SQLRETURN;
          pragma Import ($CALLCONVENTION, BindCol, "SQLBindCol");
          DT  : SQL_C_DATA_TYPE;
+         Size : constant Positive := TargetValue.all'Size;
       begin
-         if Unsigned'Size = SQLTINYINT'Size then
+         if Size = SQLTINYINT'Size then
             DT := SQL_C_UTINYINT;
-         elsif Unsigned'Size = SQLSMALLINT'Size then
+         elsif Size = SQLSMALLINT'Size then
             DT := SQL_C_USHORT;
-         elsif Unsigned'Size = SQLINTEGER'Size then
+         elsif Size = SQLINTEGER'Size then
             DT := SQL_C_ULONG;
-         elsif Unsigned'Size = SQLBIGINT'Size then
+         elsif Size = SQLBIGINT'Size then
             DT := SQL_C_UBIGINT;
          else
             raise Constraint_Error;
@@ -955,7 +958,7 @@
                          ColumnNumber,
                          DT,
                          TargetValue,
-                         SQLINTEGER (Unsigned'Size / 8),
+                         SQLINTEGER (Size / 8),
                          IndPtr);

       end SQLBindCol;
@@ -987,20 +990,21 @@
          C_DataType   : SQL_C_DATA_TYPE;
          SQL_DataType : SQL_DATA_TYPE;
          ColumnSize   : SQLUINTEGER;
+         Size         : constant Positive := Value.all'Size;
       begin
-         if Unsigned'Size = SQLTINYINT'Size then
+         if Size = SQLTINYINT'Size then
             C_DataType   := SQL_C_UTINYINT;
             SQL_DataType := SQL_TINYINT;
             ColumnSize   := 3;
-         elsif Unsigned'Size = SQLSMALLINT'Size then
+         elsif Size = SQLSMALLINT'Size then
             C_DataType   := SQL_C_USHORT;
             SQL_DataType := SQL_SMALLINT;
             ColumnSize   := 5;
-         elsif Unsigned'Size = SQLINTEGER'Size then
+         elsif Size = SQLINTEGER'Size then
             C_DataType   := SQL_C_ULONG;
             SQL_DataType := SQL_INTEGER;
             ColumnSize   := 10;
-         elsif Unsigned'Size = SQLBIGINT'Size then
+         elsif Size = SQLBIGINT'Size then
             C_DataType   := SQL_C_UBIGINT;
             SQL_DataType := SQL_BIGINT;
             ColumnSize   := 20;
@@ -1150,14 +1154,15 @@
                           return SQLRETURN;
          pragma Import ($CALLCONVENTION, BindCol, "SQLBindCol");
          DT  : SQL_C_DATA_TYPE;
+         Size : constant Positive := TargetValue.all'Size;
       begin
-         if Enum'Size = SQLTINYINT'Size then
+         if Size = SQLTINYINT'Size then
             DT := SQL_C_TINYINT;
-         elsif Enum'Size = SQLSMALLINT'Size then
+         elsif Size = SQLSMALLINT'Size then
             DT := SQL_C_SHORT;
-         elsif Enum'Size = SQLINTEGER'Size then
+         elsif Size = SQLINTEGER'Size then
             DT := SQL_C_LONG;
-         elsif Enum'Size = SQLBIGINT'Size then
+         elsif Size = SQLBIGINT'Size then
             DT := SQL_C_SBIGINT;
          else
             raise Constraint_Error;
@@ -1166,7 +1171,7 @@
                          ColumnNumber,
                          DT,
                          TargetValue,
-                         SQLINTEGER (Enum'Size / 8),
+                         SQLINTEGER (Size / 8),
                          IndPtr);
       end SQLBindCol;

@@ -1196,20 +1201,21 @@
          C_DataType   : SQL_C_DATA_TYPE;
          SQL_DataType : SQL_DATA_TYPE;
          ColumnSize   : SQLUINTEGER;
+         Size         : constant Positive := Value.all'Size;
       begin
-         if Enum'Size = SQLTINYINT'Size then
+         if Size = SQLTINYINT'Size then
             C_DataType   := SQL_C_UTINYINT;
             SQL_DataType := SQL_TINYINT;
             ColumnSize   := 3;
-         elsif Enum'Size = SQLSMALLINT'Size then
+         elsif Size = SQLSMALLINT'Size then
             C_DataType   := SQL_C_USHORT;
             SQL_DataType := SQL_SMALLINT;
             ColumnSize   := 5;
-         elsif Enum'Size = SQLINTEGER'Size then
+         elsif Size = SQLINTEGER'Size then
             C_DataType   := SQL_C_ULONG;
             SQL_DataType := SQL_INTEGER;
             ColumnSize   := 10;
-         elsif Enum'Size = SQLBIGINT'Size then
+         elsif Size = SQLBIGINT'Size then
             C_DataType   := SQL_C_UBIGINT;
             SQL_DataType := SQL_BIGINT;
             ColumnSize   := 20;


-- System Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i586)

Kernel: Linux 2.6.26-2-486
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libgnadeodbc1.6.1 depends on:
ii  libc6                        2.7-18      GNU C Library: Shared libraries
ii  libgcc1                      1:4.3.2-1.1 GCC support library
ii  libgnat-4.3                  4.3.2-1.1   Runtime library for GNU Ada 
applic
ii  unixodbc                     2.2.11-16   ODBC tools libraries

libgnadeodbc1.6.1 recommends no packages.

libgnadeodbc1.6.1 suggests no packages.

-- no debconf information

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to