Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 79141 invoked from network); 2 Nov 2007 17:41:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2007 17:41:52 -0000 Received: (qmail 8058 invoked by uid 500); 2 Nov 2007 17:41:37 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 8018 invoked by uid 500); 2 Nov 2007 17:41:37 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 8007 invoked by uid 99); 2 Nov 2007 17:41:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2007 10:41:37 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of larry.meadors@gmail.com designates 66.249.92.173 as permitted sender) Received: from [66.249.92.173] (HELO ug-out-1314.google.com) (66.249.92.173) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2007 17:41:41 +0000 Received: by ug-out-1314.google.com with SMTP id h2so741802ugf for ; Fri, 02 Nov 2007 10:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=TqjpLPxx9nA8KisGI8DpYrSaJpFUqjmKglFNiaP2LLg=; b=bz5Na5dXvoI5WC+gH8VWPQQZrkfy+9Yo4R3UQ1XviZFmJUFofP6M5ChvnopJ4u6T9W4IMZiH71fqA8OgHhT9wM+5hg/9DfUI/4/M8cGjbMAE9PSi1iWjkNcMOPWFgafUAm+DCPbju4h7weGZykwBn8Qu+NaNuMg0HtytdnJmsuA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=f5a6bMSmXNjVwnBH8db/iSoVV7Y8atpdfyB9JvRZqtQBI/YfxGudROlVw7gnwYXuYqB4YXbnAj9euD+ucqWq+llBMvagDNwthPLkz7Iq2SRptgWS4x/UAzfOjV9AZBNN1hVtE8oJfz6WUs77+Dmq28Lr/pOxi3xUhyKw3TfOASg= Received: by 10.66.237.9 with SMTP id k9mr1521031ugh.1194025279382; Fri, 02 Nov 2007 10:41:19 -0700 (PDT) Received: by 10.67.93.8 with HTTP; Fri, 2 Nov 2007 10:41:19 -0700 (PDT) Message-ID: Date: Fri, 2 Nov 2007 11:41:19 -0600 From: "Larry Meadors" Reply-To: lmeadors@apache.org Sender: larry.meadors@gmail.com To: user-java@ibatis.apache.org Subject: Re: HowTo add parameter to part of regex in select In-Reply-To: <472B5D35.3010701@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <472B5D35.3010701@gmx.de> X-Google-Sender-Auth: 90584ec9bc2d7f48 X-Virus-Checked: Checked by ClamAV on apache.org You could to this: SELECT * FROM table WHERE REGEXP_LIKE (id, '^($id$)\-[0]{4}[0-9][0-9][A-Z][0-9]{2}[A-Z]$$') Doing this will open you up to SQL injection, so if id =3D " ');drop table some_important_data; --", you'll be pissed. I'd build the regex in java code and pass it in that way. Larry On 11/2/07, Heinrich G=F6tzger wrote: > Hi, > > is there a possibility to get following to run with iBATIS? > > SELECT * FROM table WHERE > REGEXP_LIKE (id, '^(#id#)\-[0]{4}[0-9][0-9][A-Z][0-9]{2}[A-Z]$') > > (remark: this is not working) > > or would I need to prepare the regexp in the java-part and use it like: > > SELECT * FROM table WHERE > REGEXP_LIKE (id, #id#) > > (remark: this is working) > > Or in other words: can i get iBATIS to only get part of the regex passed > and add it to the rest of an existing expression or would I need to > build the complete expression in Java and pass it as a regular > (string-)parameter to iBATIS-Layer? > > Thanks, cheers > > Heinrich >