ironruby-sqlserver 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +6 -0
- data/README.txt +12 -0
- data/Rakefile +14 -0
- data/lib/activerecord-sqlserver-adapter/adonet_patch.rb +39 -0
- data/lib/ironruby_sqlserver.rb +13 -0
- metadata +117 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
|
6
|
+
Hoe.spec 'ironruby-sqlserver' do
|
7
|
+
developer 'Jimmy Schementi', 'jschementi@gmail.com'
|
8
|
+
self.url = 'http://github.com/jschementi/ironruby-sqlserver'
|
9
|
+
extra_deps << ['ironruby-dbi', '>=0']
|
10
|
+
extra_deps << ['activerecord', '>=0']
|
11
|
+
extra_deps << ['activerecord-sqlserver-adapter', '>=0']
|
12
|
+
end
|
13
|
+
|
14
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Monkey patch SQLServerAdapter. This should be moved into SQLServerAdapter itself in activerecord-sqlserver-adapter\lib\active_record\connection_adapters\sqlserver_adapter.rb
|
2
|
+
module ActiveRecord
|
3
|
+
class Base
|
4
|
+
def self.sqlserver_connection(config) #:nodoc:
|
5
|
+
config.symbolize_keys!
|
6
|
+
mode = config[:mode] ? config[:mode].to_s.upcase : 'ADO'
|
7
|
+
username = config[:username] ? config[:username].to_s : 'sa'
|
8
|
+
password = config[:password] ? config[:password].to_s : ''
|
9
|
+
database = config[:database]
|
10
|
+
host = config[:host] ? config[:host].to_s : 'localhost'
|
11
|
+
integrated_security = config[:integrated_security]
|
12
|
+
|
13
|
+
if mode == "ODBC"
|
14
|
+
raise ArgumentError, "Missing DSN. Argument ':dsn' must be set in order for this adapter to work." unless config.has_key?(:dsn)
|
15
|
+
dsn = config[:dsn]
|
16
|
+
driver_url = "DBI:ODBC:#{dsn}"
|
17
|
+
connection_options = [driver_url, username, password]
|
18
|
+
elsif mode == "ADO"
|
19
|
+
raise ArgumentError, "Missing Database. Argument ':database' must be set in order for this adapter to work." unless config.has_key?(:database)
|
20
|
+
if integrated_security
|
21
|
+
connection_options = ["DBI:ADO:Provider=SQLOLEDB;Data Source=#{host};Initial Catalog=#{database};Integrated Security=SSPI"]
|
22
|
+
else
|
23
|
+
driver_url = "DBI:ADO:Provider=SQLOLEDB;Data Source=#{host};Initial Catalog=#{database};User ID=#{username};Password=#{password};"
|
24
|
+
connection_options = [driver_url, username, password]
|
25
|
+
end
|
26
|
+
elsif mode == "ADONET"
|
27
|
+
raise ArgumentError, "Missing Database. Argument ':database' must be set in order for this adapter to work." unless config.has_key?(:database)
|
28
|
+
if integrated_security
|
29
|
+
connection_options = ["DBI:MSSQL:server=#{host};initial catalog=#{database};integrated security=true"]
|
30
|
+
else
|
31
|
+
connection_options = ["DBI:MSSQL:server=#{host};initial catalog=#{database};user id=#{username};password=#{password}"]
|
32
|
+
end
|
33
|
+
else
|
34
|
+
raise "Unknown mode #{mode}"
|
35
|
+
end
|
36
|
+
ConnectionAdapters::SQLServerAdapter.new(logger, connection_options)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class IronrubySqlserver
|
2
|
+
VERSION = '0.1.0'
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
gem 'activerecord'
|
7
|
+
gem 'ironruby-dbi'
|
8
|
+
gem 'activerecord-sqlserver-adapter'
|
9
|
+
|
10
|
+
require 'dbi'
|
11
|
+
require 'active_record'
|
12
|
+
require 'active_record/connection_adapters/sqlserver_adapter'
|
13
|
+
require 'activerecord-sqlserver-adapter/adonet_patch'
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ironruby-sqlserver
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jimmy Schementi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2010-01-14 00:00:00 -08:00
|
12
|
+
default_executable:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ironruby-dbi
|
16
|
+
type: :runtime
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: !str 0
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: activerecord
|
26
|
+
type: :runtime
|
27
|
+
version_requirement:
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: !str 0
|
33
|
+
version:
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: activerecord-sqlserver-adapter
|
36
|
+
type: :runtime
|
37
|
+
version_requirement:
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: !str 0
|
43
|
+
version:
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: rubyforge
|
46
|
+
type: :development
|
47
|
+
version_requirement:
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.0.3
|
53
|
+
version:
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: gemcutter
|
56
|
+
type: :development
|
57
|
+
version_requirement:
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.3.0
|
63
|
+
version:
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: hoe
|
66
|
+
type: :development
|
67
|
+
version_requirement:
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 2.5.0
|
73
|
+
version:
|
74
|
+
description: Wires up ActiveRecord to use SQLServer through IronRuby.
|
75
|
+
email:
|
76
|
+
- jschementi@gmail.com
|
77
|
+
executables: []
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files:
|
80
|
+
- History.txt
|
81
|
+
- Manifest.txt
|
82
|
+
- README.txt
|
83
|
+
files:
|
84
|
+
- History.txt
|
85
|
+
- Manifest.txt
|
86
|
+
- README.txt
|
87
|
+
- Rakefile
|
88
|
+
- lib/activerecord-sqlserver-adapter/adonet_patch.rb
|
89
|
+
- lib/ironruby_sqlserver.rb
|
90
|
+
has_rdoc: true
|
91
|
+
homepage: http://github.com/jschementi/ironruby-sqlserver
|
92
|
+
licenses: []
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options:
|
95
|
+
- --main
|
96
|
+
- README.txt
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: !str 0
|
104
|
+
version:
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: !str 0
|
110
|
+
version:
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project: ironruby-sqlserver
|
113
|
+
rubygems_version: 1.3.5
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Wires up ActiveRecord to use SQLServer through IronRuby.
|
117
|
+
test_files: []
|