Select returning Wrong Field Date lazarus / 16-Databases ---------------------------------------------------------------------- sidon · 2006-01-16 23:33 Hi! I'm working with UIB on lazarus, all works fine, except Date fields in a select sql statement, all Date fields are returning :     31/12/0000 But work fine in a insert and update sql statment, I have tested with FBLib and the same error occurred! This is a Lazarus bug? ---------------------------------------------------------------------- matthijs · 2006-01-17 06:54 Did you define a displayformat for this field? If so then you should check this. ---------------------------------------------------------------------- Sidon without pwd :-/ · 2006-01-17 15:57 Quote from: "matthijs"Did you define a displayformat for this field? If so then you should check this. Where? the UIB lib don't has a "Field Editor" OTOH, i don't believe that this is the question. ---------------------------------------------------------------------- matthijs · 2006-01-17 18:31 But it might be the answer. If you defined the display format like 'dd/mm/0000'. And a lazarus bug it would not be, because then it would happen in other database components as well. So it might be a bug in the UIB components or you made a error yourself. But based on the information you are giving, it is guess work, because it is very little. ---------------------------------------------------------------------- Anonymous · 2006-01-18 12:14 Quote from: "matthijs"But it might be the answer. We never know ;-) Quote from: "matthijs" If you defined the display format like 'dd/mm/0000'. And a lazarus bug it would not be, because then it would happen in other database components as well. But... it happen in other database components, as i said: "I have tested with FBLib and the same error occurred!" and now i tested with FIBL and the same error happened. ---------------------------------------------------------------------- matthijs · 2006-01-18 18:09 I made a quick test using SQLdb components and a FB and a MySQL 4.1 database. It looks like a bug in the TDateField. But that is part of FPC, so we might report a bug there. ---------------------------------------------------------------------- Anonymous · 2006-01-19 18:13 In version 2.0.2 only the components provided with FPC itself worked. In 2.1.1 we tried to solve that, but the fix wasn't correct with the result that datetime fields didn't worked at all anymore. In FPC-2.1.1 from 6 januari or later this problem is fixed for all databases, although I haven't tested FUIB. ---------------------------------------------------------------------- Anonymous · 2006-01-19 19:31 Quote from: "Anonymous"In FPC-2.1.1 from 6 januari or later this problem is fixed for all databases, although I haven't tested FUIB. I upgraded to revision 2153. Code: [Select] $ svn info Path: . URL: http://svn.freepascal.org/svn/fpc/trunk Repository UUID: 3ad0048d-3df7-0310-abae-a5850022a9f2 Revision: 2153 Errors with DateTimeField still exists! FB/IB date field are shown as '30-12-1899'. With MySQL you cannot open a query when a DateTimeField is in the result set. ---------------------------------------------------------------------- Galileo · 2006-01-20 14:29 I have noticed the same problem, but only in Windows (using UIB). The same application running in Linux works fine and the date is displayed ok. Eduardo. ---------------------------------------------------------------------- matthijs · 2006-01-20 17:01 I'm working on Linux. Revision in previous post should read 2253. I understood from Joost that from an  earlier revision the bug should be cleared and this revision was stable. But I did some extensive testing on a FC4 box, running latest Lazarus-SVN and mentioned FPC- revision. ---------------------------------------------------------------------- Anonymous · 2006-02-10 16:57 I had a same problem in Windows (not in Linux). Then I change "JvUibDataset.pas"   in function GetFieldData to:  uftDate:       begin         {$IFDEF FPC}                 {$IFDEF MSWINDOWS}                         PInteger(Buffer)^ := PInteger(sqldata)^ - DateOffset + 693595 ;                 {$ELSE}                        PDouble(Buffer)^ := PInteger(sqldata)^ - DateOffset;                 {$ENDIF}         {$ELSE}     Pedro