Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 29635 invoked from network); 19 Dec 2003 22:31:01 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 19 Dec 2003 22:31:01 -0000 Received: (qmail 59966 invoked by uid 500); 19 Dec 2003 22:30:47 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 59944 invoked by uid 500); 19 Dec 2003 22:30:47 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 59930 invoked from network); 19 Dec 2003 22:30:46 -0000 Received: from unknown (HELO mail.gmx.net) (213.165.64.20) by daedalus.apache.org with SMTP; 19 Dec 2003 22:30:46 -0000 Received: (qmail 15914 invoked by uid 65534); 19 Dec 2003 22:30:51 -0000 Received: from adsl-62-167-199-211.adslplus.ch (EHLO gmx.ch) (62.167.199.211) by mail.gmx.net (mp021) with SMTP; 19 Dec 2003 23:30:51 +0100 X-Authenticated: #15507884 Message-ID: <3FE37C15.2050600@gmx.ch> Date: Fri, 19 Dec 2003 23:30:45 +0100 From: Jakob Braeuchi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List Subject: Re: PlatformMySQLImpl bug fix References: <000c01c3c5b5$5dd68c40$0200a8c0@mozart> In-Reply-To: <000c01c3c5b5$5dd68c40$0200a8c0@mozart> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N hi michael, thanks for the patch, it's available in repository now. jakob Michael Mogley wrote: > All, > > I just fixed a bug in PlatformMySQLImpl that prevents char[] types from being persisted as CLOBs. Here is the new setObjectForStatement method: > > public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType) throws SQLException > { > switch (sqlType) > { > case Types.BIT : > ps.setObject(index, value); > break; > > case Types.BLOB : > case Types.LONGVARBINARY : > case Types.VARBINARY : > if (value instanceof byte[]) > { > byte buf[] = (byte[]) value; > ByteArrayInputStream inputStream = new ByteArrayInputStream(buf); > ps.setBinaryStream(index, inputStream, buf.length); > > break; > } > > case Types.CLOB : > Reader reader = null; > int length = 0; > > if (value instanceof String) > { > reader = new StringReader((String) value); > length = (((String) value)).length(); > } > else if (value instanceof char[]) > { > String string = new String((char[])value); > reader = new StringReader(string); > length = string.length(); > } > else if (value instanceof byte[]) > { > byte buf[] = (byte[]) value; > ByteArrayInputStream inputStream = new ByteArrayInputStream(buf); > reader = new InputStreamReader(inputStream); > } > > ps.setCharacterStream(index, reader, length); > break; > > default : > super.setObjectForStatement(ps, index, value, sqlType); > > } > } > > Michael --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org