Recent

Author Topic: Select returning Wrong Field Date  (Read 7289 times)

sidon

  • New Member
  • *
  • Posts: 13
Select returning Wrong Field Date
« on: January 17, 2006, 12:33:59 am »
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

  • Hero Member
  • *****
  • Posts: 537
RE: Select returning Wrong Field Date
« Reply #1 on: January 17, 2006, 07:54:53 am »
Did you define a displayformat for this field? If so then you should check this.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Sidon without pwd :-/

  • Guest
Re: RE: Select returning Wrong Field Date
« Reply #2 on: January 17, 2006, 04:57:41 pm »
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

  • Hero Member
  • *****
  • Posts: 537
RE: Re: RE: Select returning Wrong Field Date
« Reply #3 on: January 17, 2006, 07:31:44 pm »
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.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Anonymous

  • Guest
Re: RE: Re: RE: Select returning Wrong Field Date
« Reply #4 on: January 18, 2006, 01:14:12 pm »
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

  • Hero Member
  • *****
  • Posts: 537
RE: Re: RE: Re: RE: Select returning Wrong Field Date
« Reply #5 on: January 18, 2006, 07:09:15 pm »
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.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Anonymous

  • Guest
RE: Re: RE: Re: RE: Select returning Wrong Field Date
« Reply #6 on: January 19, 2006, 07:13:13 pm »
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

  • Guest
Re: RE: Re: RE: Re: RE: Select returning Wrong Field Date
« Reply #7 on: January 19, 2006, 08:31:23 pm »
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

  • New Member
  • *
  • Posts: 21
RE: Re: RE: Re: RE: Re: RE: Select returning Wrong Field Dat
« Reply #8 on: January 20, 2006, 03:29:57 pm »
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

  • Hero Member
  • *****
  • Posts: 537
RE: Re: RE: Re: RE: Re: RE: Select returning Wrong Field Dat
« Reply #9 on: January 20, 2006, 06:01:14 pm »
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. :(
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Anonymous

  • Guest
RE: Re: RE: Re: RE: Re: RE: Select returning Wrong Field Dat
« Reply #10 on: February 10, 2006, 05:57:10 pm »
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

 

TinyPortal © 2005-2018