Empact-ar-extensions 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. data/ChangeLog +145 -0
  2. data/README +167 -0
  3. data/Rakefile +61 -0
  4. data/config/database.yml +7 -0
  5. data/config/database.yml.template +7 -0
  6. data/config/mysql.schema +72 -0
  7. data/config/postgresql.schema +39 -0
  8. data/db/migrate/generic_schema.rb +97 -0
  9. data/db/migrate/mysql_schema.rb +32 -0
  10. data/db/migrate/oracle_schema.rb +5 -0
  11. data/db/migrate/version.rb +4 -0
  12. data/init.rb +31 -0
  13. data/lib/ar-extensions.rb +5 -0
  14. data/lib/ar-extensions/adapters/abstract_adapter.rb +146 -0
  15. data/lib/ar-extensions/adapters/mysql.rb +10 -0
  16. data/lib/ar-extensions/adapters/oracle.rb +14 -0
  17. data/lib/ar-extensions/adapters/postgresql.rb +9 -0
  18. data/lib/ar-extensions/adapters/sqlite.rb +7 -0
  19. data/lib/ar-extensions/create_and_update.rb +508 -0
  20. data/lib/ar-extensions/create_and_update/mysql.rb +7 -0
  21. data/lib/ar-extensions/csv.rb +309 -0
  22. data/lib/ar-extensions/delete.rb +143 -0
  23. data/lib/ar-extensions/delete/mysql.rb +3 -0
  24. data/lib/ar-extensions/extensions.rb +509 -0
  25. data/lib/ar-extensions/finder_options.rb +275 -0
  26. data/lib/ar-extensions/finder_options/mysql.rb +6 -0
  27. data/lib/ar-extensions/finders.rb +96 -0
  28. data/lib/ar-extensions/foreign_keys.rb +70 -0
  29. data/lib/ar-extensions/fulltext.rb +62 -0
  30. data/lib/ar-extensions/fulltext/mysql.rb +44 -0
  31. data/lib/ar-extensions/import.rb +354 -0
  32. data/lib/ar-extensions/import/mysql.rb +50 -0
  33. data/lib/ar-extensions/import/postgresql.rb +0 -0
  34. data/lib/ar-extensions/import/sqlite.rb +22 -0
  35. data/lib/ar-extensions/insert_select.rb +178 -0
  36. data/lib/ar-extensions/insert_select/mysql.rb +7 -0
  37. data/lib/ar-extensions/synchronize.rb +30 -0
  38. data/lib/ar-extensions/temporary_table.rb +131 -0
  39. data/lib/ar-extensions/temporary_table/mysql.rb +3 -0
  40. data/lib/ar-extensions/union.rb +204 -0
  41. data/lib/ar-extensions/union/mysql.rb +6 -0
  42. data/lib/ar-extensions/util/sql_generation.rb +27 -0
  43. data/lib/ar-extensions/util/support_methods.rb +32 -0
  44. data/lib/ar-extensions/version.rb +9 -0
  45. metadata +128 -0
@@ -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
@@ -0,0 +1,9 @@
1
+
2
+ module ActiveRecord # :nodoc:
3
+ module Extensions # :nodoc:
4
+ module VERSION
5
+ MAJOR, MINOR, REVISION = %W( 0 9 2 )
6
+ STRING = [ MAJOR, MINOR, REVISION ].join( '.' )
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Empact-ar-extensions
3
+ version: !ruby/object:Gem::Version
4
+ hash: 63
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 9
9
+ - 2
10
+ version: 0.9.2
11
+ platform: ruby
12
+ authors:
13
+ - Zach Dennis
14
+ - Mark Van Holstyn
15
+ - Blythe Dunham
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2009-04-20 00:00:00 -04:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: activerecord
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 15
32
+ segments:
33
+ - 2
34
+ - 1
35
+ - 2
36
+ version: 2.1.2
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ description: Extends ActiveRecord functionality by adding better finder/query support, as well as supporting mass data import, foreign key, CSV and temporary tables
40
+ email: zach.dennis@gmail.com
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files:
46
+ - README
47
+ files:
48
+ - init.rb
49
+ - db/migrate/generic_schema.rb
50
+ - db/migrate/mysql_schema.rb
51
+ - db/migrate/oracle_schema.rb
52
+ - db/migrate/version.rb
53
+ - Rakefile
54
+ - ChangeLog
55
+ - README
56
+ - config/database.yml
57
+ - config/database.yml.template
58
+ - config/mysql.schema
59
+ - config/postgresql.schema
60
+ - lib/ar-extensions/adapters/abstract_adapter.rb
61
+ - lib/ar-extensions/adapters/mysql.rb
62
+ - lib/ar-extensions/adapters/oracle.rb
63
+ - lib/ar-extensions/adapters/postgresql.rb
64
+ - lib/ar-extensions/adapters/sqlite.rb
65
+ - lib/ar-extensions/create_and_update/mysql.rb
66
+ - lib/ar-extensions/create_and_update.rb
67
+ - lib/ar-extensions/csv.rb
68
+ - lib/ar-extensions/delete/mysql.rb
69
+ - lib/ar-extensions/delete.rb
70
+ - lib/ar-extensions/extensions.rb
71
+ - lib/ar-extensions/finder_options/mysql.rb
72
+ - lib/ar-extensions/finder_options.rb
73
+ - lib/ar-extensions/finders.rb
74
+ - lib/ar-extensions/foreign_keys.rb
75
+ - lib/ar-extensions/fulltext/mysql.rb
76
+ - lib/ar-extensions/fulltext.rb
77
+ - lib/ar-extensions/import/mysql.rb
78
+ - lib/ar-extensions/import/postgresql.rb
79
+ - lib/ar-extensions/import/sqlite.rb
80
+ - lib/ar-extensions/import.rb
81
+ - lib/ar-extensions/insert_select/mysql.rb
82
+ - lib/ar-extensions/insert_select.rb
83
+ - lib/ar-extensions/synchronize.rb
84
+ - lib/ar-extensions/temporary_table/mysql.rb
85
+ - lib/ar-extensions/temporary_table.rb
86
+ - lib/ar-extensions/union/mysql.rb
87
+ - lib/ar-extensions/union.rb
88
+ - lib/ar-extensions/util/sql_generation.rb
89
+ - lib/ar-extensions/util/support_methods.rb
90
+ - lib/ar-extensions/version.rb
91
+ - lib/ar-extensions.rb
92
+ has_rdoc: true
93
+ homepage: http://www.continuousthinking.com/tags/arext
94
+ licenses: []
95
+
96
+ post_install_message:
97
+ rdoc_options:
98
+ - --main
99
+ - README
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ hash: 3
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ requirements: []
121
+
122
+ rubyforge_project: arext
123
+ rubygems_version: 1.3.7
124
+ signing_key:
125
+ specification_version: 3
126
+ summary: Extends ActiveRecord functionality.
127
+ test_files: []
128
+