[
https://issues.apache.org/jira/browse/DERBY-5242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Hillegas updated DERBY-5242:
---------------------------------
Attachment: IJUtils.java
Attaching IJUtils.java, a tool for parameterizing ij scripts. This attachment
contains a one-time registration procedure plus 3 routines for repeated use in
ij:
o readFile( String fileName )
This function reads a file, using the VM's default character encoding, and
returns the contents as a String.
o replace( String source, String token, String replacementValue )
This function substitutes a replacement value for all instances of a token in
a source String.
o writeFile( String fileName, String contents )
This procedure writes a String to a file.
To use these routines in an ij script, first register them as follows:
create procedure registerRoutines() language java parameter style java
modifies sql data external name 'IJUtils.registerRoutines';
call registerRoutines();
Then you can use them to run parameterized scripts as follows:
call writeFile
(
'z.sql',
replace( replace( readFile(
'/Users/myhome/sql/messageComparisonTemplate.sql' ), 'YYYTypeYYY', 'Engine' ),
'XXXLanguageXXX', 'German' )
);
run 'z.sql';
> Create helper methods to parameterize ij scripts
> ------------------------------------------------
>
> Key: DERBY-5242
> URL: https://issues.apache.org/jira/browse/DERBY-5242
> Project: Derby
> Issue Type: Task
> Components: Tools
> Affects Versions: 10.9.0.0
> Reporter: Rick Hillegas
> Priority: Minor
> Attachments: IJUtils.java
>
>
> I often need to run similar blocks of ij script over and over, with only
> small changes between the blocks. It would be nice to be able to parameterize
> those blocks of ij script.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira