Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Xbase Fox > Re: & Removal i...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 8 Topic 801 of 857
Post > Topic >>

Re: & Removal in Expressions

by "Lew" <lew@[EMAIL PROTECTED] > Aug 23, 2007 at 04:18 PM

Hello again. I certainly remove as many macro substitutions as I can in my 
code, but when it comes to sql queries they're pretty much a fact of life.

Consider that when you use sqlexec() the entire query must evaluate to a 
character expression, so I figure that if the industry as a whole does
this, 
VFP should too. I'm sure you've considered generating a single, all 
inclusive character string with no &'s and then using execscript() to fire

the entire query. This seems slicker, imo, plus you can log the entire 
statement which may help troubleshooting. You'd think that it'd also
execute 
faster, but in my experience it most often doesn't. I'd guess that vfp 
generates the complete string internally before firing it, so the 
execscript() makes it do this twice.
-Lew
"Gene Wirchenko" <genew@[EMAIL PROTECTED]
> wrote in message 
news:brorc31mq1n33n3h7gh1qnlqf5cuech7lt@[EMAIL PROTECTED]
>     I frequently build expressions for use in xBASE and SQL
> statements.  For example:
>
>      do case
>      case !empty(this.datefrom) and !empty(this.dateto)
>         dateexpwo="(trndtlow>=this.datefrom and
> trndthi<=this.dateto)"
>         dateexpol=;
>          "((trndtlow<this.datefrom and this.datefrom<trndthi) or "+;
>          "(trndtlow<this.dateto and this.dateto<trndthi))"
>      case !empty(this.datefrom) and empty(this.dateto)
>         dateexpwo="(trndtlow>=this.datefrom)"
>         dateexpol="(trndtlow<this.datefrom and
> this.datefrom<trndthi)"
>      case empty(this.datefrom) and !empty(this.dateto)
>         dateexpwo="(trndthi<=this.dateto)"
>         dateexpol="(trndtlow<this.dateto and this.dateto<trndthi)"
>      case empty(this.datefrom) and empty(this.dateto)
>         dateexpwo=".t."
>         dateexpol=".f."     && Overlap with ends is impossible if no
> ends!
>         endcase
>
>      . . .
>
>      select . . .
>      where;
>       wostatus="B" and &dateexpwo and . . .
>
>     Short of writing four SQL selects for the above case, is there
> any way to get rid of the & use ("&dateexpwo")?
>
> Sincerely,
>
> Gene Wirchenko
>
> Computerese Irregular Verb Conjugation:
>     I have preferences.
>     You have biases.
>     He/She has prejudices.
 




 8 Posts in Topic:
& Removal in Expressions
Gene Wirchenko <genew@  2007-08-23 12:48:42 
Re: & Removal in Expressions
"Lew" <lew@[  2007-08-23 16:18:39 
Re: & Removal in Expressions
"Cathy Pountney"  2007-08-23 18:57:46 
Re: & Removal in Expressions
Thomas Ganss <tganss_a  2007-08-25 13:20:29 
Re: & Removal in Expressions
Bernhard Sander <fuchs  2007-08-24 10:12:33 
Re: & Removal in Expressions
Gene Wirchenko <genew@  2007-08-24 09:13:25 
Re: & Removal in Expressions
Cy Welch <cywelch@[EMA  2007-08-26 09:15:16 
Re: & Removal in Expressions
Gene Wirchenko <genew@  2007-08-27 11:59:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Aug 21 22:13:37 CDT 2008.