ActiveRecord-JDBC 0.2.3 → 0.2.4

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.
@@ -1,4 +1,3 @@
1
- require 'jdbc_adapter'
2
1
  require 'rubygems'
3
2
  require 'active_record'
4
3
 
@@ -1,19 +1,18 @@
1
- require 'jdbc_adapter'
2
- require 'rubygems'
3
- require 'active_record'
4
-
5
- class DbTypeMigration < ActiveRecord::Migration
6
- def self.up
7
- create_table "db_types", :force => true do |t|
8
- t.column :sample_timestamp, :timestamp
9
- t.column :sample_decimal, :decimal, :precision=> 15, :scale => 0
10
- end
11
- end
12
-
13
- def self.down
14
- drop_table "db_types"
15
- end
16
- end
17
-
18
- class DbType < ActiveRecord::Base
19
- end
1
+ require 'rubygems'
2
+ require 'active_record'
3
+
4
+ class DbTypeMigration < ActiveRecord::Migration
5
+ def self.up
6
+ create_table "db_types", :force => true do |t|
7
+ t.column :sample_timestamp, :timestamp
8
+ t.column :sample_decimal, :decimal, :precision=> 15, :scale => 0
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table "db_types"
14
+ end
15
+ end
16
+
17
+ class DbType < ActiveRecord::Base
18
+ end
data/test/models/entry.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'jdbc_adapter'
2
1
  require 'rubygems'
3
2
  require 'active_record'
4
3
 
@@ -4,12 +4,8 @@
4
4
  # create database weblog_development;
5
5
  # grant all on weblog_development.* to blog@localhost;
6
6
 
7
-
8
- require 'models/auto_id'
9
- require 'models/entry'
7
+ require 'jdbc_common'
10
8
  require 'db/mysql'
11
- require 'simple'
12
- require 'test/unit'
13
9
 
14
10
  class MysqlSimpleTest < Test::Unit::TestCase
15
11
  include SimpleTestMethods
@@ -0,0 +1,12 @@
1
+ # To run this script, set up the following postgres user and database:
2
+ #
3
+ # sudo -u postgres createuser -D -A -P blog
4
+ # sudo -u postgres createdb -O blog weblog_development
5
+ #
6
+
7
+ require 'jdbc_common'
8
+ require 'db/postgres'
9
+
10
+ class PostgresSimpleTest < Test::Unit::TestCase
11
+ include SimpleTestMethods
12
+ end
data/test/simple.rb CHANGED
@@ -95,10 +95,10 @@ module SimpleTestMethods
95
95
  def test_dumping_schema
96
96
  require 'active_record/schema_dumper'
97
97
  @connection.add_index :entries, :title
98
- stio = StringIO.open('', 'w') do |io|
98
+ StringIO.open do |io|
99
99
  ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, io)
100
+ assert_match(/add_index "entries",/, io.string)
100
101
  end
101
- assert_match(/add_index "entries",/, stio.string)
102
102
  @connection.remove_index :entries, :title
103
103
 
104
104
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ActiveRecord-JDBC
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.3
7
- date: 2007-03-05 00:00:00 -06:00
6
+ version: 0.2.4
7
+ date: 2007-04-24 00:00:00 -05:00
8
8
  summary: JDBC adapter for ActiveRecord, for use within JRuby on Rails.
9
9
  require_paths:
10
10
  - lib
@@ -34,10 +34,8 @@ files:
34
34
  - README.txt
35
35
  - Rakefile
36
36
  - LICENSE
37
- - lib/jdbc_adapter.rb
38
37
  - lib/active_record/connection_adapters/jdbc_adapter.rb
39
38
  - lib/active_record/connection_adapters/jdbc_adapter_spec.rb
40
- - lib/active_record/connection_adapters/jndi_adapter.rb
41
39
  - lib/jdbc_adapter/jdbc_db2.rb
42
40
  - lib/jdbc_adapter/jdbc_derby.rb
43
41
  - lib/jdbc_adapter/jdbc_firebird.rb
