Module: ODPI

Defined in:
lib/odpi/pool.rb,
lib/odpi.rb,
lib/odpi/object.rb,
lib/odpi/version.rb,
lib/odpi/bindtype.rb,
lib/odpi/statement.rb,
lib/odpi/connection.rb,
ext/odpi_ext/rbdpi.c

Overview

connection.rb -- part of ruby-odpi

URL: https://github.com/kubo/ruby-odpi


Copyright 2017 Kubo Takehiro [email protected]

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the authors.

Defined Under Namespace

Modules: BindType, Dpi, Object Classes: Connection, Pool, Statement

Constant Summary collapse

VERSION =
"0.0.1"
RUBY_TO_ORACLE_ENCODING =
ruby_to_oracle_encoding_map

Class Method Summary collapse

Class Method Details

.connect(*args) ⇒ Object


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/odpi/connection.rb', line 35

def self.connect(*args)
  params = (args.last.is_a? Hash) ? args.pop : {}
  case args.length
  when 0
    username = params[:username]
    password = params[:password]
    database = params[:database]
    auth_mode = params[:auth_mode]
  when 1
    username, password, database, auth_mode = ODPI.parse_connect_string(args[0])
  else
    username, password, database, auth_mode = args
  end
  Connection.new(Dpi::Conn.new(username, password, database, auth_mode, params), true)
end

.default_encodingObject


43
44
45
46
# File 'ext/odpi_ext/rbdpi-create-params.c', line 43

static VALUE get_default_encoding(VALUE module)
{
    return default_encoding;
}

.default_encoding=(enc) ⇒ Object


48
49
50
51
52
53
54
# File 'ext/odpi_ext/rbdpi-create-params.c', line 48

static VALUE set_default_encoding(VALUE module, VALUE enc)
{
    rb_encoding *rbenc = rb_find_encoding(enc);
    default_encoding = rb_usascii_str_new_cstr(rb_enc_name(rbenc));
    RB_OBJ_FREEZE(default_encoding);
    return Qnil;
}

.default_nencodingObject


56
57
58
59
# File 'ext/odpi_ext/rbdpi-create-params.c', line 56

static VALUE get_default_nencoding(VALUE module)
{
    return default_nencoding;
}

.default_nencoding=(enc) ⇒ Object


61
62
63
64
65
66
67
# File 'ext/odpi_ext/rbdpi-create-params.c', line 61

static VALUE set_default_nencoding(VALUE module, VALUE enc)
{
    rb_encoding *rbenc = rb_find_encoding(enc);
    default_nencoding = rb_usascii_str_new_cstr(rb_enc_name(rbenc));
    RB_OBJ_FREEZE(default_nencoding);
    return Qnil;
}