-
Notifications
You must be signed in to change notification settings - Fork 189
Closed
Labels
Description
Output from LOGINPROPERTY builtin function is not correctly encoded
conn_params=['','sa','xxxx','192.168.0.20','1433','master']
conn=TinyTds::Client.new username: conn_params[1], password: conn_params[2], host: conn_params[3], port: conn_params[4], database: conn_params[5], azure:false
sql="SELECT LOGINPROPERTY('sa', 'IsLocked') as param)"
puts conn.encoding
puts result=conn.execute(sql).each
returns:
UTF-8
{"param"=>"\u0000\u0000\u0000\u0000"}
[Finished in 1.236s]
It looks that something wrong with output encoding.
I found temporary solution but the reason of this behavior will be useful.
I have converted value to int internally on sql server:
SELECT CONVERT(int,(SELECT LOGINPROPERTY('sa', 'IsLocked') as param))
in this case returned value from tiny_tds is correctly displayed