@@ -47,29 +45,37 @@ files:
47
45
  - lib/jdbc_adapter/jdbc_mysql.rb
48
46
  - lib/jdbc_adapter/jdbc_oracle.rb
49
47
  - lib/jdbc_adapter/jdbc_postgre.rb
50
- - test/derby_simple_test.rb
51
- - test/h2_simple_test.rb
52
- - test/hsqldb_simple_test.rb
53
- - test/manualTestDatabase.rb
54
- - test/minirunit.rb
55
- - test/mysql_simple_test.rb
56
- - test/simple.rb
48
+ - lib/jdbc_adapter/missing_functionality_helper.rb
49
+ - lib/jdbc_adapter.rb
50
+ - lib/jdbc_adapter_internal.jar
57
51
  - test/activerecord/connection_adapters/type_conversion_test.rb
58
52
  - test/activerecord/connections/native_jdbc_mysql/connection.rb
59
53
  - test/db/derby.rb
60
54
  - test/db/h2.rb
61
55
  - test/db/hsqldb.rb
56
+ - test/db/jndi_config.rb
62
57
  - test/db/logger.rb
63
58
  - test/db/mysql.rb
59
+ - test/db/postgres.rb
60
+ - test/derby_simple_test.rb
61
+ - test/h2_simple_test.rb
62
+ - test/hsqldb_simple_test.rb
63
+ - test/jdbc_common.rb
64
+ - test/jndi_test.rb
65
+ - test/manualTestDatabase.rb
64
66
  - test/minirunit/testConnect.rb
65
67
  - test/minirunit/testH2.rb
66
68
  - test/minirunit/testHsqldb.rb
67
69
  - test/minirunit/testLoadActiveRecord.rb
68
70
  - test/minirunit/testMysql.rb
69
71
  - test/minirunit/testRawSelect.rb
72
+ - test/minirunit.rb
70
73
  - test/models/auto_id.rb
71
74
  - test/models/data_types.rb
72
75
  - test/models/entry.rb
76
+ - test/mysql_simple_test.rb
77
+ - test/postgres_simple_test.rb
78
+ - test/simple.rb
73
79
  test_files: []
74
80
 
75
81
  rdoc_options: []
@@ -1,51 +0,0 @@
1
- require 'active_record/connection_adapters/jdbc_adapter'
2
-
3
- module ActiveRecord #:nodoc:
4
- class Base #:nodoc:
5
- def self.jdbc_connection(config)
6
- config.symbolize_keys
7
- if config[:jndi]
8
- connection = ConnectionAdapters::JndiConnection.new(config)
9
- else
10
- connection = ConnectionAdapters::JdbcConnection.new(config)
11
- end
12
- ConnectionAdapters::JdbcAdapter.new(connection, logger, config)
13
- end
14
- end
15
-
16
- module ConnectionAdapters #:nodoc:
17
-
18
- # This adapter allows ActiveRecord to use JNDI to retrieve
19
- # a JDBC connection from a previously configured DataSource.
20
- # The ActiveRecord configuration looks like this:
21
- #
22
- # ActiveRecord::Base.establish_connection(
23
- # :adapter => 'jdbc',
24
- # :jndi => 'java:comp/env/jdbc/test',
25
- # :driver => 'sqlserver'
26
- # )
27
- #
28
- # Right now, enough driver information needs to be supplied so that AR-JDBC
29
- # can genrate the right flavor of SQL. However, it's not necessary to know
30
- # exactly which driver is being used, just enough so the right SQL is generated.
31
- #
32
- class JndiConnection < JdbcConnection
33
-
34
- def initialize(config)
35
- @config = config
36
- jndi = @config[:jndi].to_s
37
-
38
- ctx = javax.naming.InitialContext.new
39
- ds = ctx.lookup(jndi)
40
- @connection = ds.connection
41
- set_native_database_types
42
-
43
- @stmts = {}
44
- rescue Exception => e
45
- raise "The driver encountered an error: #{e}"
46
- end
47
-
48
- end
49
- end
50
- end
51
-