Is not a valid date time format on filter

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

woolfik
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 29.06.2009, 09:37

Is not a valid date time format on filter

Postby woolfik » 25.09.2009, 09:38

Hello I'm using zeos on d2010 and when I'm filtering records from db (postgresql) like

qrUser.Filter := 'surname = '+#39+ edit.text+#39; // if Surname is Smith is OK

// if surname is smith-webber is OK

and I have found in db surrname looks like: smith - - webber

and when I would like filter my records on this surrname:
qrUser.Filter := 'surname = ' +#39+'smith - - webber' +#39;

I have en error like in subject ...

My question is WHY ??

I have correct this record in db but I was wondern why this error has exist because record surrname is typ varchar not timestamp or date so why the error i invalid date time format ??

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Postby mdaems » 25.09.2009, 13:28

Hi,

I suppose this error occurs because 'something' decides the string including ' - - ' is a date.
The big question now is : what is this 'something'.
It might be the Zeoslib expressionparser or the TZExpression.Evaluate4 function call. Can you find out in which piece of code the error is raised?
My guess : it's during the Evaluation, because a token generated during the TZExpressionParser.Parse call has been wrongly identified as a date.

I know, it's quite a complex piece of code to debug, but do you think you could give it a try? I think I would start with the TZExpressionParser.Parse call.

Mark
Image

woolfik
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 29.06.2009, 09:37

Postby woolfik » 25.09.2009, 14:41

Ok I have looking for this error in code and it's look like this

When it goes to:
unit ZExprParser;
procedure TZExpressionParser.TokenizeExpression;

in case function in

case TZTokenType({$IFDEF FPC}Pointer({$ENDIF}
Tokens.Objects[TokenIndex]{$IFDEF FPC}){$ENDIF}) of

it goes to:
ttTime,ttDate,ttDateTime:
begin
TokenType := ttConstant;
DefVarManager.SetAsDateTime(TokenValue, StrToDateTime(Tokens[TokenIndex])); // and error is in this moment
end;

I have create record in database called:
Hwdp - - Whdp

And error is on TokenIndex = 2

Hope this information will be helpfull

If I have a few free time at the weekend I will try to repair this error and give some solution here but nothing for sure.

fsolispa
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 21.10.2009, 18:35
Contact:

Re: Is not a valid date time format on filter

Postby fsolispa » 23.10.2009, 18:54

woolfik wrote:Hello I'm using zeos on d2010 and when I'm filtering records from db (postgresql) like

qrUser.Filter := 'surname = '+#39+ edit.text+#39; // if Surname is Smith is OK

// if surname is smith-webber is OK

and I have found in db surrname looks like: smith - - webber

and when I would like filter my records on this surrname:
qrUser.Filter := 'surname = ' +#39+'smith - - webber' +#39;

I have en error like in subject ...

My question is WHY ??

I have correct this record in db but I was wondern why this error has exist because record surrname is typ varchar not timestamp or date so why the error i invalid date time format ??

woolfik wrote:Hello, can you help me for install zeosdbo component in d2010, i download the zeoz 7, but when i compile, show me a error in zurl.dcu no found


Return to “ZeosLib 7.0 Beta Forum”

Who is online

Users browsing this forum: No registered users and 0 guests