Skip to content

Instantly share code, notes, and snippets.

View kubo's full-sized avatar

Kubo Takehiro kubo

  • Japan
View GitHub Profile
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include <stdio.h>
#include <dlfcn.h>
#include <link.h>
typedef struct OCIEnv OCIEnv;
typedef unsigned int ub4;
typedef int (*OCIEnvCreate_t)(OCIEnv **envp, ub4 mode, void *ctxp,
void *(*malocfp)(void *ctxp, size_t size),
@kubo
kubo / 01-mtime-subsec.dif
Last active July 1, 2017 02:52
https://github.com/oneclick/rubyinstaller2/issues/52 Apply 01-mtime-subsec.dif and then 02-file-utime.dif
diff --git a/dir.c b/dir.c
index 3db196f..426d0b6 100644
--- a/dir.c
+++ b/dir.c
@@ -1300,9 +1300,9 @@ to_be_ignored(int e)
}
#ifdef _WIN32
-#define STAT(p, s) rb_w32_ustati64((p), (s))
+#define STAT(p, s) rb_w32_ustati64ns((p), (s))
@kubo
kubo / select-number.c
Created February 13, 2017 13:35
ODPI-C issue
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dpi.h>
static dpiContext *gContext = NULL;
#define CHK_WITH_ERR(func, err) do { \
int rv = (func); \
if (rv < 0) { \
diff --git a/src/hot_patch.cc b/src/hot_patch.cc
index 5e4d7f2..759bcaf 100644
--- a/src/hot_patch.cc
+++ b/src/hot_patch.cc
@@ -279,6 +279,23 @@ static bool HookFunction(ULONG_PTR targetFunction, ULONG_PTR newFunction, ULONG_
if (ud_obj.mnemonic == UD_Ijmp || ud_obj.mnemonic == UD_Icall ||
ud_obj.operand[0].type == UD_OP_JIMM)
{
+#ifdef __i386__
+ const BYTE *pc = (const BYTE *)targetFunction + InstrSize;

This document has been obsolete since Oracle Instant Client 12.1 for OS X was released. The 12.1 client supports OS X 10.11 El Capitan, 10.10 Yosemite, and 10.9 Mavericks and can connect to Oracle Database 10.2 or later.

Look at [this document][inst] to install 12.1.

You should add the environment variable FORCE_RPATH to link with -rpath on compilation. (You have no need to set the environment variable at runtime.)

@kubo
kubo / install_node-oracledb_on_elcapitan.md
Last active March 14, 2023 04:10
Install node-oracledb on OS X 10.11 El Capitan

This document has been obsolete. Look at here instead.


The followings are obsolete.

This page is combination of node-oracledb document and ruby-oci8 document.

Some parts are copied from node-oracledb. Some parts are copied from ruby-oci8.

Install C compiler

require 'mkmf'
create_makefile('hide_loaded_oralib')
/*
* Test program for https://github.com/kubo/ruby-oci8/issues/55
*
* gcc -o ociconnect32 ociconnect.c -I$ORACLE_HOME/rdbms/public -L$ORACLE_HOME/lib32 -R$ORACLE_HOME/lib32 -lclntsh
* gcc -m64 -o ociconnect64 ociconnect.c -I$ORACLE_HOME/rdbms/public -L$ORACLE_HOME/lib -R$ORACLE_HOME/lib -lclntsh
*/
#include <stdio.h>
#include <unistd.h>
#include <oci.h>
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 2de46e4..b10507e 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -134,6 +134,11 @@ static void oci8_svcctx_init(oci8_base_t *base)
oci8_svcctx_t *svcctx = (oci8_svcctx_t *)base;
VALUE obj;
+#ifdef NATIVE_THREAD_WITH_GVL
+ svcctx->waiters.next = &svcctx->waiters;
@kubo
kubo / geometry-sample.rb
Last active December 10, 2015 09:39
This is sample code to bind GeoRuby objects as SDO_GEOMETRY datatype. See: https://github.com/rsim/oracle-enhanced/pull/268
require 'oci8'
require 'geo_ruby'
module OCI8::Object::Mdsys
class SdoGeometry < OCI8::Object::Base
set_typename('MDSYS.SDO_GEOMETRY')
end
end
class OCI8::BindType::GeoRuby < OCI8::BindType::Object