jdbc-helper 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +3 -0
- data/README.markdown +18 -11
- data/lib/jdbc-helper/connector/filemaker.rb +24 -0
- data/lib/jdbc-helper/connector.rb +1 -1
- data/lib/jdbc-helper/constants.rb +3 -0
- data/lib/jdbc-helper/version.rb +1 -1
- data/test/database.yml +7 -0
- data/test/test_connectors.rb +8 -1
- metadata +3 -2
data/CHANGELOG.markdown
CHANGED
data/README.markdown
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
```
|
2
|
-
_ _ _ _ _
|
3
|
-
(_) | | | | | | |
|
4
|
-
_ __| | |__ ___ ______| |__ ___| |_ __ ___ _ __
|
2
|
+
_ _ _ _ _
|
3
|
+
(_) | | | | | | |
|
4
|
+
_ __| | |__ ___ ______| |__ ___| |_ __ ___ _ __
|
5
5
|
| |/ _` | '_ \ / __|______| '_ \ / _ \ | '_ \ / _ \ '__|
|
6
|
-
| | (_| | |_) | (__ | | | | __/ | |_) | __/ |
|
7
|
-
| |\__,_|_.__/ \___| |_| |_|\___|_| .__/ \___|_|
|
8
|
-
_/ | | |
|
9
|
-
|__/ |_|
|
6
|
+
| | (_| | |_) | (__ | | | | __/ | |_) | __/ |
|
7
|
+
| |\__,_|_.__/ \___| |_| |_|\___|_| .__/ \___|_|
|
8
|
+
_/ | | |
|
9
|
+
|__/ |_|
|
10
10
|
```
|
11
11
|
|
12
12
|
# jdbc-helper
|
@@ -66,6 +66,7 @@ so that you don't have to specify lengthy class names and JDBC URLs.
|
|
66
66
|
* PostgreSQL (`JDBCHelper::PostgreSQL`)
|
67
67
|
* MS SQL Server (`JDBCHelper::MSSQL`)
|
68
68
|
* Cassandra (`JDBCHelper::Cassandra`)
|
69
|
+
* FileMaker Pro (`JDBCHelper::FileMaker`)
|
69
70
|
|
70
71
|
```ruby
|
71
72
|
# MySQL shortcut connector
|
@@ -76,13 +77,16 @@ oc = JDBCHelper::Oracle.connect(host, user, password, service_name)
|
|
76
77
|
|
77
78
|
# PostgreSQL shortcut connector
|
78
79
|
pc = JDBCHelper::PostgreSQL.connect(host, user, password, db)
|
79
|
-
|
80
|
+
|
80
81
|
# MS SQL Server shortcut connector
|
81
82
|
sc = JDBCHelper::MSSQL.connect(host, user, password, db)
|
82
83
|
|
83
84
|
# Cassandra CQL3 connector
|
84
85
|
cc = JDBCHelper::Cassandra.connect(host, keyspace)
|
85
86
|
|
87
|
+
# FileMaker Pro shortcut connector
|
88
|
+
fmp = JDBCHelper::FileMaker.connect(host, user, password, db)
|
89
|
+
|
86
90
|
# Extra parameters
|
87
91
|
mc = JDBCHelper::MySQL.connect(host, user, password, db,
|
88
92
|
:rewriteBatchedStatements => true)
|
@@ -274,7 +278,7 @@ scope.update(:a => 'xyz')
|
|
274
278
|
#### Invalid use of dynamic conditions
|
275
279
|
|
276
280
|
TableWrapper object internally creates JDBC PreparedStatements.
|
277
|
-
If you dynamically build many condition-strings as the following example,
|
281
|
+
If you dynamically build many condition-strings as the following example,
|
278
282
|
it would soon fail because there will be too many open PreparedStatements.
|
279
283
|
|
280
284
|
```ruby
|
@@ -306,7 +310,7 @@ conn.function(:coalesce).call(nil, nil, 'king')
|
|
306
310
|
# Working with IN/INOUT/OUT parameteres
|
307
311
|
# Bind by ordinal number
|
308
312
|
conn.procedure(:update_and_fetch_something).call(
|
309
|
-
100, # Input parameter
|
313
|
+
100, # Input parameter
|
310
314
|
["value", String], # Input/Output parameter
|
311
315
|
Fixnum # Output parameter
|
312
316
|
)
|
@@ -335,8 +339,11 @@ seq.reset! 100
|
|
335
339
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
336
340
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
337
341
|
|
342
|
+
## Contributors
|
343
|
+
|
344
|
+
* [Larry Staton Jr.](https://github.com/statonjr)
|
345
|
+
|
338
346
|
## Copyright
|
339
347
|
|
340
348
|
Copyright (c) 2011 Junegunn Choi. See LICENSE.txt for
|
341
349
|
further details.
|
342
|
-
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# Larry Staton Jr. (larry@sweetpeasoftware.com)
|
3
|
+
|
4
|
+
module JDBCHelper
|
5
|
+
# Shortcut connector for FileMaker
|
6
|
+
module FileMaker
|
7
|
+
extend Connector
|
8
|
+
|
9
|
+
# @param [String] host
|
10
|
+
# @param [String] user
|
11
|
+
# @param [String] password
|
12
|
+
# @param [String] db
|
13
|
+
# @param [Hash] extra_params
|
14
|
+
# @return [JDBCHelper::Connection]
|
15
|
+
def self.connect(host, user, password, db, extra_params = {}, &block)
|
16
|
+
connect_impl :filemaker, {
|
17
|
+
:url => "jdbc:filemaker://#{host}/#{db}",
|
18
|
+
:user => user,
|
19
|
+
:password => password
|
20
|
+
}, extra_params, &block
|
21
|
+
end
|
22
|
+
|
23
|
+
end#FileMaker
|
24
|
+
end#JDBCHelper
|
data/lib/jdbc-helper/version.rb
CHANGED
data/test/database.yml
CHANGED
data/test/test_connectors.rb
CHANGED
@@ -101,6 +101,14 @@ class TestConnectors < Test::Unit::TestCase
|
|
101
101
|
end
|
102
102
|
assert @conn.closed?
|
103
103
|
assert_equal 1, ret
|
104
|
+
when /filemaker/
|
105
|
+
host = conn_info['url'].match(%r{//([^/?]+)})[1]
|
106
|
+
db = conn_info['url'].match(%r{/([^/?]*?)(\?.*)?$})[1]
|
107
|
+
|
108
|
+
conn = JDBCHelper::FileMaker.connect(host, conn_info['user'], conn_info['password'], db)
|
109
|
+
assert conn.closed? == false
|
110
|
+
conn.close
|
111
|
+
assert conn.closed?
|
104
112
|
end
|
105
113
|
end
|
106
114
|
end
|
@@ -199,4 +207,3 @@ class TestConnectors < Test::Unit::TestCase
|
|
199
207
|
end
|
200
208
|
end
|
201
209
|
end
|
202
|
-
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: jdbc-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Junegunn Choi
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: insensitive_hash
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/jdbc-helper/connection/type_map.rb
|
108
108
|
- lib/jdbc-helper/connector.rb
|
109
109
|
- lib/jdbc-helper/connector/cassandra.rb
|
110
|
+
- lib/jdbc-helper/connector/filemaker.rb
|
110
111
|
- lib/jdbc-helper/connector/mssql.rb
|
111
112
|
- lib/jdbc-helper/connector/mysql.rb
|
112
113
|
- lib/jdbc-helper/connector/oracle.rb
|