ar-sybase-jdbc-adapter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,11 @@
2
2
 
3
3
  ar-sybase-jdbc-adapter enhances the Arel 2 activerecord-jdbc-adapter to support "limit" and "offset" for Sybase ASE DB.
4
4
 
5
+ **This project is a proof of concept that Sybase ASE can work nicely with Rails**
6
+
7
+ Once the project reaches "close to production" functionality I will try to merge it with _activerecord-jdbc-adapter_
8
+
9
+
5
10
  To use this gem, set the "dialect" configuration parameter to "sybase_jtds".
6
11
 
7
12
  e.g.
@@ -33,17 +38,10 @@ There are 2 major drawbacks here.
33
38
  declare crsr insensitive scroll cursor for
34
39
  select * from <original query>
35
40
  go
36
-
37
- declare @counter int
38
- set @counter = 1
39
41
  open crsr
40
- fetch absolute <offset> from crsr
41
42
 
42
- while @counter < <limit>
43
- begin
44
- set @counter = @counter + 1
45
- fetch next from crsr
46
- end
43
+ set cursor rows <limit> for crsr
44
+ fetch absolute <offset> from crsr
47
45
 
48
46
  close crsr
49
47
  deallocate crsr
@@ -1,2 +1,4 @@
1
1
  require 'arjdbc'
2
+ require 'java'
3
+ require 'arjdbc/sybase/sybase_adapter_java'
2
4
 
@@ -2,13 +2,16 @@ module Arel
2
2
  module Visitors
3
3
  class SybaseJtds < Arel::Visitors::ToSql
4
4
  def visit_Arel_Nodes_SelectStatement o
5
- limit = o.limit
6
- offset = o.offset
7
- o.limit = o.offset = nil
8
- sql = super
5
+ if o.offset
6
+ sql = super # if offset use the Java limit/offset parser
7
+ else
8
+ limit = o.limit
9
+ o.limit = nil
10
+ sql = super
9
11
 
10
- if limit && !offset
11
- limit_and_no_offset sql, limit
12
+ if limit
13
+ limit_and_no_offset sql, limit
14
+ end
12
15
  end
13
16
 
14
17
  sql
@@ -1,7 +1,12 @@
1
- module ::ArJdbc
2
- module SybaseJtds
3
- def arel2_visitors
4
- {'sybase_jtds' => ::Arel::Visitors::SybaseJtds}
5
- end
6
- end
7
- end
1
+ module ::ArJdbc
2
+ module SybaseJtds
3
+ def arel2_visitors
4
+ require 'arel/visitors/sybase_jtds'
5
+ {'sybase_jtds' => ::Arel::Visitors::SybaseJtds}
6
+ end
7
+
8
+ def self.jdbc_connection_class
9
+ ::ActiveRecord::ConnectionAdapters::SybaseJdbcConnection
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - arkadiy kraportov
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-27 00:00:00 +09:00
17
+ date: 2011-01-13 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -165,7 +165,7 @@ dependencies:
165
165
  requirement: *id011
166
166
  prerelease: false
167
167
  type: :development
168
- description: Adds support for limit and offset for Sybase ASE DB to activerecord-jdbc-adapter for Arel 2
168
+ description: Adds support for limit and offset for Sybase ASE DB to activerecord-jdbc-adapter for Rails 3
169
169
  email: arkadiyk@gmail.com
170
170
  executables: []
171
171
 
@@ -178,6 +178,7 @@ files:
178
178
  - lib/ar-sybase-jdbc-adapter.rb
179
179
  - lib/arel/visitors/sybase_jtds.rb
180
180
  - lib/arjdbc/discover.rb
181
+ - lib/arjdbc/sybase/sybase_adapter_java.jar
181
182
  - lib/arjdbc/sybase_jtds.rb
182
183
  - LICENSE.txt
183
184
  - README.rdoc