Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL command too complex - what should I do?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00301958
Message ID:
00302043
Vues:
28
Mark,

Let's me get all of you more info about this case. My collegue created a form, which allows our users to specify their selection criteria, which could be very complex and different. He created a preliminary form and then switched into error handling. At this time I got an assignment to fill this form, and do this in his manner. Ok, I did it, created a lot's of my classes, changed and fixed several problems in his classes, etc. In all his application he uses conception of save-restoration in meta-files. He uses macro-commands for that.
I haven't studied all his code and innards, but for this particular purpose, I believe, he uses something like:
&selectcmd;
&joincmd;
&wherecmd;
&intocmd

Suppose, wherecmd would be more that 255 char, what should we do? And, of course, it could contain space in quotes, like street="Beacon st"

It's one problem.

Another problem, which I found today is:
we have a class btcc_multilist, whcih allows us to make multiple selection (it also includes exclude checkbox and clear button, but these're details). On the Location page we have:
Counties Towns Registries listboxes. Obviously, if a user selects counties, it should affect on Towns and Registries listboxes. So, we have a command like
select fullname, town from Lookups!towns where ... &countycrit ®crit into array btcvalarray. And in btc_listInit method we have
cmd=this.selectcmd
&cmd
Last line is a source of errors.
Today we discussed with my collegue, how we would resolve this situation, and decided to put a restriction on max number of selected items, i.e. create a new property maxpermission and new method btc_countselected, and put it in list.when method, because valid method seems to be not siutable for this.

But it's still a problem, because we have 2 criteria &countycrit ®crit and we should combain them. As I said, it's a real PITA and would requer 1 or 2 whole days of my work.


>>
>>Just now I got this error message. I know why it happened, it's because I choose lot's of items in multilist, which affect on Init method one of my other controls. I think, it's VFP limitation 255 char on the macro string. So, my questions are:
>>1) Will in VFP7.0 this limitation be fixed?
>>2) How can I resolve this situation? Do I need to calculate length of my macro string, finding space, etc. Would be a real PITA :(
>
>Don't put the entire SQL into 1 string for macro expansion. Do something like:
>select &cFieldList ;
> from table1 join table2 on table1.pk = table2.pk ;
> where table1.fieldx in ('val1', 'val2') ;
> and table2.fieldy &cFilter1 ;
> group by &cGroupBy ;
> order by &cOrderBy ;
> into cursor MyCursor nofilter
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform