Explorar el Código

fcl-db: mssql: add support for varchar(MAX), varbinary(MAX) data types
(text, ntext and image data types are deprecated by SQL Server and will be removed in any future version of SQL Server)

git-svn-id: trunk@30082 -

lacak hace 10 años
padre
commit
69cbcdaa34
Se han modificado 1 ficheros con 11 adiciones y 6 borrados
  1. 11 6
      packages/fcl-db/src/sqldb/mssql/mssqlconn.pp

+ 11 - 6
packages/fcl-db/src/sqldb/mssql/mssqlconn.pp

@@ -725,11 +725,16 @@ begin
       ftString, ftFixedChar:
       ftString, ftFixedChar:
         begin
         begin
         FieldSize := col.MaxLength;
         FieldSize := col.MaxLength;
-        if FieldSize > dsMaxStringSize then FieldSize := dsMaxStringSize;
+        if FieldSize >= $3FFFFFFF then // varchar(max)
+           FieldType := ftMemo;
+
         end;
         end;
-      ftMemo, ftBlob,
       ftBytes, ftVarBytes:
       ftBytes, ftVarBytes:
+        begin
         FieldSize := col.MaxLength;
         FieldSize := col.MaxLength;
+        if FieldSize >= $3FFFFFFF then // varbinary(max)
+           FieldType := ftBlob;
+        end;
       ftBCD:
       ftBCD:
         begin
         begin
         FieldSize := col.Scale;
         FieldSize := col.Scale;
@@ -738,10 +743,10 @@ begin
         end;
         end;
       ftGuid:
       ftGuid:
         FieldSize := 38;
         FieldSize := 38;
-    else
-      FieldSize := 0;
-      if col.Identity and (FieldType = ftInteger) then
-        FieldType := ftAutoInc;
+      else
+        FieldSize := 0;
+        if col.Identity and (FieldType = ftInteger) then
+          FieldType := ftAutoInc;
     end;
     end;
 
 
     with FieldDefs.Add(FieldDefs.MakeNameUnique(FieldName), FieldType, FieldSize, (col.Null=0) and (not col.Identity), i) do
     with FieldDefs.Add(FieldDefs.MakeNameUnique(FieldName), FieldType, FieldSize, (col.Null=0) and (not col.Identity), i) do