Top Level Namespace

Defined Under Namespace

Modules: DBI, Logging, MiniRegistry Classes: ArgDef, FuncDef, MiniSOReader, Numeric, OCI8, OCIBreak, OCIContinue, OCIError, OCIException, OCIHandle, OCIInvalidHandle, OCINeedData, OCINoData, OCIStillExecuting, OCISuccessWithInfo, OraConf, OraConfFC, OraConfIC, OraDate, OraNumber, String

Constant Summary collapse

OCI_STMT_SELECT =

add compatible code with old versions.

:select_stmt
OCI_STMT_UPDATE =
:update_stmt
OCI_STMT_DELETE =
:delete_stmt
OCI_STMT_INSERT =
:insert_stmt
OCI_STMT_CREATE =
:create_stmt
OCI_STMT_DROP =
:drop_stmt
OCI_STMT_ALTER =
:alter_stmt
OCI_STMT_BEGIN =
:begin_stmt
OCI_STMT_DECLARE =
:declare_stmt
RUBY_OCI8_VERSION =
File.read("#{File.dirname(__FILE__)}/../../VERSION").chomp

Instance Method Summary collapse

Instance Method Details

#create_apiwrapObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'ext/oci8/apiwrap.rb', line 57

def create_apiwrap
  funcs = []
  YAML.load(open(File.dirname(__FILE__) + '/apiwrap.yml')).each do |key, val|
    funcs << FuncDef.new(key, val)
  end
  funcs.sort! do |a, b|
    if a.version == b.version
      a.name <=> b.name
    else
      a.version <=> b.version
    end
  end

  header_comment = <<EOS.chomp
/*
 * This file was created by apiwrap.rb.
 * Don't edit this file manually.
 */
EOS
#'

  erb = ERB.new(open(File.dirname(__FILE__) + '/apiwrap.h.tmpl').read)
  open('apiwrap.h', 'w') do |fd|
    fd.write(erb.result(binding))
  end

  erb = ERB.new(open(File.dirname(__FILE__) + '/apiwrap.c.tmpl').read)
  open('apiwrap.c', 'w') do |fd|
    fd.write(erb.result(binding))
  end
end

#macro_defined?(macro, src, opt = "") ⇒ Boolean

ruby 1.6 doesn’t have ‘macro_defined?’.

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'ext/oci8/oraconf.rb', line 5

def macro_defined?(macro, src, opt="")
  try_cpp(src + <<"SRC", opt)
#ifndef #{macro}
# error
#endif
SRC
end

#replace_keyword(source, target, replace) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'ext/oci8/extconf.rb', line 19

def replace_keyword(source, target, replace)
  puts "creating #{target} from #{source}"
  open(source, "rb") { |f|
    buf = f.read
    replace.each do |key, value|
      buf.gsub!('@@' + key + '@@', value)
    end
    open(target, "wb") {|fw|
      fw.write buf
    }
  }        
end