ydbi 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/build/Rakefile.dbi.rb +4 -4
- data/lib/dbi/version.rb +1 -1
- data/test/dbi/tc_dbi.rb +1 -1
- metadata +9 -124
- data/.gitignore +0 -6
- data/Gemfile +0 -4
- data/Rakefile +0 -8
- data/TODO +0 -44
- data/bench/bench.rb +0 -79
- data/build/rake_task_lib.rb +0 -187
- data/doc/DBD_SPEC.rdoc +0 -88
- data/doc/DBI_SPEC.rdoc +0 -157
- data/doc/homepage/contact.html +0 -62
- data/doc/homepage/development.html +0 -124
- data/doc/homepage/index.html +0 -83
- data/doc/homepage/ruby-dbi.css +0 -91
- data/lib/dbd/Mysql.rb +0 -137
- data/lib/dbd/ODBC.rb +0 -89
- data/lib/dbd/Pg.rb +0 -188
- data/lib/dbd/SQLite.rb +0 -97
- data/lib/dbd/SQLite3.rb +0 -124
- data/lib/dbd/mysql/database.rb +0 -405
- data/lib/dbd/mysql/driver.rb +0 -125
- data/lib/dbd/mysql/statement.rb +0 -188
- data/lib/dbd/odbc/database.rb +0 -128
- data/lib/dbd/odbc/driver.rb +0 -38
- data/lib/dbd/odbc/statement.rb +0 -137
- data/lib/dbd/pg/database.rb +0 -516
- data/lib/dbd/pg/exec.rb +0 -47
- data/lib/dbd/pg/statement.rb +0 -160
- data/lib/dbd/pg/tuples.rb +0 -121
- data/lib/dbd/pg/type.rb +0 -209
- data/lib/dbd/sqlite/database.rb +0 -151
- data/lib/dbd/sqlite/statement.rb +0 -125
- data/lib/dbd/sqlite3/database.rb +0 -201
- data/lib/dbd/sqlite3/statement.rb +0 -78
- data/prototypes/types2.rb +0 -237
- data/setup.rb +0 -1585
- data/test/DBD_TESTS +0 -50
- data/test/TESTING +0 -16
- data/test/dbd/general/test_database.rb +0 -206
- data/test/dbd/general/test_statement.rb +0 -326
- data/test/dbd/general/test_types.rb +0 -296
- data/test/dbd/mysql/base.rb +0 -26
- data/test/dbd/mysql/down.sql +0 -19
- data/test/dbd/mysql/test_blob.rb +0 -18
- data/test/dbd/mysql/test_new_methods.rb +0 -7
- data/test/dbd/mysql/test_patches.rb +0 -111
- data/test/dbd/mysql/up.sql +0 -28
- data/test/dbd/odbc/base.rb +0 -30
- data/test/dbd/odbc/down.sql +0 -19
- data/test/dbd/odbc/test_new_methods.rb +0 -12
- data/test/dbd/odbc/test_ping.rb +0 -10
- data/test/dbd/odbc/test_statement.rb +0 -44
- data/test/dbd/odbc/test_transactions.rb +0 -58
- data/test/dbd/odbc/up.sql +0 -33
- data/test/dbd/postgresql/base.rb +0 -31
- data/test/dbd/postgresql/down.sql +0 -31
- data/test/dbd/postgresql/test_arrays.rb +0 -179
- data/test/dbd/postgresql/test_async.rb +0 -121
- data/test/dbd/postgresql/test_blob.rb +0 -36
- data/test/dbd/postgresql/test_bytea.rb +0 -87
- data/test/dbd/postgresql/test_ping.rb +0 -10
- data/test/dbd/postgresql/test_timestamp.rb +0 -77
- data/test/dbd/postgresql/test_transactions.rb +0 -58
- data/test/dbd/postgresql/testdbipg.rb +0 -307
- data/test/dbd/postgresql/up.sql +0 -60
- data/test/dbd/sqlite/base.rb +0 -32
- data/test/dbd/sqlite/test_database.rb +0 -30
- data/test/dbd/sqlite/test_driver.rb +0 -68
- data/test/dbd/sqlite/test_statement.rb +0 -112
- data/test/dbd/sqlite/up.sql +0 -25
- data/test/dbd/sqlite3/base.rb +0 -32
- data/test/dbd/sqlite3/test_database.rb +0 -77
- data/test/dbd/sqlite3/test_driver.rb +0 -67
- data/test/dbd/sqlite3/test_statement.rb +0 -88
- data/test/dbd/sqlite3/up.sql +0 -33
- data/test/ts_dbd.rb +0 -131
- data/ydbi.gemspec +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96278f2ffacb394c731259cdd8d911289a469c7e
|
4
|
+
data.tar.gz: a28f54844f574e215733065c95bb9298fa51a81c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14568a61f2978aab0410d29cfd8ac8e9b47d16c697e9d74ca6848b4c7cc6336fa7e230cbd5c6acb946ea9ebde6beb98927e8983a6ee160509ab1df216cb43cc
|
7
|
+
data.tar.gz: 4d4f435e9adcff9e6330914f15c58d4fa1bcae7ffa78c6a9684f46f3709a90e93f01df882bd3e8d919b5fb7dd056c2b37ff5eeec82c9f17913f222ffa537b9c7
|
data/ChangeLog
CHANGED
data/build/Rakefile.dbi.rb
CHANGED
@@ -32,19 +32,19 @@ build_dbi_tasks
|
|
32
32
|
# There's probably a better way to do this, but here's a boilerplate spec that we dup and modify.
|
33
33
|
#
|
34
34
|
|
35
|
-
task :
|
35
|
+
task :ydbi => DEFAULT_TASKS.collect { |x| "ydbi:#{x.to_s}" }
|
36
36
|
|
37
|
-
namespace :
|
37
|
+
namespace :ydbi do
|
38
38
|
code_files = %w(examples/**/* bin/dbi build/Rakefile.dbi.rb lib/dbi.rb lib/dbi/**/*.rb test/ts_dbi.rb test/dbi/*)
|
39
39
|
|
40
40
|
spec = boilerplate_spec
|
41
|
-
spec.name = '
|
41
|
+
spec.name = 'ydbi'
|
42
42
|
spec.version = DBI::VERSION
|
43
43
|
spec.test_file = 'test/ts_dbi.rb'
|
44
44
|
spec.executables = ['dbi', 'test_broken_dbi']
|
45
45
|
spec.files = gem_files(code_files)
|
46
46
|
spec.summary = 'A vendor independent interface for accessing databases, similar to Perl\'s DBI'
|
47
|
-
spec.description = '
|
47
|
+
spec.description = 'Branch by ywesee com, as our patches were never accepted by upstream'
|
48
48
|
spec.add_dependency 'deprecated', '= 2.0.1'
|
49
49
|
|
50
50
|
build_package_tasks(spec, code_files)
|
data/lib/dbi/version.rb
CHANGED
data/test/dbi/tc_dbi.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ydbi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Hollensbe
|
@@ -11,48 +11,6 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2016-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rake
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: minitest
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: test-unit
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
14
|
- !ruby/object:Gem::Dependency
|
57
15
|
name: deprecated
|
58
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,53 +26,24 @@ dependencies:
|
|
68
26
|
- !ruby/object:Gem::Version
|
69
27
|
version: 2.0.1
|
70
28
|
description: Branch by ywesee com, as our patches were never accepted by upstream
|
71
|
-
email:
|
29
|
+
email: zdavatz@ywesee.com
|
72
30
|
executables:
|
73
31
|
- dbi
|
74
32
|
- test_broken_dbi
|
75
33
|
extensions: []
|
76
|
-
extra_rdoc_files:
|
34
|
+
extra_rdoc_files:
|
35
|
+
- readme.md
|
36
|
+
- LICENSE
|
37
|
+
- ChangeLog
|
77
38
|
files:
|
78
|
-
- ".gitignore"
|
79
39
|
- ChangeLog
|
80
|
-
- Gemfile
|
81
40
|
- LICENSE
|
82
|
-
- Rakefile
|
83
|
-
- TODO
|
84
|
-
- bench/bench.rb
|
85
41
|
- bin/dbi
|
86
42
|
- bin/test_broken_dbi
|
87
43
|
- build/Rakefile.dbi.rb
|
88
|
-
- build/rake_task_lib.rb
|
89
|
-
- doc/DBD_SPEC.rdoc
|
90
|
-
- doc/DBI_SPEC.rdoc
|
91
|
-
- doc/homepage/contact.html
|
92
|
-
- doc/homepage/development.html
|
93
|
-
- doc/homepage/index.html
|
94
|
-
- doc/homepage/ruby-dbi.css
|
95
44
|
- examples/test1.pl
|
96
45
|
- examples/test1.rb
|
97
46
|
- examples/xmltest.rb
|
98
|
-
- lib/dbd/Mysql.rb
|
99
|
-
- lib/dbd/ODBC.rb
|
100
|
-
- lib/dbd/Pg.rb
|
101
|
-
- lib/dbd/SQLite.rb
|
102
|
-
- lib/dbd/SQLite3.rb
|
103
|
-
- lib/dbd/mysql/database.rb
|
104
|
-
- lib/dbd/mysql/driver.rb
|
105
|
-
- lib/dbd/mysql/statement.rb
|
106
|
-
- lib/dbd/odbc/database.rb
|
107
|
-
- lib/dbd/odbc/driver.rb
|
108
|
-
- lib/dbd/odbc/statement.rb
|
109
|
-
- lib/dbd/pg/database.rb
|
110
|
-
- lib/dbd/pg/exec.rb
|
111
|
-
- lib/dbd/pg/statement.rb
|
112
|
-
- lib/dbd/pg/tuples.rb
|
113
|
-
- lib/dbd/pg/type.rb
|
114
|
-
- lib/dbd/sqlite/database.rb
|
115
|
-
- lib/dbd/sqlite/statement.rb
|
116
|
-
- lib/dbd/sqlite3/database.rb
|
117
|
-
- lib/dbd/sqlite3/statement.rb
|
118
47
|
- lib/dbi.rb
|
119
48
|
- lib/dbi/base_classes.rb
|
120
49
|
- lib/dbi/base_classes/database.rb
|
@@ -141,48 +70,7 @@ files:
|
|
141
70
|
- lib/dbi/utils/timestamp.rb
|
142
71
|
- lib/dbi/utils/xmlformatter.rb
|
143
72
|
- lib/dbi/version.rb
|
144
|
-
- prototypes/types2.rb
|
145
73
|
- readme.md
|
146
|
-
- setup.rb
|
147
|
-
- test/DBD_TESTS
|
148
|
-
- test/TESTING
|
149
|
-
- test/dbd/general/test_database.rb
|
150
|
-
- test/dbd/general/test_statement.rb
|
151
|
-
- test/dbd/general/test_types.rb
|
152
|
-
- test/dbd/mysql/base.rb
|
153
|
-
- test/dbd/mysql/down.sql
|
154
|
-
- test/dbd/mysql/test_blob.rb
|
155
|
-
- test/dbd/mysql/test_new_methods.rb
|
156
|
-
- test/dbd/mysql/test_patches.rb
|
157
|
-
- test/dbd/mysql/up.sql
|
158
|
-
- test/dbd/odbc/base.rb
|
159
|
-
- test/dbd/odbc/down.sql
|
160
|
-
- test/dbd/odbc/test_new_methods.rb
|
161
|
-
- test/dbd/odbc/test_ping.rb
|
162
|
-
- test/dbd/odbc/test_statement.rb
|
163
|
-
- test/dbd/odbc/test_transactions.rb
|
164
|
-
- test/dbd/odbc/up.sql
|
165
|
-
- test/dbd/postgresql/base.rb
|
166
|
-
- test/dbd/postgresql/down.sql
|
167
|
-
- test/dbd/postgresql/test_arrays.rb
|
168
|
-
- test/dbd/postgresql/test_async.rb
|
169
|
-
- test/dbd/postgresql/test_blob.rb
|
170
|
-
- test/dbd/postgresql/test_bytea.rb
|
171
|
-
- test/dbd/postgresql/test_ping.rb
|
172
|
-
- test/dbd/postgresql/test_timestamp.rb
|
173
|
-
- test/dbd/postgresql/test_transactions.rb
|
174
|
-
- test/dbd/postgresql/testdbipg.rb
|
175
|
-
- test/dbd/postgresql/up.sql
|
176
|
-
- test/dbd/sqlite/base.rb
|
177
|
-
- test/dbd/sqlite/test_database.rb
|
178
|
-
- test/dbd/sqlite/test_driver.rb
|
179
|
-
- test/dbd/sqlite/test_statement.rb
|
180
|
-
- test/dbd/sqlite/up.sql
|
181
|
-
- test/dbd/sqlite3/base.rb
|
182
|
-
- test/dbd/sqlite3/test_database.rb
|
183
|
-
- test/dbd/sqlite3/test_driver.rb
|
184
|
-
- test/dbd/sqlite3/test_statement.rb
|
185
|
-
- test/dbd/sqlite3/up.sql
|
186
74
|
- test/dbi/tc_columninfo.rb
|
187
75
|
- test/dbi/tc_date.rb
|
188
76
|
- test/dbi/tc_dbi.rb
|
@@ -192,10 +80,8 @@ files:
|
|
192
80
|
- test/dbi/tc_time.rb
|
193
81
|
- test/dbi/tc_timestamp.rb
|
194
82
|
- test/dbi/tc_types.rb
|
195
|
-
- test/ts_dbd.rb
|
196
83
|
- test/ts_dbi.rb
|
197
|
-
|
198
|
-
homepage: http://www.rubyforge.org/projects/ruby-dbi
|
84
|
+
homepage: https://github.com/zdavatz/ydbi
|
199
85
|
licenses: []
|
200
86
|
metadata: {}
|
201
87
|
post_install_message:
|
@@ -206,14 +92,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
92
|
requirements:
|
207
93
|
- - ">="
|
208
94
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
95
|
+
version: 1.8.0
|
210
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
97
|
requirements:
|
212
98
|
- - ">="
|
213
99
|
- !ruby/object:Gem::Version
|
214
100
|
version: '0'
|
215
101
|
requirements: []
|
216
|
-
rubyforge_project:
|
102
|
+
rubyforge_project: ydbi
|
217
103
|
rubygems_version: 2.4.5
|
218
104
|
signing_key:
|
219
105
|
specification_version: 4
|
@@ -221,4 +107,3 @@ summary: A vendor independent interface for accessing databases, similar to Perl
|
|
221
107
|
DBI
|
222
108
|
test_files:
|
223
109
|
- test/ts_dbi.rb
|
224
|
-
has_rdoc: true
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/TODO
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
0.4.0:
|
2
|
-
x Work
|
3
|
-
x Postgres quoting toggles
|
4
|
-
x Postgres binding toggles
|
5
|
-
x Test for #20489
|
6
|
-
* Release checklist:
|
7
|
-
x Update ChangeLog
|
8
|
-
x rake
|
9
|
-
x remove all related gems, install all DBI/DBD gems (check prereqs)
|
10
|
-
x write a few test scripts to make sure drivers are loading
|
11
|
-
x Update homepage (irc channel, git, other changes)
|
12
|
-
* tag as 0.4.0
|
13
|
-
* upload rdoc
|
14
|
-
* upload packages
|
15
|
-
* release announcement (rf, ruby-talk, dbi lists, other places?)
|
16
|
-
* rebase master from development
|
17
|
-
* BEER
|
18
|
-
0.6.0:
|
19
|
-
* Cleanup:
|
20
|
-
* Arrays:
|
21
|
-
* Find some way to get the extents of an array type
|
22
|
-
* checked pg_type, pg_attribute and pg_class, can't find anything.
|
23
|
-
* I don't think this is possible, but let's slate it for 0.6.0 anyways.
|
24
|
-
* Tracing
|
25
|
-
* WTH do we want to do with this
|
26
|
-
* Wow, this module has *serious issues*. Crashes DBI without warning. Redo this completely.
|
27
|
-
* 0.6.0
|
28
|
-
* Re-institute drivers
|
29
|
-
* Proxy
|
30
|
-
* Slated for 0.6.0
|
31
|
-
* Finish type management system
|
32
|
-
* Unify ColumnInfo
|
33
|
-
* Should we enforce ColumnInfo requirements at the DBI level?
|
34
|
-
* At least test the result of statement colinfo uniformly
|
35
|
-
* 0.6.0
|
36
|
-
* Cleanup core
|
37
|
-
* Require code is a mess
|
38
|
-
* Just remove the case-sensitivity from the DBDs in general
|
39
|
-
* 0.6.0
|
40
|
-
* Find a good clean way to enumerate drivers in separate gems
|
41
|
-
* Some registration-on-require would be cleaner and safer
|
42
|
-
* 0.6.0
|
43
|
-
* Scripts
|
44
|
-
* bin/dbd_proxy seems to have never worked; slate it for 0.6.0
|
data/bench/bench.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
-
require 'dbi'
|
4
|
-
|
5
|
-
class DbiBenchmark
|
6
|
-
attr_reader :db
|
7
|
-
|
8
|
-
def initialize db, quiet=false
|
9
|
-
@db = db
|
10
|
-
@quiet = quiet
|
11
|
-
end
|
12
|
-
|
13
|
-
def puts(*args)
|
14
|
-
super unless @quiet
|
15
|
-
end
|
16
|
-
|
17
|
-
def run
|
18
|
-
times = {}
|
19
|
-
%w[create_test_table selecting_floats selecting_datetimes].each do |name|
|
20
|
-
t = Time.now
|
21
|
-
puts "* #{name.tr('_', ' ').capitalize}"
|
22
|
-
send name
|
23
|
-
took = Time.now - t
|
24
|
-
puts " (took #{took} seconds)"
|
25
|
-
puts
|
26
|
-
times[name] = took
|
27
|
-
end
|
28
|
-
times
|
29
|
-
ensure
|
30
|
-
db.do 'drop table data'
|
31
|
-
end
|
32
|
-
|
33
|
-
def create_test_table
|
34
|
-
db.do <<-end
|
35
|
-
create table data (
|
36
|
-
date timestamp,
|
37
|
-
value float
|
38
|
-
)
|
39
|
-
end
|
40
|
-
db.do 'begin'
|
41
|
-
today = Date.today
|
42
|
-
5_000.times do
|
43
|
-
db.do "insert into data values ('#{today + rand(100) - 50}', #{10 + rand * 30})"
|
44
|
-
end
|
45
|
-
db.do 'commit'
|
46
|
-
end
|
47
|
-
|
48
|
-
def selecting_floats
|
49
|
-
strs = db.select_all('select value from data').map { |v| v.to_s }
|
50
|
-
puts *strs[0, 5]
|
51
|
-
puts '...'
|
52
|
-
end
|
53
|
-
|
54
|
-
def selecting_datetimes
|
55
|
-
strs = db.select_all('select date from data').map { |v| v.to_s }
|
56
|
-
puts *strs[0, 5]
|
57
|
-
puts '...'
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def bench
|
62
|
-
dbiurls = [
|
63
|
-
'DBI:Mysql:dbitest:localhost',
|
64
|
-
'DBI:ODBC:MYDBITEST',
|
65
|
-
'DBI:Pg:dbitest:localhost',
|
66
|
-
'DBI:ODBC:PGDBITEST',
|
67
|
-
]
|
68
|
-
order = %w[create_test_table selecting_floats selecting_datetimes]
|
69
|
-
dbiurls.map do |url|
|
70
|
-
# assume all dbs have the same credentials
|
71
|
-
DBI.connect(url, *ARGV) do |db|
|
72
|
-
[url.first.sub('DBI:', ''), *DbiBenchmark.new(db, true).run.values_at(*order)]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
puts 'Running benchmark:'
|
78
|
-
DBI::Utils::TableFormatter.ascii(%w[db insert float datetime], bench, nil, nil, nil, nil, 30)
|
79
|
-
|
data/build/rake_task_lib.rb
DELETED
@@ -1,187 +0,0 @@
|
|
1
|
-
$:.unshift 'lib'
|
2
|
-
require 'rake'
|
3
|
-
require 'rubygems'
|
4
|
-
require 'rubygems/package_task'
|
5
|
-
require 'rake/packagetask'
|
6
|
-
require 'rdoc/task'
|
7
|
-
|
8
|
-
|
9
|
-
DEFAULT_TASKS = [:clobber_package, :package, :gem]
|
10
|
-
|
11
|
-
DBD_GEM_DEP_MAP = {
|
12
|
-
'pg' => 'pg',
|
13
|
-
'mysql' => 'mysql',
|
14
|
-
'sqlite' => 'sqlite-ruby',
|
15
|
-
'sqlite3' => 'sqlite3-ruby'
|
16
|
-
}
|
17
|
-
|
18
|
-
#
|
19
|
-
# Packaging
|
20
|
-
#
|
21
|
-
|
22
|
-
PACKAGE_FILES = %w(Rakefile build/rake_task_lib.rb setup.rb)
|
23
|
-
DOC_FILES = %w(readme.md LICENSE ChangeLog)
|
24
|
-
EXCLUSIONS = %w(test/sql.log)
|
25
|
-
DBD_FILES = %w(test/DBD_TESTS)
|
26
|
-
|
27
|
-
#
|
28
|
-
# some inlines
|
29
|
-
#
|
30
|
-
|
31
|
-
def gem_files(code_files)
|
32
|
-
(code_files + DOC_FILES).collect { |x| Dir[x] }.reject { |x| EXCLUSIONS.include? x }.flatten
|
33
|
-
end
|
34
|
-
|
35
|
-
def package_files(code_files)
|
36
|
-
code_files + DOC_FILES + PACKAGE_FILES
|
37
|
-
end
|
38
|
-
|
39
|
-
def build_package_tasks(spec, code_files)
|
40
|
-
Gem::PackageTask.new(spec) do |s|
|
41
|
-
end
|
42
|
-
|
43
|
-
Rake::PackageTask.new(spec.name, spec.version) do |p|
|
44
|
-
p.need_tar_gz = true
|
45
|
-
p.need_zip = true
|
46
|
-
|
47
|
-
package_files(code_files).each do |x|
|
48
|
-
p.package_files.include(x)
|
49
|
-
end
|
50
|
-
|
51
|
-
EXCLUSIONS.each do |x|
|
52
|
-
p.package_files.exclude(x)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def boilerplate_spec
|
58
|
-
gem = Gem::Specification.new
|
59
|
-
gem.authors = ['Erik Hollensbe', 'Christopher Maujean']
|
60
|
-
gem.email = 'ruby-dbi-users@rubyforge.org'
|
61
|
-
gem.homepage = 'http://www.rubyforge.org/projects/ruby-dbi'
|
62
|
-
gem.platform = Gem::Platform::RUBY
|
63
|
-
gem.has_rdoc = true
|
64
|
-
gem.extra_rdoc_files = DOC_FILES
|
65
|
-
gem.required_ruby_version = '>= 1.8.0'
|
66
|
-
gem.rubyforge_project = 'ruby-dbi'
|
67
|
-
return gem
|
68
|
-
end
|
69
|
-
|
70
|
-
# builds a dbd namespace from the DBD_PACKAGES hash
|
71
|
-
def dbd_namespace(dbd)
|
72
|
-
"dbd-" + dbd.to_s.downcase
|
73
|
-
end
|
74
|
-
|
75
|
-
def dbd_code_files(dbd)
|
76
|
-
code_files = [
|
77
|
-
"test/dbd/general/**",
|
78
|
-
File.join("test", "dbd", dbd.downcase == "pg" ? "postgresql" : dbd.downcase, "*"),
|
79
|
-
File.join("lib", "dbd", dbd + ".rb"),
|
80
|
-
"lib/dbd/#{dbd.downcase}/*.rb",
|
81
|
-
] + DBD_FILES
|
82
|
-
end
|
83
|
-
|
84
|
-
def dbd_gem_files(code_files)
|
85
|
-
DBD_FILES + gem_files(code_files)
|
86
|
-
end
|
87
|
-
|
88
|
-
def dbd_package_files(code_files)
|
89
|
-
DBD_FILES + package_files(code_files)
|
90
|
-
end
|
91
|
-
|
92
|
-
def dbd_gem_spec(dbd, dbd_const, code_files)
|
93
|
-
spec = boilerplate_spec
|
94
|
-
spec.name = dbd_namespace(dbd)
|
95
|
-
spec.version = dbd_version(dbd_const)
|
96
|
-
spec.test_file = 'test/ts_dbd.rb'
|
97
|
-
spec.files = gem_files(code_files)
|
98
|
-
spec.summary = dbd_description(dbd_const)
|
99
|
-
spec.description = dbd_description(dbd_const)
|
100
|
-
spec.add_dependency 'dbi', '>= 0.4.0'
|
101
|
-
|
102
|
-
dcdbd = dbd.downcase
|
103
|
-
|
104
|
-
if DBD_GEM_DEP_MAP[dcdbd]
|
105
|
-
spec.add_dependency DBD_GEM_DEP_MAP[dcdbd]
|
106
|
-
end
|
107
|
-
|
108
|
-
return spec
|
109
|
-
end
|
110
|
-
|
111
|
-
def dbd_version(const)
|
112
|
-
DBI::DBD.const_get(const).const_get("VERSION")
|
113
|
-
end
|
114
|
-
|
115
|
-
def dbd_description(const)
|
116
|
-
DBI::DBD.const_get(const).const_get("DESCRIPTION")
|
117
|
-
end
|
118
|
-
|
119
|
-
|
120
|
-
def build_dbd_tasks(dbd)
|
121
|
-
task :default => DEFAULT_TASKS
|
122
|
-
|
123
|
-
begin
|
124
|
-
done = false
|
125
|
-
dbd_const = nil
|
126
|
-
Dir["lib/dbd/*.rb"].each do |dbd_file|
|
127
|
-
if File.basename(dbd_file.downcase, '.rb') == dbd.to_s.downcase
|
128
|
-
dbd_const = File.basename(dbd_file, '.rb')
|
129
|
-
require "dbd/#{dbd_const}"
|
130
|
-
done = true
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
abort "No DBD found even though we asked to make tasks for it" unless done
|
135
|
-
|
136
|
-
code_files = dbd_code_files(dbd_const)
|
137
|
-
|
138
|
-
spec = dbd_gem_spec(dbd, dbd_const, code_files)
|
139
|
-
|
140
|
-
build_package_tasks(spec, code_files)
|
141
|
-
|
142
|
-
# FIXME: convert to a rake_test_loader sooner or later
|
143
|
-
task :test do
|
144
|
-
ENV["DBTYPES"] = dbd
|
145
|
-
ruby "test/ts_dbd.rb"
|
146
|
-
end
|
147
|
-
rescue LoadError => e
|
148
|
-
DEFAULT_TASKS.each do |x|
|
149
|
-
task x do
|
150
|
-
end
|
151
|
-
end
|
152
|
-
warn "Skipping #{dbd_namespace(dbd)} because we can't require DBD"
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def build_dbi_tasks
|
157
|
-
end
|
158
|
-
|
159
|
-
#
|
160
|
-
# basic tasks
|
161
|
-
#
|
162
|
-
|
163
|
-
task :dist => [:distclean, :package, :rdoc]
|
164
|
-
task :distclean => [:clobber_package, :clobber_rdoc]
|
165
|
-
task :clean => [:distclean]
|
166
|
-
task :default => [:test, :dist]
|
167
|
-
|
168
|
-
task :to_blog => [:clobber_rdoc, :rdoc] do
|
169
|
-
sh "rm -r $git/blog/content/docs/ruby-dbi && mv rdoc $git/blog/content/docs/ruby-dbi"
|
170
|
-
end
|
171
|
-
|
172
|
-
#
|
173
|
-
# Documentation
|
174
|
-
#
|
175
|
-
|
176
|
-
RDoc::Task.new do |rd|
|
177
|
-
rd.rdoc_dir = "rdoc"
|
178
|
-
rd.main = "README"
|
179
|
-
rd.rdoc_files.include("./README")
|
180
|
-
rd.rdoc_files.include("./ChangeLog")
|
181
|
-
rd.rdoc_files.include("./LICENSE")
|
182
|
-
rd.rdoc_files.include("./doc/**/*.rdoc")
|
183
|
-
rd.rdoc_files.include("./lib/**/*.rb")
|
184
|
-
rd.rdoc_files.include("./ext/**/*.c")
|
185
|
-
rd.options = %w(-a)
|
186
|
-
end
|
187
|
-
|
data/doc/DBD_SPEC.rdoc
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
= DBD Specification Version 0.4.0
|
2
|
-
By Erik Hollensbe <erik@hollensbe.org>
|
3
|
-
|
4
|
-
== FOREWORD
|
5
|
-
|
6
|
-
DBI is still in a large state of flux. Previous versions of this
|
7
|
-
specification rarely reflected reality, and the 0.4.0 release is an
|
8
|
-
attempt to get the code and documentation in touch with each other to
|
9
|
-
better reflect said reality.
|
10
|
-
|
11
|
-
While this is a goal, nobody's perfect and there is still a lot of
|
12
|
-
code to check, sanitize, and otherwise clean up. If you find something
|
13
|
-
missing in these specifications while working on a new DBD or a patch
|
14
|
-
for DBI, please, do not do what everything else is doing; alert the
|
15
|
-
appropriate person to get the spec revised. Doing this will save
|
16
|
-
yourself (and the DBI authors) infinite amounts of time.
|
17
|
-
|
18
|
-
== WHAT A DBD IS
|
19
|
-
|
20
|
-
DBD stands for "DataBase Driver" and is the layer that DBI uses to interface
|
21
|
-
with the database. DBDs often employ a low level driver to do the real work
|
22
|
-
with the database, leaving the DBD itself to act as a medium between DBI and
|
23
|
-
that lower level API.
|
24
|
-
|
25
|
-
This allows a great deal of flexibility without having to sacrifice features
|
26
|
-
for compatibility. For example, instead of having one PostgreSQL DBD that
|
27
|
-
handles all version of PostgreSQL and attempts to limit it's functionality
|
28
|
-
based on what version it detects (a error-prone and time/design prohibitive
|
29
|
-
process), one can write two PostgreSQL DBD that handle the differences between
|
30
|
-
"new" and "old" postgres, all while talking to the same low-level driver (yet
|
31
|
-
leveraging different functionality). This method leads to cleaner internals and
|
32
|
-
puts the choice of which to use on the end-user, who is probably a lot more
|
33
|
-
informed about what features they want than your code.
|
34
|
-
|
35
|
-
One traditionally loads a DBD using the DBI.connect method (see DBD LOAD
|
36
|
-
PATHS below) which will attempt to load the DBD, connect to the database with
|
37
|
-
the arguments supplied and return a DatabaseHandle if successful. However, if
|
38
|
-
the DBD is written properly, requiring it directly without DBI's involvement
|
39
|
-
(or existence) should not be an issue.
|
40
|
-
|
41
|
-
== WHERE DBDs LIVE
|
42
|
-
|
43
|
-
DBDs have an expected require path to be loaded by DBI. DBI will attempt to
|
44
|
-
load the middle portion of the DBI.connect DSN provided.
|
45
|
-
|
46
|
-
Example: DBI.connect("dbi:Mysql:mydb") # requires 'dbd/Mysql'
|
47
|
-
|
48
|
-
Since rubygems potentially renders this path virtual, it is not OK to expect
|
49
|
-
this path physically exists in one spot on the filesystem. Many assuptions are
|
50
|
-
currently made about this and will be pruned in 0.6.0.
|
51
|
-
|
52
|
-
If you wish to create submodules for your DBD, create a directory in the 'dbd'
|
53
|
-
directory named the same as the DBD. (E.g., "dbd/Mysql" would have a directory
|
54
|
-
with files in it relating to the Mysql.rb file that DBI loads).
|
55
|
-
|
56
|
-
== HOW DBI INTERFACES WITH YOUR DBD
|
57
|
-
|
58
|
-
Your DBD will create classes representing a DBI::BaseDriver, DBI::BaseDatabase,
|
59
|
-
and DBI::BaseStatement. DBI will link these to DBI::DriverHandle,
|
60
|
-
DBI::DatabaseHandle, and DBI::StatementHandle respectively. Your classes will
|
61
|
-
be called by the Handle classes to retreive information to manipulate and send
|
62
|
-
to the user. This manipulation can be influenced in a number of ways.
|
63
|
-
|
64
|
-
It is strongly recommended you make the effort to read the RDoc for all six
|
65
|
-
of these classes, as they are the meat of this specification, not this
|
66
|
-
document.
|
67
|
-
|
68
|
-
== BUILDING A DBD FROM SCRATCH
|
69
|
-
|
70
|
-
For the purposes of this discussion, we'll call your driver 'Foo'.
|
71
|
-
|
72
|
-
Create your module, DBI::DBD::Foo. Store it somewhere in your load path under
|
73
|
-
dbd/Foo.rb.
|
74
|
-
|
75
|
-
Create classes Driver, Database, and Statement in this new namespace, which
|
76
|
-
inherit from DBI::BaseDriver, DBI::BaseDatabase, and DBI::BaseStatement.
|
77
|
-
Override (at mininum) the methods that return NotImplementedError in your new
|
78
|
-
classes.
|
79
|
-
|
80
|
-
Create a method in the root namespace named +driver_name+. This should return a
|
81
|
-
string with a short name for your driver, this key will be used in type
|
82
|
-
conversion.
|
83
|
-
|
84
|
-
Everything else is up to you, up to and including worrying about interacting
|
85
|
-
with the database.
|
86
|
-
|
87
|
-
At this point, you should be ready to test your driver. See test/DBD_TESTS for
|
88
|
-
information on how to configure that.
|