Subject Re: [IBO] Filter
Author tgtecchio
BTW, if I add/remove some spaces from my filter criteria, I get
different results (!).

For example:

error ->>> (upper(cli.NOME) LIKE 'HELEN%')
ok ->>> (upper (cli.NOME) LIKE'HELEN%')


Really, I think it's a little error in parser... but I'm not the right
person to say that...




--- In IBObjects@yahoogroups.com, "tgtecchio" <tgtecchio@...> wrote:
>
> Hi, here goes the original SQL (with monitor output), after I aplied
> the filter:
>
> /*---
> PREPARE STATEMENT
> TR_HANDLE = 4097644
> STMT_HANDLE = 4097740
>
> SELECT CLI.CODIGO, CLI.ORDEM, CLI.NOME, CLI.FANTASIA,
> CLI.CPF, CLI.IDENTIDADE, CLI.CGC,
> CLI.NASCIMENTO, CLI.DATA, CLI.PESSOA,
> CASE CLI.PESSOA
> WHEN 'J' THEN 'JURÍDICA'
> WHEN 'F' THEN 'FÍSICA'
> ELSE CLI.PESSOA
> END AS DES_PESSOA,
> CLI.TIPO,
> CASE CLI.TIPO
> WHEN 'T' THEN 'Titular'
> WHEN 'C' THEN 'Cônjuge'
> WHEN 'A' THEN 'Autorizado'
> ELSE CLI.TIPO
> END AS DES_TIPO,
> DAD.FONE AS CLIFONE,
> DAD.FAX AS CLIFAX,
> FUN.NOME AS CLIVENDEDOR,
> DAD.CONTATO
> FROM CLICADASTRO CLI
> LEFT JOIN CLIDADO DAD ON (CLI.CODIGO = DAD.CODIGO)
> LEFT JOIN TABFUNCIONARIO FUN ON (DAD.VENDEDOR = FUN.CODIGO)
> WHERE CLI.CODIGO = 37697
> AND ((upper ( cli.NOME) AND LIKE 'TIAGO%' ))
> ORDER BY CLI.NOME ASC
>
> FIELDS = [ Version 1 SQLd 17 SQLn 30
> CLICADASTRO.CODIGO = <NIL>
> CLICADASTRO.ORDEM[ORDEM] = <NIL>
> CLICADASTRO.NOME[NOME] = <NIL>
> CLICADASTRO.FANTASIA[FANTASIA] = <NIL>
> CLICADASTRO.CPF[CPF] = <NIL>
> CLICADASTRO.IDENTIDADE = <NIL>
> CLICADASTRO.CGC = <NIL>
> CLICADASTRO.NASCIMENTO = <NIL>
> CLICADASTRO.DATA = <NIL>
> CLICADASTRO.PESSOA = <NIL>
> [DES_PESSOA] = <NIL>
> CLICADASTRO.TIPO = <NIL>
> [DES_TIPO] = <NIL>
> CLIDADO.FONE[CLIFONE] = <NIL>
> CLIDADO.FAX[CLIFAX] = <NIL>
> TABFUNCIONARIO.NOME[CLIVENDEDOR] = <NIL>
> CLIDADO.CONTATO = <NIL> ]
>
> ERRCODE = 335544569
> ----*/
> /*---
> PREPARE STATEMENT
> TR_HANDLE = 4097644
> STMT_HANDLE = 4097740
>
> SELECT CLI.CODIGO, CLI.ORDEM, CLI.NOME, CLI.FANTASIA,
> CLI.CPF, CLI.IDENTIDADE, CLI.CGC,
> CLI.NASCIMENTO, CLI.DATA, CLI.PESSOA,
> CASE CLI.PESSOA
> WHEN 'J' THEN 'JURÍDICA'
> WHEN 'F' THEN 'FÍSICA'
> ELSE CLI.PESSOA
> END AS DES_PESSOA,
> CLI.TIPO,
> CASE CLI.TIPO
> WHEN 'T' THEN 'Titular'
> WHEN 'C' THEN 'Cônjuge'
> WHEN 'A' THEN 'Autorizado'
> ELSE CLI.TIPO
> END AS DES_TIPO,
> DAD.FONE AS CLIFONE,
> DAD.FAX AS CLIFAX,
> FUN.NOME AS CLIVENDEDOR,
> DAD.CONTATO
> FROM CLICADASTRO CLI
> LEFT JOIN CLIDADO DAD ON (CLI.CODIGO = DAD.CODIGO)
> LEFT JOIN TABFUNCIONARIO FUN ON (DAD.VENDEDOR = FUN.CODIGO)
> WHERE CLI.CODIGO = 37697
> AND ((upper ( cli.NOME) AND LIKE 'TIAGO%' ))
> ORDER BY CLI.NOME ASC
>
> FIELDS = [ Version 1 SQLd 17 SQLn 30
> CLICADASTRO.CODIGO = <NIL>
> CLICADASTRO.ORDEM[ORDEM] = <NIL>
> CLICADASTRO.NOME[NOME] = <NIL>
> CLICADASTRO.FANTASIA[FANTASIA] = <NIL>
> CLICADASTRO.CPF[CPF] = <NIL>
> CLICADASTRO.IDENTIDADE = <NIL>
> CLICADASTRO.CGC = <NIL>
> CLICADASTRO.NASCIMENTO = <NIL>
> CLICADASTRO.DATA = <NIL>
> CLICADASTRO.PESSOA = <NIL>
> [DES_PESSOA] = <NIL>
> CLICADASTRO.TIPO = <NIL>
> [DES_TIPO] = <NIL>
> CLIDADO.FONE[CLIFONE] = <NIL>
> CLIDADO.FAX[CLIFAX] = <NIL>
> TABFUNCIONARIO.NOME[CLIVENDEDOR] = <NIL>
> CLIDADO.CONTATO = <NIL> ]
>
> ERRCODE = 335544569
> ----*/
> /*---
> INTERPRET BUFFER =
>
> ERRCODE = 17
> ----*/
> /*---
> INTERPRET BUFFER = Dynamic SQL Error
>
> SECONDS = 0,016
>
> ERRCODE = 21
> ----*/
> /*---
> INTERPRET BUFFER = SQL error code = -104
>
> ERRCODE = 32
> ----*/
> /*---
> INTERPRET BUFFER = Token unknown - line 24, char 27
>
> ERRCODE = 3
> ----*/
> /*---
> INTERPRET BUFFER = AND
>
> ERRCODE = -1
> ----*/
>
>
>
>
>
> --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@> wrote:
> >
> > At 10:08 PM 19/09/2007, you wrote:
> > >Hi Helen, thanks for your reply!
> > >
> > > My sql statement is just like this:
> > >
> > > SELECT XX.ID, XX.STATE, XX.CUSTOMER_NAME
> > > FROM CUSTOMER_TABLE XX
> > > WHERE XX.STATE = 'CA'
> > >
> > > After this, I apply the filter. I put the parenthesis as you told
> > >me, but IBO parsed a wrong sql statement.
> > >
> > > My filter: (UPPER(XX.CUSTOMER_NAME) LIKE 'HELEN%')
> > >
> > > So, when I apply the filter, I got this sql:
> > >
> > > SELECT XX.ID, XX.STATE, XX.CUSTOMER_NAME
> > > FROM CUSTOMER_TABLE XX
> > > WHERE XX.STATE = 'CA'
> > > AND (UPPER(XX.CUSTOMER_NAME) AND LIKE 'HELEN%')
> > >
> > > What is wrong because there's an extra "and" in the middle. I
think
> > >the whole problem is located at TIB_Dataset.ProcessSQLWhereStrings,
> > >but who knows?
> >
> > OK, then lack of outer parens wasn't what it was complaining about
> > before. What does the monitor show when you apply the original
> > syntax but with the qualifier added to the operand?
> >
> > Helen
> >
>