Skip to content

Commit

Permalink
Use two digits for ext part of Oracle 23 version string
Browse files Browse the repository at this point in the history
  • Loading branch information
kubo committed Jan 2, 2024
1 parent 093c872 commit 8353c9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/oci8/oci8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def inspect
# @see OCI8.oracle_client_version
# @return [OCI8::OracleVersion]
def oracle_server_version
@oracle_server_version ||= OCI8::OracleVersion.new(oracle_server_vernum)
@oracle_server_version ||= OCI8::OracleVersion.new(oracle_server_vernum, is_server_version: true)
end

# Returns the Oracle database character set name such as AL32UTF8.
Expand Down
9 changes: 7 additions & 2 deletions lib/oci8/oracle_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class OracleVersion
# oraver.port_update # => 0
#
# @return [OCI8::OracleVersion]
def initialize(arg, minor = nil, update = nil, patch = nil, port_update = nil)
def initialize(arg, minor = nil, update = nil, patch = nil, port_update = nil, is_server_version: false)
if arg.is_a? String
major, minor, update, patch, port_update = arg.split('.').collect do |v|
v.to_i
Expand Down Expand Up @@ -91,6 +91,7 @@ def initialize(arg, minor = nil, update = nil, patch = nil, port_update = nil)
else
(@major << 24) | (@minor << 20) | (@update << 12) | (@patch << 8) | @port_update
end
@is_server_version = is_server_version
end

# Compares +self+ and +other+.
Expand Down Expand Up @@ -127,7 +128,11 @@ def to_i
#
# @return [String]
def to_s
format('%d.%d.%d.%d.%d', @major, @minor, @update, @patch, @port_update)
if @is_server_version && @major >= 23
format('%d.%d.%d.%d.%02d', @major, @minor, @update, @patch, @port_update)
else
format('%d.%d.%d.%d.%d', @major, @minor, @update, @patch, @port_update)
end
end

# Returns true if +self+ and +other+ are the same type and have
Expand Down

0 comments on commit 8353c9e

Please sign in to comment.