Lazarus

Programming => Databases => Topic started by: aducom on January 22, 2016, 02:22:56 pm

Title: Issue and correction SQLServer datatype Date
Post by: aducom on January 22, 2016, 02:22:56 pm
Not sure where to post this. I have a table in MsSQL with date as datatype. This datatype is not supported and generates an error. I corrected this in the components, but actually it should be corrected in dblib too. This one works. How should I report this?

the following code corrects the issue: mssqlconn.pp
Code: [Select]
function TMSSQLConnection.TranslateFldType(SQLDataType: integer): TFieldType;
begin
  case SQLDataType of
    SQLCHAR:             Result:=ftFixedChar;
    SQLVARCHAR:          Result:=ftString;
    SQLINT1:             Result:=ftWord;
    SQLINT2:             Result:=ftSmallInt;
    SQLINT4, SQLINTN:    Result:=ftInteger;
    SYBINT8:             Result:=ftLargeInt;
    SQLFLT4, SQLFLT8,
    SQLFLTN:             Result:=ftFloat;
    SQLMONEY4, SQLMONEY,
    SQLMONEYN:           Result:=ftCurrency;
    SQLDATETIM4, SQLDATETIME,
    SQLDATETIMN:         Result:=ftDateTime;
    SQLIMAGE:            Result:=ftBlob;
    SQLTEXT:             Result:=ftMemo;
    SQLDECIMAL, SQLNUMERIC: Result:=ftBCD;
    SQLBIT:              Result:=ftBoolean;
    SQLBINARY:           Result:=ftBytes;
    SQLVARBINARY:        Result:=ftVarBytes;
    SYBUNIQUE:           Result:=ftGuid;
    SYBVARIANT:          Result:=ftBlob;
    40: result := ftDateTime;
    41: result := ftDateTime;
  else
    DatabaseErrorFmt('Unsupported SQL DataType %d "%s"', [SQLDataType, dbprtype(SQLDataType)]);
    Result:=ftUnknown;
  end;
end;   
Title: Re: Issue and correction SQLServer datatype Date
Post by: mig-31 on January 22, 2016, 02:47:40 pm
Report it in bug tracker. Describe problem, add diff code and code example to test it.
Title: Re: Issue and correction SQLServer datatype Date
Post by: LacaK on January 22, 2016, 08:10:26 pm
It is already fixed in FPC 3.0
Title: Re: Issue and correction SQLServer datatype Date
Post by: aducom on January 27, 2016, 08:53:30 am
Not sure as 1.6 is build with FPC 3.0? The issue was in 1.6RC1, but it is solved in 1.6RC2. So issue closed.

TinyPortal © 2005-2018