Recent

Author Topic: Issue and correction SQLServer datatype Date  (Read 1289 times)

aducom

  • Full Member
  • ***
  • Posts: 114
    • http://www.aducom.com
Issue and correction SQLServer datatype Date
« 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;   

mig-31

  • Sr. Member
  • ****
  • Posts: 259
Re: Issue and correction SQLServer datatype Date
« Reply #1 on: January 22, 2016, 02:47:40 pm »
Report it in bug tracker. Describe problem, add diff code and code example to test it.
Lazarus 2.0.2 - CentOS 7.x, Mageia 7.1

LacaK

  • Hero Member
  • *****
  • Posts: 577
Re: Issue and correction SQLServer datatype Date
« Reply #2 on: January 22, 2016, 08:10:26 pm »
It is already fixed in FPC 3.0

aducom

  • Full Member
  • ***
  • Posts: 114
    • http://www.aducom.com
Re: Issue and correction SQLServer datatype Date
« Reply #3 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.