Return-Path: Delivered-To: apmail-openjpa-commits-archive@www.apache.org Received: (qmail 35578 invoked from network); 22 Oct 2008 23:31:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Oct 2008 23:31:23 -0000 Received: (qmail 69316 invoked by uid 500); 22 Oct 2008 23:31:25 -0000 Delivered-To: apmail-openjpa-commits-archive@openjpa.apache.org Received: (qmail 69298 invoked by uid 500); 22 Oct 2008 23:31:25 -0000 Mailing-List: contact commits-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 commits@openjpa.apache.org Received: (qmail 69289 invoked by uid 99); 22 Oct 2008 23:31:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Oct 2008 16:31:25 -0700 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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Oct 2008 23:30:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 573EB23888F4; Wed, 22 Oct 2008 16:30:32 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r707222 - in /openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql: DBDictionary.java SybaseDictionary.java Date: Wed, 22 Oct 2008 23:30:32 -0000 To: commits@openjpa.apache.org From: faywang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081022233032.573EB23888F4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: faywang Date: Wed Oct 22 16:30:31 2008 New Revision: 707222 URL: http://svn.apache.org/viewvc?rev=707222&view=rev Log: OPENJPA-745: raise exception when the string to be inserted or updated is longer than the column length. Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=707222&r1=707221&r2=707222&view=diff ============================================================================== --- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original) +++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Wed Oct 22 16:30:31 2008 @@ -199,6 +199,7 @@ public String selectWords = null; public String fixedSizeTypeNames = null; public String schemaCase = SCHEMA_CASE_UPPER; + public boolean setStringRightTruncationOn = true; // sql public String validationSQL = null; Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java?rev=707222&r1=707221&r2=707222&view=diff ============================================================================== --- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java (original) +++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java Wed Oct 22 16:30:31 2008 @@ -266,7 +266,18 @@ public Connection decorate(Connection conn) throws SQLException { - return new SybaseConnection(super.decorate(conn)); + conn = super.decorate(conn); + // In order for Sybase to raise the truncation exception when the + // string length is greater than the column length for Char, VarChar, + // Binary, VarBinary, the "set string_rtruncation on" must be executed. + // This setting is effective for the duration of current connection. + if (setStringRightTruncationOn) { + String str = "set string_rtruncation on"; + PreparedStatement stmnt = prepareStatement(conn, str); + stmnt.execute(); + stmnt.close(); + } + return new SybaseConnection(conn); } /**