🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #143

Re: Length Limit of Filter String?

#143
From: Romain Strieff [TeamB]
Date: Fri, 22 Jan 1999 00:00
90 lines
2684 bytes
In article <36a771af.9942236@forums.borland.com>, Thomas Preston politely 
paraphrased ...
> I was encountering an error in a complex filter string that had the
> format . . .
> 
> form.rowset1.filter=(this=that OR that=this) AND (thisthing=thatthing
> OR thatthing=thisthing) AND (a=1 OR a=2 OR b=1 OR b=2 OR c=1 OR c=2 OR
> d=1 OR d=2 OR e=1 OR e=2 OR f=1 OR f=2 OR g=1 OR g=2 OR h=1 OR h=2 OR
> i=1 OR i=2) AND (theother=this OR this=theother)
> 
> The problem was in the longest segment (a=1 . . .).  I think that
> there must be a limit to the number of arguments contained within
> parens.  Anyway . . . I resolved the issue by modifying the form
> (splitting the controls).
> 
> In other words . . . WHEN ALL ELSE FAILS, MANIPULATE THE DATA.
> 
I just made some tests and my conclusion is that 16 conditions is the 
max. The length of the filter string doesn't matter. Here's my short 
testprogram.


close all
erase longfilter.dbf

if not file("longfilter.dbf")
  cCommand=[CREATE TABLE "LONGFILTER.DBF" (]
  for n= 1 to 50
   cCommand+=[ ALONGDBFFIELD]+ltrim(str(n))+[ char(1)]
   if n<50
    cCommand+=[,]
   else
       cCommand+=[)]
   endif
  next
 &cCommand.
 use longfilter
 generate 10
 use
endif
local q
q=new query()
q.sql=[select * from "longfilter.dbf"]
q.active=true
  cFilter=""
  nFields=16 // change to 17 and it will error out
  for n= 1 to nfields
   cFilter+=[ ALONGDBFFIELD]+ltrim(str(n))+[ ='A' ]
   if n<nfields
    cFilter+=[ AND ]
   endif
  next
 msgbox(cfilter,"Filter length:"+str(len(cFilter))+;
 " Conditions:"+str(nFields))

q.rowset.filter="&cFilter."

q.active=false
/-----------

OTOH when using ..WHERE..it works.


local q
q=new query()
  cSQL=[SELECT * FROM "LONGFILTER.DBF" WHERE ]
  nFields=50
  for n= 1 to nfields
   Csql+=[ ALONGDBFFIELD]+ltrim(str(n))+[ ='A' ]
   if n<nfields
    cSQL+=[ AND ]
   endif
  next
 msgbox(cSQL)
q.sql=cSQL
q.active=true

q.active=false
return





-- 
Romain Strieff [TeamB]
Please read this newsgroup guide below before 
posting on the private Inprise newsgroups.
http://www.inprise.com/newsgroups/guide.html
--
Technical Details
Message-ID: <MPG.1112cba26db7390e989c3f@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36a4afb3.62426926@forums.borland.com> <36A57C79.42E3DFBA@ibm.net> <36a771af.9942236@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,3a53f38599f8e07c
X-Google-Attributes: gidff5a1,public
From: teamb@opto-pps.com (Romain Strieff [TeamB])
Subject: Re: Length Limit of Filter String?
Date: 1999/01/22
Message-ID: <MPG.1112cba26db7390e989c3f@forums.inprise.com>
X-Deja-AN: 435706387
References: <36a4afb3.62426926@forums.borland.com> <36A57C79.42E3DFBA@ibm.net> <36a771af.9942236@forums.borland.com>
Organization: TeamB
Newsgroups: borland.public.vdbase.data.sql