Class: PLSQL::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/plsql/connection.rb

Direct Known Subclasses

JDBCConnection, OCIConnection

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_drv, raw_conn) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
# File 'lib/plsql/connection.rb', line 6

def initialize(raw_drv, raw_conn)
  @raw_driver = raw_drv
  @raw_connection = raw_conn
end

Instance Attribute Details

#raw_connectionObject (readonly)

Returns the value of attribute raw_connection.



3
4
5
# File 'lib/plsql/connection.rb', line 3

def raw_connection
  @raw_connection
end

#raw_driverObject (readonly)

Returns the value of attribute raw_driver.



4
5
6
# File 'lib/plsql/connection.rb', line 4

def raw_driver
  @raw_driver
end

Class Method Details

.create(raw_conn) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/plsql/connection.rb', line 11

def self.create(raw_conn)
  if !raw_conn.respond_to?(:java_class) && defined?(OCI8)
    OCIConnection.new(:oci, raw_conn)
  elsif raw_conn.respond_to?(:java_class) && raw_conn.java_class.to_s =~ /jdbc/
    JDBCConnection.new(:jdbc, raw_conn)
  else
    raise ArgumentError, "Unknown raw driver"
  end
end

Instance Method Details

#autocommit=(value) ⇒ Object

Raises:

  • (NoMethodError)


45
46
47
# File 'lib/plsql/connection.rb', line 45

def autocommit=(value)
  raise NoMethodError, "Not implemented for this raw driver"
end

#autocommit?Boolean

Returns:

  • (Boolean)

Raises:

  • (NoMethodError)


41
42
43
# File 'lib/plsql/connection.rb', line 41

def autocommit?
  raise NoMethodError, "Not implemented for this raw driver"
end

#commitObject

Raises:

  • (NoMethodError)


33
34
35
# File 'lib/plsql/connection.rb', line 33

def commit
  raise NoMethodError, "Not implemented for this raw driver"
end

#exec(sql, *bindvars) ⇒ Object

Raises:

  • (NoMethodError)


57
58
59
# File 'lib/plsql/connection.rb', line 57

def exec(sql, *bindvars)
  raise NoMethodError, "Not implemented for this raw driver"
end

#jdbc?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/plsql/connection.rb', line 25

def jdbc?
  @raw_driver == :jdbc
end

#logoffObject

Raises:

  • (NoMethodError)


29
30
31
# File 'lib/plsql/connection.rb', line 29

def logoff
  raise NoMethodError, "Not implemented for this raw driver"
end

#oci?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/plsql/connection.rb', line 21

def oci?
  @raw_driver == :oci
end

#parse(sql) ⇒ Object

Raises:

  • (NoMethodError)


61
62
63
# File 'lib/plsql/connection.rb', line 61

def parse(sql)
  raise NoMethodError, "Not implemented for this raw driver"
end

#rollbackObject

Raises:

  • (NoMethodError)


37
38
39
# File 'lib/plsql/connection.rb', line 37

def rollback
  raise NoMethodError, "Not implemented for this raw driver"
end

#select_all(sql, *bindvars, &block) ⇒ Object

Raises:

  • (NoMethodError)


53
54
55
# File 'lib/plsql/connection.rb', line 53

def select_all(sql, *bindvars, &block)
  raise NoMethodError, "Not implemented for this raw driver"
end

#select_first(sql, *bindvars) ⇒ Object

Raises:

  • (NoMethodError)


49
50
51
# File 'lib/plsql/connection.rb', line 49

def select_first(sql, *bindvars)
  raise NoMethodError, "Not implemented for this raw driver"
end