Cool, thanks for sharing.

----- Original Message ----- 
From: "Garrett Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 21, 2007 1:53 PM
Subject: Intellisense script to strip quotes off identifiers


> I've been working with some Crystal Reports against Oracle tables, and
> they have an annoying habit of quoting the table and field names in
> the SELECT list, whether they need it or not. Since I don't like lots
> of extraneous text to maintain in my code, I wrote this script to
> strip the quotes off the identifiers without messing up any quoted
> strings. Just copy the query, type something like "quoteident" in the
> command window, and paste your freshly-cleaned code into the program.
>
> LPARAMETERS oFoxCode
> LOCAL llRegExpFLL ;
> , lcQuote, lcNonQuotes, lcPeriod, lcIdentifier ;
> , lcRegExp, lcCommand
>
> oFoxCode.ValueType = "V"
>
> *!* If we're not already using RegExp, add it, and be ready to
> *!* take it out at the end.
> llRegExpFLL = .F.
> IF "REGEXP"$UPPER(SET("Library"))
> llRegExpFLL = .T.
> ENDIF
> SET LIBRARY TO HOME(1) + "regexp.fll" ADDITIVE
>
> *!* Build the expression in readable chunks
> lcQuote = '\"'
> lcNonQuotes = '([^' + lcQuote + ']+)'
> lcPeriod = '\.'
> lcIdentifier = lcQuote + lcNonQuotes + lcQuote
>
> lcRegExp = lcIdentifier + lcPeriod + lcIdentifier
>
> *!* Build the command
> lcCommand = [_cliptext = regexp(_cliptext, '] + lcRegExp + [', 1, 
> '\1.\2')]
>
> &lcCommand.
>
> IF NOT llRegExpFLL
> RELEASE LIBRARY regexp.fll
> ENDIF
>
> *!* Show the command as a comment
> RETURN "*" + lcCommand
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to