activerecord-cubrid2-adapter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/LICENSE +21 -0
  4. data/README.md +63 -0
  5. data/Rakefile +11 -0
  6. data/VERSION +1 -0
  7. data/activerecord-cubrid2-adapter.gemspec +26 -0
  8. data/lib/active_record/connection_adapters/abstract_cubrid2_adapter.rb +750 -0
  9. data/lib/active_record/connection_adapters/cubrid2/column.rb +28 -0
  10. data/lib/active_record/connection_adapters/cubrid2/database_statements.rb +192 -0
  11. data/lib/active_record/connection_adapters/cubrid2/explain_pretty_printer.rb +71 -0
  12. data/lib/active_record/connection_adapters/cubrid2/quoting.rb +118 -0
  13. data/lib/active_record/connection_adapters/cubrid2/schema_creation.rb +98 -0
  14. data/lib/active_record/connection_adapters/cubrid2/schema_definitions.rb +81 -0
  15. data/lib/active_record/connection_adapters/cubrid2/schema_dumper.rb +31 -0
  16. data/lib/active_record/connection_adapters/cubrid2/schema_statements.rb +276 -0
  17. data/lib/active_record/connection_adapters/cubrid2/type_metadata.rb +31 -0
  18. data/lib/active_record/connection_adapters/cubrid2/version.rb +7 -0
  19. data/lib/active_record/connection_adapters/cubrid2_adapter.rb +169 -0
  20. data/lib/activerecord-cubrid2-adapter.rb +4 -0
  21. data/lib/arel/visitors/cubrid.rb +67 -0
  22. data/lib/cubrid2/client.rb +93 -0
  23. data/lib/cubrid2/console.rb +5 -0
  24. data/lib/cubrid2/error.rb +86 -0
  25. data/lib/cubrid2/field.rb +3 -0
  26. data/lib/cubrid2/result.rb +7 -0
  27. data/lib/cubrid2/statement.rb +11 -0
  28. data/lib/cubrid2/version.rb +3 -0
  29. data/lib/cubrid2.rb +76 -0
  30. data/tests/Gemfile +10 -0
  31. data/tests/test_activerecord.rb +109 -0
  32. metadata +102 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c06a871f89134bc5f13e2905a30968756ade6e68f72d7c227e5b186e65d05cd3
4
+ data.tar.gz: c20757cde7ba8620d30f8a6f5803695a1492f1690470a6bc0f0c13b21a8af375
5
+ SHA512:
6
+ metadata.gz: e47475a4c8728ac72673f88abc60ab53179d6397d97930bf475f0b1005e0fe956ebed46ad5c16a16800bb4689d99626e074ba2136e4bff9e88c5a517f3f79da2
7
+ data.tar.gz: 92bb1744b6427c10c923db59486e26c1687df128a63af79d842add0a3eb94d478d4db3fa0de6f73603aa25af074e3d517e1200d5d42af4b0696bed5e5c386759
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ .git
2
+
3
+ tmp
4
+ pkg
5
+
6
+ ext/
7
+ ext/*.o
8
+ ext/*.so
9
+ ext/Makefile
10
+
11
+ Gemfile.lock
12
+ csql.err
13
+ lib/cubrid/cubrid.so
14
+ tests/.byebug_history
15
+ tests/test_cubrid2.rb
16
+ tests/test_cubrid3.rb
17
+ tests/test_mysql.rb
18
+ tests/test_pg.rb
19
+
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2022 Eui-Taik Na
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # activerecord-cubrid2-adapter
2
+ Cubrid database connector for ruby, and active_record, depends on 'cubrid' gem
3
+
4
+ DESCRIPTION
5
+ -----------
6
+
7
+ Cubrid2 ActiveRecord adapter privides Cubrid database from Ruby on Rails applications. Now works with Ruby on Rails 6.0 and it is working with Cubrid database versions 9.x to higher.
8
+
9
+ BUILD
10
+ ------------
11
+ ```ruby
12
+ gem install rake-compiler
13
+ rake build
14
+ ```
15
+
16
+ INSTALLATION
17
+ ------------
18
+
19
+ ```ruby
20
+ # Use cubrid as the database for Active Record
21
+ gem 'cubrid' # cubrid interface gem, based on native CCI C interface
22
+ gem 'activerecord-cubrid2-adapter'
23
+ ```
24
+ Currently Rails <6.0, >=7.0, Windows, JRuby is not tested.
25
+
26
+ ### Without Rails and Bundler
27
+
28
+ If you want to use ActiveRecord and Cubrid2 adapter without Rails and Bundler then install it just as a gem:
29
+
30
+ ```bash
31
+ gem install activerecord-cubrid2-adapter
32
+ ```
33
+
34
+ USAGE
35
+ -----
36
+
37
+ ### Database connection
38
+
39
+ In Rails application `config/database.yml` use 'cubrid2' as adapter name, e.g.
40
+
41
+ ```yml
42
+ development:
43
+ adapter: cubrid2
44
+ host: localhost
45
+ database: testdb
46
+ username: user
47
+ password: secret
48
+ ```
49
+
50
+ EXAMPLE
51
+ -------------
52
+
53
+ Check test_activerecord.rb in the tests directory.
54
+
55
+
56
+ LINKS
57
+ -----
58
+
59
+ * Source code: https://github.com/damulhan/activerecord-cubrid2-adapter
60
+ * Active Record – Object-relational mapping in Rails: https://github.com/rails/rails/tree/main/activerecord
61
+ * Cubrid Ruby GEM: https://github.com/CUBRID/cubrid-ruby
62
+ * Cubrid Homepage: https://www.cubrid.org
63
+
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
5
+
6
+ require "rake/extensiontask"
7
+
8
+ Rake::ExtensionTask.new "activerecord-cubrid-adapter" do |ext|
9
+ ext.name = 'cubrid'
10
+ ext.lib_dir = "lib"
11
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ version = File.read(File.expand_path('VERSION', __dir__)).strip
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'activerecord-cubrid2-adapter'
7
+ spec.platform = Gem::Platform::RUBY
8
+ spec.version = version
9
+
10
+ spec.required_ruby_version = '>= 2.5.0'
11
+
12
+ spec.licenses = ['MIT', 'GPL-2.0']
13
+ spec.authors = ['Eui-Taik Na']
14
+ spec.email = ['damulhan@gmail.com']
15
+ spec.homepage = 'https://github.com/damulhan/activerecord-cubrid2-adapter'
16
+ spec.summary = 'ActiveRecord Cubrid Adapter.'
17
+ spec.description = 'ActiveRecord Cubrid Adapter. Cubrid 9 and upward. Based on cubrid gem.'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0")
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_dependency 'activerecord', '~> 6.0'
25
+ spec.add_dependency 'cubrid', '>= 10.0'
26
+ end