Method: OCI8::OracleVersion#initialize
- Defined in:
- lib/oci8/oracle_version.rb
#initialize(arg, minor = nil, update = nil, patch = nil, port_update = nil) ⇒ OCI8::OracleVersion
Creates an OCI8::OracleVersion object.
If the first argument arg is a String, it is parsed as dotted version string. If it is bigger than 0x08000000, it is parsed as a number contains 5-digit Oracle version. Otherwise, it is used as a major version and the rest arguments are minor, update, patch and port_update. Unspecified version numbers are zeros by default.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/oci8/oracle_version.rb', line 64 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 |