Title: [623] trunk/activerecord-jdbc: JRUBY-922: hopefully that's the last of the UTF-8 issues, thanks Shinya Kasatani
- Revision
- 623
- Author
- nicksieger
- Date
- 2007-06-13 12:32:15 -0400 (Wed, 13 Jun 2007)
Log Message
JRUBY-922: hopefully that's the last of the UTF-8 issues, thanks Shinya Kasatani
Modified Paths
Diff
Modified: trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java (622 => 623)
--- trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java 2007-06-13 15:51:50 UTC (rev 622)
+++ trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java 2007-06-13 16:32:15 UTC (rev 623)
@@ -573,13 +573,13 @@
if(rss == null || rs.wasNull()) {
return runtime.getNil();
}
- ByteList str2 = new ByteList(2048);
+ StringBuffer str2 = new StringBuffer(2048);
char[] cuf = new char[2048];
while((n = rss.read(cuf)) != -1) {
- str2.append(ByteList.plain(cuf), 0, n);
+ str2.append(cuf, 0, n);
}
rss.close();
- return runtime.newString(str2);
+ return RubyString.newUnicodeString(runtime, str2.toString());
default:
String vs = rs.getString(row);
if(vs == null || rs.wasNull()) {
Modified: trunk/activerecord-jdbc/test/simple.rb (622 => 623)
--- trunk/activerecord-jdbc/test/simple.rb 2007-06-13 15:51:50 UTC (rev 622)
+++ trunk/activerecord-jdbc/test/simple.rb 2007-06-13 16:32:15 UTC (rev 623)
@@ -138,16 +138,18 @@
end
def test_select_multibyte_string
- @java_con.createStatement().execute("insert into entries (title) values ('テスト')")
+ @java_con.createStatement().execute("insert into entries (title, content) values ('テスト', '本文')")
entry = Entry.find(:first)
assert_equal "テスト", entry.title
+ assert_equal "本文", entry.content
assert_equal entry, Entry.find_by_title("テスト")
end
def test_update_multibyte_string
- Entry.create!(:title => "テスト")
- rs = @java_con.createStatement().executeQuery("select title from entries")
+ Entry.create!(:title => "テスト", :content => "本文")
+ rs = @java_con.createStatement().executeQuery("select title, content from entries")
assert rs.next
assert_equal "テスト", rs.getString(1)
+ assert_equal "本文", rs.getString(2)
end
end
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel