Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11343 > unrolled thread

Compiling multi-line strings into resource / executable with purity

Started byRobert Pope <cooeee@gmail.com>
First post2018-01-31 01:13 -0800
Last post2018-02-20 06:07 -0800
Articles 3 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Compiling multi-line strings into resource / executable with purity Robert Pope <cooeee@gmail.com> - 2018-01-31 01:13 -0800
    Re: Compiling multi-line strings into resource / executable with purity Robert Pope <cooeee@gmail.com> - 2018-02-20 02:06 -0800
      Re: Compiling multi-line strings into resource / executable with purity dlzc <dlzc1@cox.net> - 2018-02-20 06:07 -0800

#11343 — Compiling multi-line strings into resource / executable with purity

FromRobert Pope <cooeee@gmail.com>
Date2018-01-31 01:13 -0800
SubjectCompiling multi-line strings into resource / executable with purity
Message-ID<faea89cd-78fd-49ab-b47f-efd03acdb9bd@googlegroups.com>
Hi.

I don't think this is possible, but I figured I'd ask anyway..

Are there any tricks around getting a long string compiled into an executable, that is accessible at run time, is visible within the VO IDE (can be globally searched on), and keeps the multi-line text in its pure form (i.e. not wrapped in VO code at a line level. Block level is fine.).

For example, something like the following would be ideal (it doesn't work, though!).

RESOURCE MyTextBlob SQL
BEGIN
   SELECT AAAA FROM BBBB;
   SELECT CCCC FROM DDDD;
   SELECT DDDD FROM EEEE;
   ... (Support for many more lines)
END

I'm trying to avoid wrapping the text with VO code, e.g.:

cSQL := "SELECT AAAA FROM BBBB;"
cSQL += "SELECT CCCC FROM DDDD;"

I'm also trying to come up with a solution that allows global search to work. I.e. if I search for AAAA in global search, the blob will be found.

Currently we either:
 a) wrap our SQL in VO, which isn't great for long scripts and is troublesome when we have to revisit the script.
 b) put the pure SQL in .sql files and RESOURCE them into our application for our long scripts. This makes it easy to read and maintain. The problem is that global search can't see it so we sometimes forget to update them. They are also a pain because the *.sql file and what is encoded into the *.mef frequently lose synchronization, so requires very delicate handling.

We have support for multi line comments with /* */, and multi line TEXTBLOCK which are ignored by the compiler and can't be addressed at run time. I don't suppose there are any tricks for defining multi line strings in a manner like these.

Cheers!

[toc] | [next] | [standalone]


#11366

FromRobert Pope <cooeee@gmail.com>
Date2018-02-20 02:06 -0800
Message-ID<593cbb02-9188-4ba1-836b-d2d269fd1ddb@googlegroups.com>
In reply to#11343
On Wednesday, January 31, 2018 at 8:13:42 PM UTC+11, Robert Pope wrote:
> Hi.
> 
> I don't think this is possible, but I figured I'd ask anyway..
> 
> Are there any tricks around getting a long string compiled into an executable, that is accessible at run time, is visible within the VO IDE (can be globally searched on), and keeps the multi-line text in its pure form (i.e. not wrapped in VO code at a line level. Block level is fine.).
> 
> For example, something like the following would be ideal (it doesn't work, though!).
> 
> RESOURCE MyTextBlob SQL
> BEGIN
>    SELECT AAAA FROM BBBB;
>    SELECT CCCC FROM DDDD;
>    SELECT DDDD FROM EEEE;
>    ... (Support for many more lines)
> END
> 
> I'm trying to avoid wrapping the text with VO code, e.g.:
> 
> cSQL := "SELECT AAAA FROM BBBB;"
> cSQL += "SELECT CCCC FROM DDDD;"
> 
> I'm also trying to come up with a solution that allows global search to work. I.e. if I search for AAAA in global search, the blob will be found.
> 
> Currently we either:
>  a) wrap our SQL in VO, which isn't great for long scripts and is troublesome when we have to revisit the script.
>  b) put the pure SQL in .sql files and RESOURCE them into our application for our long scripts. This makes it easy to read and maintain. The problem is that global search can't see it so we sometimes forget to update them. They are also a pain because the *.sql file and what is encoded into the *.mef frequently lose synchronization, so requires very delicate handling.
> 
> We have support for multi line comments with /* */, and multi line TEXTBLOCK which are ignored by the compiler and can't be addressed at run time. I don't suppose there are any tricks for defining multi line strings in a manner like these.
> 
> Cheers!

For anyone reading this in future, what we ended up deciding to do was to stick with the RESOURCE "MyResource" SQL Path\To\sql.sql approach, however we added a textblock into the same module with the SQL inside a block comment /* */. Unfortunately it means we have three locations to keep in sync, but at least global search works, at least until someone forgets to update it.

[toc] | [prev] | [next] | [standalone]


#11367

Fromdlzc <dlzc1@cox.net>
Date2018-02-20 06:07 -0800
Message-ID<4957ba50-67e4-4160-bdaf-931557baba60@googlegroups.com>
In reply to#11366
Dear Robert Pope:

On Tuesday, February 20, 2018 at 3:06:22 AM UTC-7, Robert Pope wrote:
...
> For anyone reading this in future, what we ended up
> deciding to do was to stick with the RESOURCE
> "MyResource" SQL Path\To\sql.sql approach, however
> we added a textblock into the same module with the
> SQL inside a block comment /* */. Unfortunately it
> means we have three locations to keep in sync, but
> at least global search works, at least until someone
> forgets to update it.

Any chance of storing this string in a Memo field, that is parsed at runtime?  Then it is the same text every place, and only one instance.

Having "defined literal values" in code is blinding... if you've added comments.

David A. Smith

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web