activerecord-jdbc-adapter 0.9.0.1 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/History.txt +31 -0
  2. data/Manifest.txt +7 -0
  3. data/README.txt +15 -2
  4. data/Rakefile +28 -30
  5. data/lib/active_record/connection_adapters/h2_adapter.rb +13 -1
  6. data/lib/active_record/connection_adapters/jdbc_adapter.rb +78 -96
  7. data/lib/jdbc_adapter/jdbc.rake +15 -5
  8. data/lib/jdbc_adapter/jdbc_adapter_internal.jar +0 -0
  9. data/lib/jdbc_adapter/jdbc_cachedb.rb +4 -4
  10. data/lib/jdbc_adapter/jdbc_db2.rb +5 -7
  11. data/lib/jdbc_adapter/jdbc_derby.rb +57 -30
  12. data/lib/jdbc_adapter/jdbc_firebird.rb +2 -2
  13. data/lib/jdbc_adapter/jdbc_hsqldb.rb +53 -46
  14. data/lib/jdbc_adapter/jdbc_informix.rb +4 -5
  15. data/lib/jdbc_adapter/jdbc_mimer.rb +2 -2
  16. data/lib/jdbc_adapter/jdbc_mssql.rb +25 -23
  17. data/lib/jdbc_adapter/jdbc_mysql.rb +20 -22
  18. data/lib/jdbc_adapter/jdbc_oracle.rb +115 -117
  19. data/lib/jdbc_adapter/jdbc_postgre.rb +129 -59
  20. data/lib/jdbc_adapter/jdbc_sqlite3.rb +149 -28
  21. data/lib/jdbc_adapter/jdbc_sybase.rb +13 -2
  22. data/lib/jdbc_adapter/missing_functionality_helper.rb +12 -3
  23. data/lib/jdbc_adapter/version.rb +1 -1
  24. data/src/java/jdbc_adapter/JdbcAdapterInternalService.java +6 -1101
  25. data/src/java/jdbc_adapter/JdbcDerbySpec.java +26 -23
  26. data/src/java/jdbc_adapter/JdbcMySQLSpec.java +79 -28
  27. data/src/java/jdbc_adapter/PostgresRubyJdbcConnection.java +35 -0
  28. data/src/java/jdbc_adapter/RubyJdbcConnection.java +1149 -0
  29. data/src/java/jdbc_adapter/SQLBlock.java +12 -3
  30. data/src/java/jdbc_adapter/Sqlite3RubyJdbcConnection.java +41 -0
  31. data/test/activerecord/connection_adapters/type_conversion_test.rb +1 -1
  32. data/test/db/derby.rb +0 -3
  33. data/test/db/h2.rb +0 -3
  34. data/test/db/hsqldb.rb +1 -4
  35. data/test/db/mysql.rb +1 -0
  36. data/test/db/oracle.rb +5 -0
  37. data/test/db/sqlite3.rb +7 -3
  38. data/test/derby_migration_test.rb +21 -0
  39. data/test/has_many_through.rb +11 -4
  40. data/test/jdbc_common.rb +13 -1
  41. data/test/models/data_types.rb +11 -1
  42. data/test/models/mixed_case.rb +20 -0
  43. data/test/mysql_multibyte_test.rb +4 -0
  44. data/test/oracle_simple_test.rb +1 -1
  45. data/test/postgres_mixed_case_test.rb +19 -0
  46. data/test/simple.rb +220 -41
  47. data/test/sqlite3_simple_test.rb +83 -0
  48. data/test/sybase_jtds_simple_test.rb +6 -0
  49. metadata +12 -10
@@ -1,6 +1,89 @@
1
1
  require 'jdbc_common'
2
2
  require 'db/sqlite3'
3
+ require 'models/data_types'
3
4
 
4
5
  class SQLite3SimpleTest < Test::Unit::TestCase
5
6
  include SimpleTestMethods
7
+
8
+ def test_recreate_database
9
+ assert @connection.tables.include?(Entry.table_name)
10
+ db = @connection.database_name
11
+ @connection.recreate_database(db)
12
+ assert (not @connection.tables.include? Entry.table_name)
13
+ self.setup # avoid teardown complaining
14
+ end
15
+
16
+ def test_execute_insert
17
+ assert_equal 1, Entry.count
18
+ id = @connection.execute "INSERT INTO entries (title, content) VALUES ('Execute Insert', 'This now works with SQLite3')"
19
+ assert_equal Entry.last.id, id
20
+ assert_equal 2, Entry.count
21
+ end
22
+
23
+ def test_execute_update
24
+ affected_rows = @connection.execute "UPDATE entries SET title = 'Execute Update' WHERE id = #{Entry.first.id}"
25
+ assert_equal 1, affected_rows
26
+ assert_equal 'Execute Update', Entry.first.title
27
+ end
28
+
29
+ def test_columns
30
+ cols = ActiveRecord::Base.connection.columns("entries")
31
+ assert cols.find {|col| col.name == "title"}
32
+ end
33
+
34
+ end
35
+
36
+ class SQLite3HasManyThroughTest < Test::Unit::TestCase
37
+ include HasManyThroughMethods
38
+ end
39
+
40
+ if jruby?
41
+ JInteger = java.lang.Integer
42
+ else
43
+ JInteger = Fixnum
44
+ class Fixnum
45
+ # Arbitrary value...we could pick
46
+ MAX_VALUE = 2
47
+ end
48
+ end
49
+
50
+ class SQLite3TypeConversionTest < Test::Unit::TestCase
51
+ TEST_TIME = Time.at(1169964202)
52
+ TEST_BINARY = "Some random binary data % \0 and then some"
53
+ def setup
54
+ DbTypeMigration.up
55
+ DbType.create(
56
+ :sample_timestamp => TEST_TIME,
57
+ :sample_datetime => TEST_TIME,
58
+ :sample_time => TEST_TIME,
59
+ :sample_date => TEST_TIME,
60
+ :sample_decimal => JInteger::MAX_VALUE + 1,
61
+ :sample_small_decimal => 3.14,
62
+ :sample_binary => TEST_BINARY)
63
+ end
64
+
65
+ def teardown
66
+ DbTypeMigration.down
67
+ end
68
+
69
+ def test_decimal
70
+ types = DbType.find(:first)
71
+ assert_equal((JInteger::MAX_VALUE + 1), types.sample_decimal)
72
+ end
73
+
74
+ def test_decimal_scale
75
+ types = DbType.find(:first)
76
+ assert_equal(2, DbType.columns_hash["sample_small_decimal"].scale)
77
+ end
78
+
79
+ def test_decimal_precision
80
+ types = DbType.find(:first)
81
+ assert_equal(3, DbType.columns_hash["sample_small_decimal"].precision)
82
+ end
83
+
84
+ def test_binary
85
+ types = DbType.find(:first)
86
+ assert_equal(TEST_BINARY, types.sample_binary)
87
+ end
88
+
6
89
  end
@@ -0,0 +1,6 @@
1
+ require 'jdbc_common'
2
+ require 'db/sybase_jtds'
3
+
4
+ class SybaseJtdsSimpleTest < Test::Unit::TestCase
5
+ include SimpleTestMethods
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbc-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.1
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger, Ola Bini and JRuby contributors
@@ -9,14 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-26 00:00:00 -05:00
12
+ date: 2009-03-17 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: |-
17
- activerecord-jdbc-adapter is a database adapter for Rails' ActiveRecord
18
- component that can be used with JRuby[http://www.jruby.org/]. It allows use of
19
- virtually any JDBC-compliant database with your JRuby on Rails application.
16
+ description: activerecord-jdbc-adapter is a database adapter for Rails' ActiveRecord component that can be used with JRuby[http://www.jruby.org/]. It allows use of virtually any JDBC-compliant database with your JRuby on Rails application.
20
17
  email: nick@nicksieger.com, ola.bini@gmail.com
21
18
  executables: []
22
19
 
@@ -82,6 +79,7 @@ files:
82
79
  - test/db/postgres.rb
83
80
  - test/db/sqlite3.rb
84
81
  - test/db2_simple_test.rb
82
+ - test/derby_migration_test.rb
85
83
  - test/derby_multibyte_test.rb
86
84
  - test/derby_simple_test.rb
87
85
  - test/generic_jdbc_connection_test.rb
@@ -106,25 +104,29 @@ files:
106
104
  - test/models/auto_id.rb
107
105
  - test/models/data_types.rb
108
106
  - test/models/entry.rb
107
+ - test/models/mixed_case.rb
109
108
  - test/models/reserved_word.rb
110
109
  - test/mssql_simple_test.rb
111
110
  - test/mysql_multibyte_test.rb
112
111
  - test/mysql_simple_test.rb
113
112
  - test/oracle_simple_test.rb
113
+ - test/postgres_mixed_case_test.rb
114
114
  - test/postgres_reserved_test.rb
115
115
  - test/postgres_simple_test.rb
116
116
  - test/simple.rb
117
117
  - test/sqlite3_simple_test.rb
118
+ - test/sybase_jtds_simple_test.rb
118
119
  - lib/jdbc_adapter/jdbc.rake
119
120
  - src/java/jdbc_adapter/JdbcAdapterInternalService.java
120
121
  - src/java/jdbc_adapter/JdbcConnectionFactory.java
121
122
  - src/java/jdbc_adapter/JdbcDerbySpec.java
122
123
  - src/java/jdbc_adapter/JdbcMySQLSpec.java
124
+ - src/java/jdbc_adapter/PostgresRubyJdbcConnection.java
125
+ - src/java/jdbc_adapter/RubyJdbcConnection.java
123
126
  - src/java/jdbc_adapter/SQLBlock.java
127
+ - src/java/jdbc_adapter/Sqlite3RubyJdbcConnection.java
124
128
  has_rdoc: true
125
129
  homepage: http://jruby-extras.rubyforge.org/activerecord-jdbc-adapter
126
- licenses: []
127
-
128
130
  post_install_message:
129
131
  rdoc_options:
130
132
  - --main
@@ -146,9 +148,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
148
  requirements: []
147
149
 
148
150
  rubyforge_project: jruby-extras
149
- rubygems_version: 1.3.5
151
+ rubygems_version: 1.3.1
150
152
  signing_key:
151
- specification_version: 3
153
+ specification_version: 2
152
154
  summary: JDBC adapter for ActiveRecord, for use within JRuby on Rails.
153
155
  test_files: []
154
156