Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created September 4, 2010 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaskills/564826 to your computer and use it in GitHub Desktop.
Save metaskills/564826 to your computer and use it in GitHub Desktop.
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