Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
No question, Marx.
Message
From
28/04/2008 09:51:35
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
01313400
Message ID:
01313496
Views:
9
>How VFP is suppose to know that it's a comment?

By parsing the statement for that too, just like it parses for "?" :).

That would make it dangerous, actually, something that may be a part of a string may be construed as a comment, and anything beyond that point would be misinterpreted, and possible real mentions of a parameter would be lost. Also, SQL server has two ways of designating text as comment - others may have their own, and VFP is not in the business of knowing them all or being compatible with just a few. So it's actually better this way, with parser not trying to be smarter than it should.

I wrote this just because I forgot about it for the second time... so to weld it deeper into my memory, "do not embed question marks in comments in SQL in Fox".

>>
>>h=sqlstringconnect("your connect string here")
>>?sqlexec(h, "-- is this a proper comment?", "none")
>>
>>
>>You get a nice "SQL parameter is missing." error for this.
>>
>>Why? Because there's a question mark in the SQL command being sent, and VFP parses it, looking for parameters. Well, the parser isn't too smart - if it was, it would be writing SQL for us, right? - so it finds a question mark followed by nothing that would serve as a variable name, a-ha! Error.
>>
>>Just in case someone else bangs into this particular corner of the wall, may they escape without this ugly bump on the forehead.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform