Page 1 of 1

Is not a valid date time format on filter

Posted: 25.09.2009, 09:38
by woolfik
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 ??

Posted: 25.09.2009, 13:28
by mdaems
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

Posted: 25.09.2009, 14:41
by woolfik
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.

Re: Is not a valid date time format on filter

Posted: 23.10.2009, 18:54
by fsolispa
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