Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL command too complex - what should I do?
Message
From
10/12/1999 18:56:56
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00301958
Message ID:
00302081
Views:
32
This message has been marked as a message which has helped to the initial question of the thread.
>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.
>

Nadya, I'd suggest one more approach if you have VFP6 SP3. Try creating the SQL command as a command or series of commands in a string, doing all the macro-expansion necessry while building the string. Write that string to a temporary .PRG file. VFP6 SP3 can compile a .PRG on the fly using the COMPILE command. Now invoke the compiled code with DO MyCompiledProgram. This will avoid many of the macro expansion size limits.

It has several payoffs. If you need to do several things, you can build the entire sequence of operations into your 'on the fly' procedure. You can create variables as needed scoped to just the SQL Select block that you generate. And you can save the generated code files so that they're avaiable at another time, and can debug them without the unusual behavior sometime encountered with macro expansion.

Lots of things make this approach useful. You can add code so that when run from the developer's station, the debugger can be invoked, to let you inspect what happens. If a user says the query the constructed didn't work right, you can look at the code that was generated easily. You can use this to build libraries of common user queries, too.

>>>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:

Again, putting the values into a cursor and using an IN (subquery) may help with some of the length issues. There's no limit on the number of records in a subquery AFAIK.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform