activerecord-adonet-sqlserver 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,49 @@
1
+ = IronRuby DBI - Easing data access for ironruby
2
+
3
+ * http://github.com/casualjim/ironruby-dbi
4
+
5
+ == DESCRIPTION:
6
+
7
+ This project aims to provide adapters based on the .NET System.Data infrastructure.
8
+ It does so to make using existing ruby OR/M solutions easier to integrate.
9
+
10
+ == FEATURES/PROBLEMS:
11
+
12
+
13
+
14
+ == SYNOPSIS:
15
+
16
+
17
+
18
+
19
+ == REQUIREMENTS:
20
+
21
+ * To use the caricature library you need to have uuidtools installed
22
+ (sudo) gem install uuidtools
23
+ (sudo) igem install uuidtools
24
+
25
+ == INSTALL:
26
+
27
+ (sudo) igem install ironruby-dbi
28
+
29
+ == LICENSE:
30
+
31
+ Copyright (c) 2009 IronRuby-DBI team
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining a copy
34
+ of this software and associated documentation files (the "Software"), to deal
35
+ in the Software without restriction, including without limitation the rights
36
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
+ copies of the Software, and to permit persons to whom the Software is
38
+ furnished to do so, subject to the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be included in
41
+ all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
49
+ THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # WARNING : RAKE AUTO-GENERATED FILE. DO NOT MANUALLY EDIT!
2
+ # RUN : 'rake gem:update_gemspec'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.authors = ["Ivan Porto Carrero"]
6
+ s.description = "Wires up ActiveRecord to work with SQLServer through IronRuby."
7
+ s.email = "ivan@flanders.co.nz"
8
+ s.extra_rdoc_files = ["README.rdoc"]
9
+ s.files = ["README.rdoc",
10
+ "activerecord-adonet-sqlserver.gemspec",
11
+ "lib/activerecord_adonet_sqlserver.rb",
12
+ "lib/activerecord-adonet-sqlserver/integrated_security_patch.rb"]
13
+ s.has_rdoc = true
14
+ s.homepage = "http://casualjim.github.com/ironruby-dbi"
15
+ s.loaded = false
16
+ s.name = "activerecord-adonet-sqlserver"
17
+ s.platform = "ruby"
18
+ s.rdoc_options = ["--quiet", "--title", "Wires up ActiveRecord to work with SQLServer through IronRuby.", "--main", "README.rdoc"]
19
+ s.require_paths = ["lib"]
20
+ s.required_ruby_version = ">= 1.8.4"
21
+ s.required_rubygems_version = ">= 0"
22
+ s.rubyforge_project = "activerecord-adonet-sqlserver"
23
+ s.rubygems_version = "1.3.5"
24
+ s.specification_version = 3
25
+ s.add_runtime_dependency "dbd-adonet-sqlserver", "= 0.3.2"
26
+ s.summary = "Wires up ActiveRecord to work with SQLServer through IronRuby."
27
+ s.version = "0.3.2"
28
+ end
@@ -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,12 @@
1
+ $:.unshift File.expand_path(File.dirname(__FILE__))
2
+
3
+ gem 'activerecord'
4
+ gem 'dbi', ">= 0.4.3"
5
+ gem "activerecord-sqlserver-adapter", "= 2.3.1"
6
+
7
+ require 'dbi'
8
+ require 'dbd/mssql'
9
+ require 'active_record'
10
+ require 'active_record/connection_adapters/sqlserver_adapter'
11
+ require 'activerecord-adonet-adapter/integrated_security_patch'
12
+
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activerecord-adonet-sqlserver
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Porto Carrero
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-02 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: dbd-adonet-sqlserver
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.3.2
24
+ version:
25
+ description: Wires up ActiveRecord to work with SQLServer through IronRuby.
26
+ email: ivan@flanders.co.nz
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.rdoc
33
+ files:
34
+ - README.rdoc
35
+ - activerecord-adonet-sqlserver.gemspec
36
+ - lib/activerecord_adonet_sqlserver.rb
37
+ - lib/activerecord-adonet-sqlserver/integrated_security_patch.rb
38
+ has_rdoc: true
39
+ homepage: http://casualjim.github.com/ironruby-dbi
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options:
44
+ - --quiet
45
+ - --title
46
+ - Wires up ActiveRecord to work with SQLServer through IronRuby.
47
+ - --main
48
+ - README.rdoc
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.8.4
56
+ version:
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ requirements: []
64
+
65
+ rubyforge_project: activerecord-adonet-sqlserver
66
+ rubygems_version: 1.3.5
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Wires up ActiveRecord to work with SQLServer through IronRuby.
70
+ test_files: []
71
+