Skip to content

Commit

Permalink
add support for boolean datatypes on mssql
Browse files Browse the repository at this point in the history
  • Loading branch information
zgoldman-r7 committed Feb 21, 2024
1 parent d18520a commit 6dfdcc5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/rex/proto/mssql/client_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ def mssql_parse_tds_reply(data, info)
col[:id] = :int
col[:int_size] = data.slice!(0, 1).unpack('C')[0]

when 50
col[:id] = :sybbit
# col[:int_size] = data.slice!(0, 1).unpack('C')[0]

when 104
col[:id] = :bitntype
col[:int_size] = data.slice!(0, 1).unpack('C')[0]

when 127
col[:id] = :bigint

Expand Down Expand Up @@ -292,6 +300,17 @@ def mssql_parse_tds_row(data, info)
when :tinyint
row << data.slice!(0, 1).unpack("C")[0]

when :bitntype
has_value = data.slice!(0, 1).unpack("C")[0]
if has_value == 0
row << 'NULL'
else
row << data.slice!(0, 1).unpack("C")[0]
end

when :sybbit
row << data.slice!(0, 1).unpack("C")[0]

when :image
str = ''
len = data.slice!(0, 1).unpack('C')[0]
Expand Down Expand Up @@ -322,7 +341,6 @@ def mssql_parse_tds_row(data, info)
info[:errors] << "unknown column type: #{col.inspect}"
end
end

info[:rows] << row
info
end
Expand Down

0 comments on commit 6dfdcc5

Please sign in to comment.