class OCI8::OracleVersion
@see OCI8#oracle_server_version
@see OCI8.oracle_client_version
major, minor, update, patch and port_update.
Oracle version is represented by five numbers:
The data class, representing Oracle version.
def <=>(other)
-
(-1, 0, +1)
-
def <=>(other) @vernum <=> other.to_i end
def eql?(other)
-
(true or false)
-
def eql?(other) other.is_a? OCI8::OracleVersion and (self <=> other) == 0 end
def hash
-
(Integer)
-
def hash @vernum end
def initialize(arg, minor = nil, update = nil, patch = nil, port_update = nil)
-
(OCI8::OracleVersion)
-
def initialize(arg, minor = nil, update = nil, patch = nil, port_update = nil) if arg.is_a? String major, minor, update, patch, port_update = arg.split('.').collect do |v| v.to_i end elsif arg >= 0x12000000 major = (arg & 0xFF000000) >> 24 minor = (arg & 0x00FF0000) >> 16 update = (arg & 0x0000F000) >> 12 patch = (arg & 0x00000FF0) >> 4 port_update = (arg & 0x0000000F) elsif arg >= 0x08000000 major = (arg & 0xFF000000) >> 24 minor = (arg & 0x00F00000) >> 20 update = (arg & 0x000FF000) >> 12 patch = (arg & 0x00000F00) >> 8 port_update = (arg & 0x000000FF) else major = arg end @major = major @minor = minor || 0 @update = update || 0 @patch = patch || 0 @port_update = port_update || 0 @vernum = if @major >= 18 (@major << 24) | (@minor << 16) | (@update << 12) | (@patch << 4) | @port_update else (@major << 24) | (@minor << 20) | (@update << 12) | (@patch << 8) | @port_update end end
def inspect
- Private: -
def inspect "#<#{self.class.to_s}: #{self.to_s}>" end
def to_i
-
(Integer)
-
def to_i @vernum end
def to_s
-
(String)
-
def to_s version_format = if @major >= 23 && @patch != 0 && @port_update != 0 # The fifth numeral is the release month (01 through 12) since Oracle 23ai # See https://docs.oracle.com/en/database/oracle/oracle-database/23/upgrd/oracle-database-release-numbers.html#GUID-1E2F3945-C0EE-4EB2-A933-8D1862D8ECE2__GUID-704EC7BB-4EEA-4A92-96FC-579B216DCA97 '%d.%d.%d.%d.%02d' else '%d.%d.%d.%d.%d' end format(version_format, @major, @minor, @update, @patch, @port_update) end