Skip to content

Instantly share code, notes, and snippets.

View hannahwhy's full-sized avatar

Hannah Yip hannahwhy

View GitHub Profile
diff --git a/vm/builtin/nativefunction.cpp b/vm/builtin/nativefunction.cpp
index 82138a3..0ba88d9 100644
--- a/vm/builtin/nativefunction.cpp
+++ b/vm/builtin/nativefunction.cpp
@@ -656,8 +656,12 @@ namespace rubinius {
RootBuffer vrf(state->root_buffers(), args.arguments(), args.total());
void** values = ALLOCA_N(void*, ffi_data->arg_count);
+ void** heap_allocations = ALLOCA_N(void*, ffi_data->arg_count);
+ size_t i;
From 9c21a8ac478201a4b2f39f369d0d0cc63e9db188 Mon Sep 17 00:00:00 2001
From: David Yip <[email protected]>
Date: Tue, 4 Oct 2011 16:36:23 -0500
Subject: [PATCH] Allocate strings for FFI on the heap.
Strings passed to foreign functions can be quite large -- too large to
fit on the stack, and it's not always possible to detect an alloca(3)
failure.
Fixes #1185.
From 3e920367e10afc9a8c95585f888a643cc0603719 Mon Sep 17 00:00:00 2001
From: David Yip <[email protected]>
Date: Tue, 4 Oct 2011 16:56:28 -0500
Subject: [PATCH 1/2] Large-string example for Zlib::GzipWriter#write.
The expected size was generated by the following Ruby program running
under Ruby 1.8.7-p352:
require 'stringio'
require 'zlib'
From ea208c896d471195c16b1ba23836f29642a61b62 Mon Sep 17 00:00:00 2001
From: David Yip <[email protected]>
Date: Sun, 6 Nov 2011 23:55:06 -0600
Subject: [PATCH] A test case demonstrating that integer[] columns are mapped
to :string.
---
test/postgres_native_type_mapping_test.rb | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
$ ruby -v
jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (OpenJDK 64-Bit Server VM 1.6.0_23) [linux-amd64-java]
$ bundle exec ruby test.rb
-- create_table(:widgets, {:force=>true})
-> 0.6700s
-> 0 rows
ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: ERROR: column "location" is of type integer[] but expression is of type integer
Hint: You will need to rewrite or cast the expression.
Position: 44: INSERT INTO "widgets" ("location") VALUES (0) RETURNING "id"
log at /home/me/.rvm/gems/jruby-1.6.5/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:250
diff --git a/src/java/arjdbc/jdbc/RubyJdbcConnection.java b/src/java/arjdbc/jdbc/RubyJdbcConnection.java
index 3f4b30a..4c2bbbb 100644
--- a/src/java/arjdbc/jdbc/RubyJdbcConnection.java
+++ b/src/java/arjdbc/jdbc/RubyJdbcConnection.java
@@ -1052,12 +1052,18 @@ public class RubyJdbcConnection extends RubyObject {
int scale = intFromResultSet(resultSet, DECIMAL_DIGITS);
String type = resultSet.getString(TYPE_NAME);
+ int dataTypeCode = intFromResultSet(resultSet, DATA_TYPE);
+
Starting program: /home/trythil/src/rubinius/bin/rbx -rubygems -runicorn
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff5a30700 (LWP 6537)]
[New Thread 0x7ffff53cb700 (LWP 6542)]
Program received signal SIGABRT, Aborted.
0x00007ffff6a703a5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
Thread 3 (Thread 0x7ffff53cb700 (LWP 6542)):
#0 0x00000000008d2dc5 in llvm::SelectionDAG::getConstant(llvm::ConstantInt const&, llvm::EVT, bool) ()
source "http://rubygems.org"
gem 'connection_pool'
gem 'girl_friday'
gem 'mechanize'
gem 'redis'
Dear Friend:
Thank you for contacting me to urge that I oppose S. 968, the Protect
IP Act. I appreciate hearing from you.
I believe strong protections are needed to ensure that the intellectual
1.9.3p0 :001 > RUBY_DESCRIPTION
=> "ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]"
1.9.3p0 :002 > s = "abc"
=> "abc"
1.9.3p0 :003 > s.encoding
=> #<Encoding:UTF-8>
1.9.3p0 :004 > s.force_encoding 'utf-8'
=> "abc"
1.9.3p0 :005 > s.encoding
=> #<Encoding:UTF-8>