Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 36606 invoked from network); 22 Feb 2010 15:22:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Feb 2010 15:22:49 -0000 Received: (qmail 67650 invoked by uid 500); 22 Feb 2010 15:22:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 67580 invoked by uid 500); 22 Feb 2010 15:22:48 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 67563 invoked by uid 99); 22 Feb 2010 15:22:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2010 15:22:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2010 15:22:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E2DC0234C052 for ; Mon, 22 Feb 2010 07:22:27 -0800 (PST) Message-ID: <163547301.432771266852147927.JavaMail.jira@brutus.apache.org> Date: Mon, 22 Feb 2010 15:22:27 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-4557) Make it possible to parameterize ij scripts. In-Reply-To: <1960044932.395781266606867998.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-4557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12836660#action_12836660 ] Rick Hillegas commented on DERBY-4557: -------------------------------------- Thanks for thinking more about this issue, Sylvain and Denis. Concerning the compatibility issue which Sylvain raised... >However, what about the compatibility with existing ij scripts, if those already embed parameter-like strings? >ij> INSERT INTO T(user, password) VALUES('john', '$1'); >In the (rather simplistic) example above, the statement will set the password of "fred" to "$1" with some versions of ij, but will set it to the empty string - or whatever the parameter $1 is defined - with other versions. ...I think we can handle this by not assigning a default value to unassigned variables. If the user hasn't specified a value for $1 on the command line, then ij does not substitute anything. I think it is good to think about this issue in the broader context of whether we want to add support for an ij SET command which creates variables. However, I think that enhancement deserves a separate, related issue. Here are some possible ij command lines which pass in variables. The following line would support numbered variables (e.g., $1, $2, ...): ij -a fred -a fredpassword scriptFileName The following would support named variables (e.g., ${user}): ij -Dij.arg.user=fred -Dij.arg.password=fredpassword scriptFileName I am leaning toward the second approach. It's a little more verbose but it exploits existing ij capabilities. Thanks. > Make it possible to parameterize ij scripts. > -------------------------------------------- > > Key: DERBY-4557 > URL: https://issues.apache.org/jira/browse/DERBY-4557 > Project: Derby > Issue Type: Improvement > Components: Tools > Reporter: Rick Hillegas > > It would be nice to be able to parameterize ij scripts. At a high level, this would be akin to the $N parameters which you pass on the command line to Unix shell scripts. I think it would be easiest to understand if parameter substitution happened before the script was handed to the ij parser. > It would be nice to write something like the following: > connect 'jdbc:derby:$1;user=$2;password=$3'; > insert into $4( a ) values ( $5 ); > or something like this: > connect 'jdbc:derby:${dbname};user=${user};password=${password}'; > insert into ${tableName} values ( ${intValue} ); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.