Browse Source

* Support for ftFixedChar parameter
* Use SQL_VARCHAR instead of SQL_LONGVARCHAR, bug #14907, based on patch from Ladislav Karrach

git-svn-id: trunk@15431 -

joost 15 years ago
parent
commit
4e9fc5fadb
1 changed files with 18 additions and 11 deletions
  1. 18 11
      packages/fcl-db/src/sqldb/odbc/odbcconn.pas

+ 18 - 11
packages/fcl-db/src/sqldb/odbc/odbcconn.pas

@@ -351,7 +351,7 @@ begin
           SqlType:=SQL_BIGINT;
           ColumnSize:=19;
         end;
-      ftString, ftBlob, ftMemo:
+      ftString, ftFixedChar, ftBlob, ftMemo:
         begin
           StrVal:=AParams[ParamIndex].AsString;
           StrLenOrInd:=Length(StrVal);
@@ -364,16 +364,23 @@ begin
           Size:=Length(StrVal);
           ColumnSize:=Size;
           BufferLength:=Size;
-          if AParams[ParamIndex].DataType = ftString then
-            begin
-            CType:=SQL_C_CHAR;
-            SqlType:=SQL_LONGVARCHAR;
-            end
-          else // ftBlob, ftMemo
-            begin
-            CType:=SQL_C_BINARY;
-            SqlType:=SQL_BINARY;
-            end;
+          case AParams[ParamIndex].DataType of
+            ftBlob:
+              begin
+              CType:=SQL_C_BINARY;
+              SqlType:=SQL_BINARY;
+              end;
+            ftMemo:
+              begin
+              CType:=SQL_C_CHAR;
+              SqlType:=SQL_LONGVARCHAR;
+              end
+            else // ftString, ftFixedChar
+              begin
+              CType:=SQL_C_CHAR;
+              SqlType:=SQL_VARCHAR;
+              end;
+          end;
         end;
       ftFloat:
         begin