Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 81525 invoked from network); 23 Nov 2003 10:53:59 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 23 Nov 2003 10:53:59 -0000 Received: (qmail 73501 invoked by uid 500); 23 Nov 2003 10:53:32 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 73345 invoked by uid 500); 23 Nov 2003 10:53:32 -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 73332 invoked from network); 23 Nov 2003 10:53:31 -0000 Received: from unknown (HELO mta11.adelphia.net) (68.168.78.205) by daedalus.apache.org with SMTP; 23 Nov 2003 10:53:31 -0000 Received: from mozart ([68.68.59.63]) by mta11.adelphia.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with SMTP id <20031123105349.PJEU1464.mta11.adelphia.net@mozart> for ; Sun, 23 Nov 2003 05:53:49 -0500 Message-ID: <003701c3b1b0$26f0c6a0$0200a8c0@mozart> From: "Michael Mogley" To: "OJB Developers List" References: <011b01c3b175$d73dd6f0$0200a8c0@mozart> <000901c3b18b$f4c9c420$0200a8c0@mozart> <3FC08AB3.8050804@gmx.ch> Subject: Re: fixed PlatformMySQLImpl to support LOBs Date: Sun, 23 Nov 2003 02:54:21 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 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 Cool! Thanks for putting it in so quickly. ----- Original Message ----- From: "Jakob Braeuchi" To: "OJB Developers List" Sent: Sunday, November 23, 2003 2:23 AM Subject: Re: fixed PlatformMySQLImpl to support LOBs > hi michael, > > thanks for the patch. it's available in cvs now. > > jakob > > Michael Mogley wrote: > > > All, > > > > I believe I've fixed the problem. The MySQL implementation was completely > > ignoring the special case of BLOB/CLOB. I simply copied the LOB treatment > > in PlatformOracleImpl and merged this into PlatformMySQLImpl, with some > > minor changes. Have not fully tested but it works fine for what I'm doing, > > which is inserting images into blob fields. > > > > I'm not sure yet how to create patches, so here is the changed method in > > PlatformMySQLImpl: > > > > /* > > * @see Platform#setObjectForStatement(PreparedStatement, int, Object, > > int) > > */ > > 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 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); > > break; > > } > > } > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > > For additional commands, e-mail: ojb-dev-help@db.apache.org > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org