Closed jeremyevans closed 6 years ago
This was intentional because we wanted warn when people had FreeTDS < than v1.0. This was to head off issues with UTF data. I went ahead and changed the message in master for the next version. Information history on the topic below.
Can you switch from rb_warn
to rb_warning
so it only warns in verbose mode? Alternatively, can you support some other option for people to stop the warning from appearing? For people who rely on the distro's version of FreeTDS and don't have control, it's annoying to get a warning you cannot readily fix, especially for something that will never affect you (none of the databases I connect to are going to care about the UCS-2 vs. UTF-16 difference).
don't have control cannot readily fix
It has been a few years, I thought the distros would be updated, what version are you on?
especially for something that will never affect you
Not sure that is true. It is very common nowadays to deal with emoji and wide characters in the DB.
Can you switch from rb_warn to rb_warning
Neat idea... let me consider that.
I'm on FreeTDS version 0.95.95, as that's still the default on OpenBSD.
It is very common nowadays to deal with emoji and wide characters in the DB.
Not in the databases I deal with :) I understand the reason behind the warning and agree that UTF-16 is a better default, I'd just like a way to turn the warning off, since for me it is just annoying.
Thanks for sharing Jeremy. Still torn, in some way, this is a deprecation on 0.95 and deprecations show in non-verbose mode. That said... I'm not seeing a clear reason to deprecate 0.95 now, but its day is coming. I'll change it to rb_warning
OK, that was changed in master to rb_warning
and I am working on release v2.1.2 now. Thanks again @jeremyevans for taking the time to report and talk about these issues.
tiny_tds forces the
:use_utf16
value totrue
orfalse
before calling connect (https://github.com/rails-sqlserver/tiny_tds/blob/master/lib/tiny_tds/client.rb#L52), and if the value istrue
orfalse
, emits a warning inside connect (https://github.com/rails-sqlserver/tiny_tds/blob/master/ext/tiny_tds/client.c#L364-L366).I think there are a couple options here. You could skip forcing the
:use_utf16
value totrue
if the:use_utf16=>nil
option is used, either usingHash#fetch
orHash#has_key?
to check if the value is explicitly given asnil
, and leave it asnil
in that case. Alternatively, maybe just do not warn if the value isfalse
.