ar-extensions 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ #insert select functionality is dependent on finder options
2
+ require 'ar-extensions/finder_options/mysql'
3
+
4
+ ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
5
+ include ActiveRecord::Extensions::Union::UnionSupport
6
+ end
@@ -0,0 +1,27 @@
1
+
2
+ #Extend this module on ActiveRecord to access global functions
3
+ module ActiveRecord
4
+ module Extensions
5
+ module SqlGeneration#:nodoc:
6
+
7
+ protected
8
+
9
+ def post_sql_statements(options)#:nodoc:
10
+ connection.post_sql_statements(quoted_table_name, options).join(' ')
11
+ end
12
+
13
+ def pre_sql_statements(options)#:nodoc:
14
+ connection.pre_sql_statements({:command => 'SELECT'}.merge(options)).join(' ').strip + " "
15
+ end
16
+
17
+ def construct_ar_extension_sql(options={}, valid_options = [], &block)#:nodoc:
18
+ options.assert_valid_keys(valid_options)if valid_options.any?
19
+
20
+ sql = pre_sql_statements(options)
21
+ yield sql, options
22
+ sql << post_sql_statements(options)
23
+ sql
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ #Extend this module on ActiveRecord to access global functions
2
+ class ExtensionNotSupported < Exception; end;
3
+
4
+ module ActiveRecord
5
+ module Extensions
6
+ module SupportMethods#:nodoc:
7
+ def supports_extension(name)
8
+ class_eval(<<-EOS, __FILE__, __LINE__)
9
+ def self.supports_#{name}?#:nodoc:
10
+ connection.supports_#{name}?
11
+ rescue NoMethodError
12
+ false
13
+ end
14
+
15
+ def supports_#{name}?#:nodoc:
16
+ self.class.supports_#{name}?
17
+ end
18
+
19
+ def self.supports_#{name}!#:nodoc:
20
+ supports_#{name}? or raise ExtensionNotSupported.new("#{name} extension is not supported. Please require the adapter file.")
21
+ end
22
+
23
+ def supports_#{name}!#:nodoc:
24
+ self.class.supports_#{name}!
25
+ end
26
+ EOS
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ ActiveRecord::Base.send :extend, ActiveRecord::Extensions::SupportMethods
@@ -2,7 +2,7 @@
2
2
  module ActiveRecord # :nodoc:
3
3
  module Extensions # :nodoc:
4
4
  module VERSION
5
- MAJOR, MINOR, REVISION = %W( 0 8 2 )
5
+ MAJOR, MINOR, REVISION = %W( 0 9 0 )
6
6
  STRING = [ MAJOR, MINOR, REVISION ].join( '.' )
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
8
  - Mark Van Holstyn
9
+ - Blythe Dunham
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2009-02-09 00:00:00 -05:00
14
+ date: 2009-04-20 00:00:00 -04:00
14
15
  default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
@@ -50,8 +51,14 @@ files:
50
51
  - lib/ar-extensions/adapters/oracle.rb
51
52
  - lib/ar-extensions/adapters/postgresql.rb
52
53
  - lib/ar-extensions/adapters/sqlite.rb
54
+ - lib/ar-extensions/create_and_update/mysql.rb
55
+ - lib/ar-extensions/create_and_update.rb
53
56
  - lib/ar-extensions/csv.rb
57
+ - lib/ar-extensions/delete/mysql.rb
58
+ - lib/ar-extensions/delete.rb
54
59
  - lib/ar-extensions/extensions.rb
60
+ - lib/ar-extensions/finder_options/mysql.rb
61
+ - lib/ar-extensions/finder_options.rb
55
62
  - lib/ar-extensions/finders.rb
56
63
  - lib/ar-extensions/foreign_keys.rb
57
64
  - lib/ar-extensions/fulltext/mysql.rb
@@ -60,9 +67,15 @@ files:
60
67
  - lib/ar-extensions/import/postgresql.rb
61
68
  - lib/ar-extensions/import/sqlite.rb
62
69
  - lib/ar-extensions/import.rb
70
+ - lib/ar-extensions/insert_select/mysql.rb
71
+ - lib/ar-extensions/insert_select.rb
63
72
  - lib/ar-extensions/synchronize.rb
64
73
  - lib/ar-extensions/temporary_table/mysql.rb
65
74
  - lib/ar-extensions/temporary_table.rb
75
+ - lib/ar-extensions/union/mysql.rb
76
+ - lib/ar-extensions/union.rb
77
+ - lib/ar-extensions/util/sql_generation.rb
78
+ - lib/ar-extensions/util/support_methods.rb
66
79
  - lib/ar-extensions/version.rb
67
80
  - lib/ar-extensions.rb
68
81
  has_rdoc: true