Title: [804] trunk/activerecord-jdbc/src/java/jdbc_adapter/ JdbcAdapterInternalService.java: Fix the unicode problems with Oracle when using TEXT fields
Revision
804
Author
olabini
Date
2007-11-22 08:48:44 -0500 (Thu, 22 Nov 2007)

Log Message

Fix the unicode problems with Oracle when using TEXT fields

Modified Paths


Diff

Modified: trunk/activerecord-jdbc/src/java/jdbc_adapter/JdbcAdapterInternalService.java (803 => 804)


--- trunk/activerecord-jdbc/src/java/jdbc_adapter/JdbcAdapterInternalService.java	2007-11-14 19:04:39 UTC (rev 803)
+++ trunk/activerecord-jdbc/src/java/jdbc_adapter/JdbcAdapterInternalService.java	2007-11-22 13:48:44 UTC (rev 804)
@@ -58,7 +58,8 @@
 import org.jruby.RubyString;
 import org.jruby.RubySymbol;
 import org.jruby.RubyTime;
-import org.jruby.exceptions.RaiseException;
+import org.jruby.
+exceptions.RaiseException;
 import org.jruby.javasupport.Java;
 import org.jruby.javasupport.JavaObject;
 import org.jruby.runtime.Arity;
@@ -993,13 +994,13 @@
                         + " = ? WHERE " + args[3] + "=" + args[4];
                 PreparedStatement ps = null;
                 try {
-                    ByteList outp = RubyString.objAsString(args[5]).getByteList();
                     ps = c.prepareStatement(sql);
                     if (args[0].isTrue()) { // binary
+                        ByteList outp = RubyString.objAsString(args[5]).getByteList();
                         ps.setBinaryStream(1, new ByteArrayInputStream(outp.bytes, 
                                 outp.begin, outp.realSize), outp.realSize);
                     } else { // clob
-                        String ss = outp.toString();
+                        String ss = args[5].convertToString().getUnicodeValue();
                         ps.setCharacterStream(1, new StringReader(ss), ss.length());
                     }
                     ps.executeUpdate();
@@ -1088,4 +1089,4 @@
         return config_hash.callMethod(runtime.getCurrentContext(), 
                 "[]", new IRubyObject[] {runtime.newSymbol(key)}, Block.NULL_BLOCK);
     }
-}
\ No newline at end of file
+}
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to