Created
September 4, 2010 02:15
-
-
Save metaskills/564826 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'odbc_utf8' | |
con = ODBC.connect 'vm2008', 'rails', '' | |
h = con.run "SELECT N'v' AS N'n'" | |
v = h.fetch.first # => ODBC::Error: HY003 (0) [unixODBC][FreeTDS][SQL Server]Program type out of range | |
v.encoding # => | |
h.drop | |
sth_runprc = con.run "EXEC sp_helpconstraint 'people', 'nomsg'" | |
sth_runprc.columns(true).map{|c|c.name} # => ["constraint_type", "constraint_name", "delete_action", "update_action", "status_enabled", "status_for_replication", "constraint_keys"] | |
sth_runprc.fetch_all # => ODBC::Error: HY003 (0) [unixODBC][FreeTDS][SQL Server]Program type out of range | |
sth_runprc.more_results # => | |
sth_runprc.drop | |
sth_runsel = con.run "SELECT N'v' AS N'n'" | |
sth_runsel.columns(true).map{|c|c.name} # => ["n"] | |
sth_runsel.columns(true).map{|c|c.name}[0].encoding # => #<Encoding:UTF-8> | |
sth_runsel.fetch_all # => ODBC::Error: HY003 (0) [unixODBC][FreeTDS][SQL Server]Program type out of range | |
sth_runsel.more_results # => | |
sth_runsel.drop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment