Skip to content

Instantly share code, notes, and snippets.

View kubo's full-sized avatar

Kubo Takehiro kubo

  • Japan
View GitHub Profile
@kubo
kubo / gist:655114
Created October 30, 2010 08:51
NCHAR/NVARCHAR patch for ruby-oci8 2.0
See: http://rubyforge.org/forum/forum.php?thread_id=48838&forum_id=1078
Index: ext/oci8/bind.c
===================================================================
--- ext/oci8/bind.c (revision 411)
+++ ext/oci8/bind.c (working copy)
@@ -67,7 +67,8 @@
NULL,
NULL,
NULL,
@kubo
kubo / bind_null_to_object_type.dif
Created December 3, 2010 12:36
patch to bind null to object type for ruby-oci8 2.0.4
Index: ext/oci8/object.c
===================================================================
--- ext/oci8/object.c (revision 411)
+++ ext/oci8/object.c (working copy)
@@ -248,6 +248,25 @@
return Qnil;
}
+static VALUE oci8_named_type_null_p(VALUE self)
+{
Index: ext/oci8/ocidatetime.c
===================================================================
--- ext/oci8/ocidatetime.c (revision 411)
+++ ext/oci8/ocidatetime.c (working copy)
@@ -102,7 +102,7 @@
#if defined RUNTIME_API_CHECK || ORACLE_CLIENT_VERSION >= ORAVER_9_0
-VALUE oci8_make_ocitimestamp(OCIDateTime *dttm)
+VALUE oci8_make_ocitimestamp(OCIDateTime *dttm, void *hndl)
--- lib/rdoc/generator/template/darkfish/classpage.rhtml (revision 716)
+++ lib/rdoc/generator/template/darkfish/classpage.rhtml (working copy)
@@ -225,16 +225,22 @@
<div id="<%= method.html_name %>-method" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
<a name="<%= h method.aref %>"></a>
+ <% if method.call_seq %>
+ <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
<div class="method-heading">
- <% if method.call_seq %>
require 'mkmf'
unless defined? macro_defined?
# ruby 1.6 doesn't have 'macro_defined?'.
def macro_defined?(macro, src, opt="")
try_cpp(src + <<"SRC", opt)
#ifndef #{macro}
# error
#endif
SRC
===================================================================
--- ext/oci8/oci8lib.c (revision 411)
+++ ext/oci8/oci8lib.c (working copy)
@@ -32,7 +32,9 @@
base->klass->free(base);
if (base->type >= OCI_DTYPE_FIRST)
OCIDescriptorFree(base->hp.ptr, base->type);
- else if (base->type >= OCI_HTYPE_FIRST)
+ else if (base->type >= OCI_HTYPE_FIRST &&
+ base->type != OCI_HTYPE_DEFINE &&
Index: ext/oci8/oci8.h
===================================================================
--- ext/oci8/oci8.h (revision 411)
+++ ext/oci8/oci8.h (working copy)
@@ -174,7 +174,7 @@
/* macros to access thread-local storage.
*
- * int oci8_tls_key_init(oci8_tls_key_t *key);
+ * int oci8_tls_key_init(oci8_tls_key_t *key, void (*destructor)(void*));
Index: ext/oci8/oci8.c
===================================================================
--- ext/oci8/oci8.c (revision 428)
+++ ext/oci8/oci8.c (working copy)
@@ -219,7 +219,7 @@
VALUE vmode;
oci8_svcctx_t *svcctx = DATA_PTR(self);
sword rv;
- enum logon_type_t logon_type = T_IMPLICIT;
+ enum logon_type_t logon_type = T_EXPLICIT;
Index: ext/oci8/oci8.h
===================================================================
--- ext/oci8/oci8.h (revision 447)
+++ ext/oci8/oci8.h (working copy)
@@ -422,6 +422,7 @@
void oci8_link_to_parent(oci8_base_t *base, oci8_base_t *parent);
void oci8_unlink_from_parent(oci8_base_t *base);
sword oci8_blocking_region(oci8_svcctx_t *svcctx, rb_blocking_function_t func, void *data);
+void oci8_blocking_function_epilogue(oci8_svcctx_t *svcctx, sword status);
sword oci8_exec_sql(oci8_svcctx_t *svcctx, const char *sql_text, ub4 num_define_vars, oci8_exec_sql_var_t *define_vars, ub4 num_bind_vars, oci8_exec_sql_var_t *bind_vars, int raise_on_error);
module YARD
module Templates::Helpers
module HtmlHelper
BINARY_OPERATORS = %w{ + - * / % ** << >> & | <= < > >= <=> == === =~ }.collect { |t| CGI.escapeHTML(t) }
alias signature_pre_change_binary_operators signature
def signature(*args)
html = signature_pre_change_binary_operators(*args)
if %r{\((.+?)\) <strong>(.+?)</strong>\((.+?)\)} =~ html and BINARY_OPERATORS.include? $2