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 4 of 8 Topic 801 of 861
Post > Topic >>

Re: & Removal in Expressions

by Thomas Ganss <tganss_at_t_dash_online_dot_de-remove-all-after-fi Aug 25, 2007 at 01:20 PM

Hi Cathy,
> 
> TEXT TO m.lcSQL TEXTMERGE NOSHOW
>    SELECT * ;
>    FROM table ;
>    WHERE <<m.lcWhere>> ;
> ENDTEXT
> lcSQL = ALLTRIM(CHRTRANC( m.lcSQL, CHR(13) + CHR(10) + CHR(9) + ";", " "
))
> &lcSQL

does not allow me to use inline commentary in Text..EndText.
Therefore I use the code at the bottom.

Perhaps you want to add vfp-style inline commentary.

regards

thomas

function CleanSQLTest()
local lcSQL
text TO lcSQL TEXTMERGE NOSHOW
   select ;
   	"Hallo" as fullname ;			&& Line in pure Text
   	from TestSnippet ;			&& Table we have open
	  	into cursor c_Test readwrite
ENDTEXT
? lcSQL
lcSQL = CleanSqlLine(m.lcSQL)
? lcSQL
assert .f. message lcSQL
&lcSQL
return


function CleanSqlLine(tcSQL, tlSimple)
*-- needs to take care of more special cases like
*-- chr(9) used inside strings,
*-- multiple spaces in "code part
if m.tlSimple
   return Alltrim(chrtranc(m.tcSQL,";"+chr(13)+chr(10)+chr(9),space(1)))
else
   local 	laLines[1] ;
	,	lcLine, lcSQL ;
	,	lnRun, lnRAT

   lcSQL = ""
   for lnRun = 1 to alines(laLines, m.tcSQL)
     *-- possible break: ";" not used as continuation sign but in text
     *-- would have been broken in orig. implementation as well
     *-- use Asc(59) or just make sure you have a ";"
     *-- at the end of the code line
     *-- if one ";" is in the text!
     *-- snips off inline commentary as well
     lnRAT = rat(";",laLines[m.lnRun]) - 1
     lcLine = iif(m.lnRAT>0, left(laLines[m.lnRun] ;
	, m.lnRAT),   laLines[m.lnRun])

     *-- work in progress, unelegant and potentially slow
     *-- check again if offsetcounters are better
     do while empty(left(m.lcLine, 1))
       lcLine = substr(m.lcLine, 2)
     enddo
     do while empty(right(m.lcLine, 1))
       lcLine = left(m.lcLine, len(m.lcLine)-1)
     enddo

     lcSQL = m.lcSQL + " " + m.lcLine
   next
   *-- we avoided checking lcSQL in the loop, cut off first space
   return substr(m.lcSQL, 2)
endif
 




 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 Sat Nov 22 13:38:43 CST 2008.