Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7B85881FA for ; Sat, 20 Aug 2011 17:03:50 +0000 (UTC) Received: (qmail 17919 invoked by uid 500); 20 Aug 2011 17:03:50 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 17891 invoked by uid 500); 20 Aug 2011 17:03:49 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 17883 invoked by uid 99); 20 Aug 2011 17:03:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Aug 2011 17:03:48 +0000 X-ASF-Spam-Status: No, hits=-2001.1 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Aug 2011 17:03:47 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3CF4AC5646 for ; Sat, 20 Aug 2011 17:03:27 +0000 (UTC) Date: Sat, 20 Aug 2011 17:03:27 +0000 (UTC) From: "Milosz Tylenda (JIRA)" To: dev@openjpa.apache.org Message-ID: <1460252094.55890.1313859807246.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Work started] (OPENJPA-867) Unexpected Behaviour of DBDictionary.indexOf() method 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/OPENJPA-867?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Work on OPENJPA-867 started by Milosz Tylenda. > Unexpected Behaviour of DBDictionary.indexOf() method > ----------------------------------------------------- > > Key: OPENJPA-867 > URL: https://issues.apache.org/jira/browse/OPENJPA-867 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 1.2.0, 2.0.0-M2 > Environment: openjpa-jdbc 1.2.0 and trunk > Reporter: Alan Raison > Assignee: Milosz Tylenda > Priority: Minor > > There is potentially unexpected behaviour of the indexOf method of the DBDictionary class (org.apache.openjpa.jdbc.sql.DBDictionary) when a start index is specified but the search string is not found. > When a start index is specified (say "N"), the search target string has the first N characters removed, the search performed (by INSTR in the default case), this is reduced by 1 to make it 0-indexed and then crucially the start index in added to the result. > In Oracle, if the search term is not found, INSTR returns 0. If a start index is supplied, this is then added and 1 is taken away, so the "result of indexOf" will be "start index - 1" if the search string is not found. It may not be obvious whether, once a query is run, a number represents a successful match or not. > I would expect the case where the string is not found to return 0 or -1, depending on the index base. I think it is misleading for this to return a positive integer if the string is not found. > Since you cannot tell whether the string will be matched at the time the query is constructed, it may be difficult to find a fix for this. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira