ydbi 0.5.0 → 0.5.1
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.
- 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
data/doc/DBI_SPEC.rdoc
DELETED
@@ -1,157 +0,0 @@
|
|
1
|
-
= DBI Interface Spec, for version 0.4.0
|
2
|
-
|
3
|
-
by Erik Hollensbe <erik@hollensbe.org>
|
4
|
-
|
5
|
-
== Foreword
|
6
|
-
|
7
|
-
DBI is still in a large state of flux. Previous versions of this
|
8
|
-
specification rarely reflected reality, and the 0.4.0 release is an
|
9
|
-
attempt to get the code and documentation more in sync.
|
10
|
-
|
11
|
-
While this is the goal, 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 bring it to our attention (in IRC or on the mailing list)
|
15
|
-
to get the spec revised. Doing this will save
|
16
|
-
yourself (and the DBI authors) a lot of time.
|
17
|
-
|
18
|
-
== Design
|
19
|
-
|
20
|
-
With DBI, there are the concepts of driver, database, and statement. The core
|
21
|
-
functionality for these concepts is provided by a database driver, or
|
22
|
-
DBD. DBI controls one or more drivers at once, a driver has databases, a
|
23
|
-
database may have statements.
|
24
|
-
|
25
|
-
DBI uses a delegation model to communicate with its DBDs through a
|
26
|
-
series of handles. When a connection to a database is requested, DBI contacts
|
27
|
-
the appropriate DBD and builds a handle in
|
28
|
-
its name that it aligns with a DBI base class for that concept. The
|
29
|
-
handle provided by the DBD is the first-class method of communication,
|
30
|
-
otherwise it resorts to calling the base class methods. This allows
|
31
|
-
DBI to provide a level of consistency unless the DBD author finds it
|
32
|
-
otherwise unnecessary.
|
33
|
-
|
34
|
-
For example: DBI will provide handy methods like fetch_all and
|
35
|
-
fetch_scroll which all leverage the fetch method in the base class,
|
36
|
-
and the fetch method must be implemented by the DBD. However, the DBD
|
37
|
-
may have an internal representation of fetch_scroll (as is the case
|
38
|
-
with the ODBC driver) that may be more suited to direct use, and
|
39
|
-
therefore DBI will never see the base class method. This is similar to
|
40
|
-
inheritance, but there is a distinct disconnect between the handles
|
41
|
-
and the base classes, intentionally so. This way the DBDs have no
|
42
|
-
access to the base class and DBI does all the delegation work. Also,
|
43
|
-
DBI has no idea what the DBD is doing underneath, nor does it need to
|
44
|
-
care as long as valid data is returned.
|
45
|
-
|
46
|
-
== Classes
|
47
|
-
|
48
|
-
These are the classes that make up the core of DBI and provide
|
49
|
-
various functionality:
|
50
|
-
|
51
|
-
=== DBI
|
52
|
-
Core module, responsible for everything underneath it, kickstarting
|
53
|
-
connections and loading drivers.
|
54
|
-
|
55
|
-
=== DBI::Row
|
56
|
-
|
57
|
-
Responsible for representing the result set and managing the type
|
58
|
-
conversion of the result set.
|
59
|
-
|
60
|
-
=== DBI::Utils
|
61
|
-
|
62
|
-
Utility methods which propogate through the rest of DBI.
|
63
|
-
|
64
|
-
=== DBI::SQL
|
65
|
-
|
66
|
-
Utility methods for working with SQL queries. Includes a
|
67
|
-
driver-independent SQL bind manager.
|
68
|
-
|
69
|
-
=== DBI::ColumnInfo
|
70
|
-
|
71
|
-
Responsible for representing the information per column for both
|
72
|
-
queries and table descriptions.
|
73
|
-
|
74
|
-
=== DBI::Type
|
75
|
-
|
76
|
-
Namespace for typecasting classes. These classes are provided with a
|
77
|
-
parse method which converts them to a native Ruby type from a string.
|
78
|
-
|
79
|
-
=== DBI::TypeUtil
|
80
|
-
|
81
|
-
The inverse of DBI::Type, this provides functionality to turn native
|
82
|
-
Ruby types into a representation suitable for the DBD's queries.
|
83
|
-
|
84
|
-
=== DBI::Binary
|
85
|
-
|
86
|
-
The representation of a BLOB/CLOB in a Ruby object. This will
|
87
|
-
eventually be rolled into DBI::Type::, but remains here currently for
|
88
|
-
compatibility purposes.
|
89
|
-
|
90
|
-
=== DBI::Base* and DBI::*Handle
|
91
|
-
|
92
|
-
Please see the Design section above for the description of these modules.
|
93
|
-
|
94
|
-
== Exceptions
|
95
|
-
|
96
|
-
DBI has a slew of custom exceptions it uses to control program flow,
|
97
|
-
and alert the user to specific classes of problems.
|
98
|
-
|
99
|
-
They currently all live in the DBI namespace, although it's expected
|
100
|
-
that there will eventually be an exception namespace.
|
101
|
-
|
102
|
-
=== DBI::Warning < RuntimeError
|
103
|
-
For important warnings such as data truncation, etc.
|
104
|
-
|
105
|
-
=== DBI::Error < RuntimeError
|
106
|
-
Base class of all other error exceptions.
|
107
|
-
Rescue this to rescue all DBI errors.
|
108
|
-
|
109
|
-
=== DBI::InterfaceError < DBI::Error
|
110
|
-
Exception for errors related to the DBI interface rather
|
111
|
-
than the database itself.
|
112
|
-
|
113
|
-
=== DBI::NotImplementedError < DBI::InterfaceError
|
114
|
-
Exception raised if the DBD driver has not specified
|
115
|
-
a mandatory method.
|
116
|
-
|
117
|
-
=== DBI::DatabaseError < DBI::Error
|
118
|
-
Exception for errors related to the database.
|
119
|
-
|
120
|
-
Has three attributes: ((|err|)), ((|errstr|)) and ((|state|)).
|
121
|
-
|
122
|
-
=== DBI::DataError < DBI::DatabaseError
|
123
|
-
Exception for errors due to problems with the processed
|
124
|
-
data, such as division by zero, numeric value out of range, etc.
|
125
|
-
|
126
|
-
=== DBI::OperationalError < DBI::DatabaseError
|
127
|
-
Exception for errors related to the database's operation which
|
128
|
-
are not necessarily under the control of the programmer. This would include
|
129
|
-
such things as unexpected disconnection, failure to find a datasource name,
|
130
|
-
failure to process a transaction, memory allocation errors, etc.
|
131
|
-
|
132
|
-
=== DBI::IntegrityError < DBI::DatabaseError
|
133
|
-
Exception raised when the relational integrity of the database
|
134
|
-
is affected, such as when a foreign key constraint is violated.
|
135
|
-
|
136
|
-
=== DBI::InternalError < DBI::DatabaseError
|
137
|
-
Exception raised when the database encounters an internal error,
|
138
|
-
such as a cursor not being valid anymore, or a transaction going out of
|
139
|
-
sync.
|
140
|
-
|
141
|
-
=== DBI::ProgrammingError < DBI::DatabaseError
|
142
|
-
Exception raised for programming errors, e.g., table not found
|
143
|
-
or already exists, syntax error in SQL statement, wrong number
|
144
|
-
of parameters specified, etc.
|
145
|
-
|
146
|
-
=== DBI::NotSupportedError < DBI::DatabaseError
|
147
|
-
Raised if, e.g., ((<commit>)) is called for a database that does not
|
148
|
-
support transactions.
|
149
|
-
|
150
|
-
== API
|
151
|
-
|
152
|
-
To save my sanity, I have joined the specification and the rdoc for
|
153
|
-
DBI. Please review the specification there.
|
154
|
-
|
155
|
-
If you wish to author your own DBD, please see DBD_SPEC.rdoc,
|
156
|
-
which is a more in-depth view of the communication between DBI and
|
157
|
-
DBDs.
|
data/doc/homepage/contact.html
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
|
6
|
-
<title>Ruby/DBI - Direct database access layer for Ruby</title>
|
7
|
-
<link rel="stylesheet" type="text/css" href="ruby-dbi.css"/>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<div class="body-container">
|
11
|
-
<h1>Ruby/DBI - Contact Information</h1>
|
12
|
-
<div class="main-container">
|
13
|
-
<div class="nav-container">
|
14
|
-
<h1>Links</h1>
|
15
|
-
<a href="index.html">Home</a>
|
16
|
-
<a href="http://rubyforge.org/projects/ruby-dbi">RubyForge Project</a>
|
17
|
-
<a href="http://ruby-dbi.rubyforge.org/rdoc/index.html">RDoc</a>
|
18
|
-
<a href="development.html">Developer Information</a>
|
19
|
-
<a href="http://www.kitebird.com/articles/ruby-dbi.html">Ruby/DBI Tutorial</a>
|
20
|
-
<a href="contact.html">Contact/Reporting Bugs</a>
|
21
|
-
</div>
|
22
|
-
<p>
|
23
|
-
If you'd like to contact us to report a bug or submit a patch,
|
24
|
-
please use the <a
|
25
|
-
href="http://rubyforge.org/tracker/?group_id=234">tracker</a>
|
26
|
-
on RubyForge.
|
27
|
-
</p>
|
28
|
-
|
29
|
-
<p>
|
30
|
-
If you'd like to ask questions about using Ruby/DBI, there is a
|
31
|
-
<a href="http://rubyforge.org/mailman/listinfo/ruby-dbi-users">ruby-dbi-users</a> email list where those questions
|
32
|
-
can be answered. Likewise, <a
|
33
|
-
href="http://rubyforge.org/mailman/listinfo/ruby-dbi-bugs">ruby-dbi-bugs</a>
|
34
|
-
is for discussing bug reports in detail, and <a
|
35
|
-
href="http://rubyforge.org/mailman/listinfo/ruby-dbi-devel-new">ruby-dbi-devel-new</a> is for discussing future
|
36
|
-
development and management of the project.
|
37
|
-
</p>
|
38
|
-
|
39
|
-
<p>
|
40
|
-
If you're an irc user, the <b>#ruby-dbi</b> irc channel on
|
41
|
-
<b>freenode</b> will get you in touch with developers and
|
42
|
-
advanced users.
|
43
|
-
</p>
|
44
|
-
|
45
|
-
<p>
|
46
|
-
If these avenues are not working for you for some reason,
|
47
|
-
please feel free to contact <a
|
48
|
-
href="mailto:erik-at-hollensbe-dot-org">Erik</a>
|
49
|
-
directly. He will be glad to help!
|
50
|
-
</p>
|
51
|
-
</div>
|
52
|
-
<br />
|
53
|
-
<br />
|
54
|
-
<div class="copyright">
|
55
|
-
©2008 Erik Hollensbe, all rights reserved. Please see the
|
56
|
-
README file for the full copyright notice. Please see the
|
57
|
-
LICENSE file in the source package for information on
|
58
|
-
redistributing the source or any of the site content.
|
59
|
-
</div>
|
60
|
-
</div>
|
61
|
-
</body>
|
62
|
-
</html>
|
@@ -1,124 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
|
6
|
-
<title>Ruby/DBI - Direct database access layer for Ruby</title>
|
7
|
-
<link rel="stylesheet" type="text/css" href="ruby-dbi.css"/>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<div class="body-container">
|
11
|
-
<h1>Ruby/DBI - Development Information</h1>
|
12
|
-
<div class="main-container">
|
13
|
-
<div class="nav-container">
|
14
|
-
<h1>Links</h1>
|
15
|
-
<a href="index.html">Home</a>
|
16
|
-
<a href="http://rubyforge.org/projects/ruby-dbi">RubyForge Project</a>
|
17
|
-
<a href="http://ruby-dbi.rubyforge.org/rdoc/index.html">RDoc</a>
|
18
|
-
<a href="development.html">Developer Information</a>
|
19
|
-
<a href="http://www.kitebird.com/articles/ruby-dbi.html">Ruby/DBI Tutorial</a>
|
20
|
-
<a href="contact.html">Contact/Reporting Bugs</a>
|
21
|
-
</div>
|
22
|
-
<p>
|
23
|
-
Regarding patches, please consider these issues:
|
24
|
-
<br />
|
25
|
-
<ul>
|
26
|
-
<li>
|
27
|
-
If your patch does not contain tests, it better be
|
28
|
-
very compelling, as someone else will be forced to
|
29
|
-
write them.
|
30
|
-
</li>
|
31
|
-
<li>
|
32
|
-
Please ensure your patch addresses the whole
|
33
|
-
problem space. If it's a patch for DBI, makes sure it
|
34
|
-
works with <b>all</b> DBDs. Likewise, if it is DBD
|
35
|
-
scope, it should handle all versions of the database
|
36
|
-
that DBD supports.
|
37
|
-
</li>
|
38
|
-
<li>
|
39
|
-
Please follow the existing formatting in the
|
40
|
-
files. Check your diffs to see that you aren't
|
41
|
-
generating patches with tons of formatting-only
|
42
|
-
changes.
|
43
|
-
</li>
|
44
|
-
<li>
|
45
|
-
If you plan a series of patches, consider setting
|
46
|
-
up a git repository, or merging your patches before
|
47
|
-
you submit them.
|
48
|
-
</li>
|
49
|
-
</ul>
|
50
|
-
<br />
|
51
|
-
</p>
|
52
|
-
<p>
|
53
|
-
Regarding bug reports, please consider these issues:
|
54
|
-
<br />
|
55
|
-
<ul>
|
56
|
-
<li>
|
57
|
-
Use the tracker if you can. Posting to the lists or
|
58
|
-
a private email is ok, but if it's multipart or
|
59
|
-
significantly complex you may be asked to post it
|
60
|
-
to the tracker anyways.
|
61
|
-
</li>
|
62
|
-
<li>
|
63
|
-
Please search the tracker first, and have a
|
64
|
-
repeatable use case that accurately describes your
|
65
|
-
problem.
|
66
|
-
</li>
|
67
|
-
<li>
|
68
|
-
If you post to the tracker, have a rubyforge
|
69
|
-
account and ensure you're logged in. If you don't,
|
70
|
-
and questions to need to be asked, your bug will
|
71
|
-
likely be quickly round-filed. Our tracker is not
|
72
|
-
your cathartic dumping ground.
|
73
|
-
</li>
|
74
|
-
</ul>
|
75
|
-
<p>
|
76
|
-
If you'd like to contact us to report a bug or submit a patch,
|
77
|
-
please use the <a
|
78
|
-
href="http://rubyforge.org/tracker/?group_id=234">tracker</a>
|
79
|
-
on RubyForge. If you plan long term development, consider
|
80
|
-
setting up a git repository other developers can pull from.
|
81
|
-
</p>
|
82
|
-
|
83
|
-
<p>
|
84
|
-
Please see the <a href="contact.html">contact</a> page
|
85
|
-
about contacting developers or mailing lists.
|
86
|
-
</p>
|
87
|
-
|
88
|
-
<p>
|
89
|
-
We now use 'git' for our revision control system. We now push
|
90
|
-
to several locations:
|
91
|
-
|
92
|
-
<dl>
|
93
|
-
<dt>Rubyforge</dt>
|
94
|
-
<dd>git://rubyforge.org/ruby-dbi.git</dd>
|
95
|
-
<dt>GitHub</dt>
|
96
|
-
<dd>git://github.com/erikh/ruby-dbi.git</dd>
|
97
|
-
<dt>hollensbe.org</dt>
|
98
|
-
<dd>git://hollensbe.org/git/ruby-dbi.git</dd>
|
99
|
-
</dl>
|
100
|
-
<br />
|
101
|
-
|
102
|
-
Forward development occurs in the 'development' branch,
|
103
|
-
which is version-tagged and merged into 'master' at release
|
104
|
-
time. 'master' is used to track release versions and
|
105
|
-
maintenance to those versions.
|
106
|
-
</p>
|
107
|
-
|
108
|
-
<p>
|
109
|
-
Ruby/DBI is a BSD-licensed product. As a result, the
|
110
|
-
licensing on your patches must be the same. Please do
|
111
|
-
not send patches that are of any other license. Thanks!
|
112
|
-
</p>
|
113
|
-
</div>
|
114
|
-
<br />
|
115
|
-
<br />
|
116
|
-
<div class="copyright">
|
117
|
-
©2008 Erik Hollensbe, all rights reserved. Please see the
|
118
|
-
README file for the full copyright notice. Please see the
|
119
|
-
LICENSE file in the source package for information on
|
120
|
-
redistributing the source or any of the site content.
|
121
|
-
</div>
|
122
|
-
</div>
|
123
|
-
</body>
|
124
|
-
</html>
|
data/doc/homepage/index.html
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
|
6
|
-
<title>Ruby/DBI - Direct database access layer for Ruby</title>
|
7
|
-
<link rel="stylesheet" type="text/css" href="ruby-dbi.css"/>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<div class="body-container">
|
11
|
-
<h1>Ruby/DBI - Direct database access layer for Ruby</h1>
|
12
|
-
<div class="main-container">
|
13
|
-
<div class="nav-container">
|
14
|
-
<h1>Links</h1>
|
15
|
-
<a href="index.html">Home</a>
|
16
|
-
<a href="http://rubyforge.org/projects/ruby-dbi">RubyForge Project</a>
|
17
|
-
<a href="http://ruby-dbi.rubyforge.org/rdoc/index.html">RDoc</a>
|
18
|
-
<a href="development.html">Developer Information</a>
|
19
|
-
<a href="http://www.kitebird.com/articles/ruby-dbi.html">Ruby/DBI Tutorial</a>
|
20
|
-
<a href="contact.html">Contact/Reporting Bugs</a>
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<p>
|
24
|
-
Ruby/DBI is a database interface in the spirit of Perl's prolific
|
25
|
-
<a href="http://search.cpan.org/~timb/DBI/DBI.pm">DBI</a> authored
|
26
|
-
by Tim Bunce.
|
27
|
-
</p>
|
28
|
-
|
29
|
-
<p>
|
30
|
-
Ruby/DBI differs in quite a few ways, however. It incorporates
|
31
|
-
many "rubyisms" while maintaining the core DBI interface, and a
|
32
|
-
suite of commonly used DBD's are maintained with the
|
33
|
-
application.
|
34
|
-
</p>
|
35
|
-
|
36
|
-
<p>
|
37
|
-
Ruby/DBI is <i>not</i> an ORM, like <a
|
38
|
-
href="http://ar.rubyonrails.com">ActiveRecord</a> or <a
|
39
|
-
href="http://datamapper.rubyforge.org">DataMapper</a>. It is a
|
40
|
-
lightweight, centralized API to database manipulation. An ORM may
|
41
|
-
or may not be what you want for a given situation, due to weight,
|
42
|
-
ease-of-use or other issues. Our goal with Ruby/DBI is to provide a
|
43
|
-
compelling, lightweight interface that you can use for things where
|
44
|
-
an ORM is too much or too cumbersome.
|
45
|
-
</p>
|
46
|
-
|
47
|
-
<p>
|
48
|
-
Getting started with Ruby/DBI is very easy if you have a working
|
49
|
-
knowledge of SQL and your target database. Read the <a
|
50
|
-
href="http://ruby-dbi.rubyforge.org/rdoc/index.html">Documentation</a>
|
51
|
-
to get on your way!
|
52
|
-
</p>
|
53
|
-
|
54
|
-
<p>
|
55
|
-
The maintainer, Erik Hollensbe, has made a commitment to
|
56
|
-
keeping Ruby/DBI compatible with future Ruby releases. There is
|
57
|
-
also a significant interest in enhancing the suite by further
|
58
|
-
clarifying and enforcing the interface, and further tailoring DBI
|
59
|
-
for the specific needs of Ruby users (as opposed to many of the
|
60
|
-
Perlisms maintained) without impacting the goal of the project.
|
61
|
-
There is also significant effort applied to clarifying the
|
62
|
-
underpinnings, making debugging and development simpler.
|
63
|
-
</p>
|
64
|
-
|
65
|
-
<p>
|
66
|
-
Ruby/DBI is a very old project as far as the ruby community is
|
67
|
-
concerned, tracing back to at least 2001. There are plenty of
|
68
|
-
people who <a
|
69
|
-
href="http://ruby-dbi.rubyforge.org/rdoc/index.html">have
|
70
|
-
contributed</a> to this effort. Big thanks to the original
|
71
|
-
project lead, Michael Neumann, and Francis Hwang and Daniel Berger, who held the
|
72
|
-
project in escrow for such a long time.
|
73
|
-
</p>
|
74
|
-
</div>
|
75
|
-
<div class="copyright">
|
76
|
-
©2008 Erik Hollensbe, all rights reserved. Please see the
|
77
|
-
README file for the full copyright notice. Please see the
|
78
|
-
LICENSE file in the source package for information on
|
79
|
-
redistributing the source or any of the site content.
|
80
|
-
</div>
|
81
|
-
</div>
|
82
|
-
</body>
|
83
|
-
</html>
|
data/doc/homepage/ruby-dbi.css
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
BODY {
|
2
|
-
background-color: #666;
|
3
|
-
}
|
4
|
-
|
5
|
-
a:visited {
|
6
|
-
color: #144;
|
7
|
-
}
|
8
|
-
|
9
|
-
a {
|
10
|
-
color: white;
|
11
|
-
}
|
12
|
-
|
13
|
-
a:active {
|
14
|
-
text-decoration: none;
|
15
|
-
}
|
16
|
-
|
17
|
-
a:hover {
|
18
|
-
text-decoration: none;
|
19
|
-
}
|
20
|
-
|
21
|
-
.body-container {
|
22
|
-
margin-left: auto;
|
23
|
-
margin-right: auto;
|
24
|
-
margin-top: 50px;
|
25
|
-
width: 80%;
|
26
|
-
background-color: #AAA;
|
27
|
-
color: black;
|
28
|
-
padding: 10px;
|
29
|
-
border: 1px solid black;
|
30
|
-
}
|
31
|
-
|
32
|
-
h1 {
|
33
|
-
display: block;
|
34
|
-
margin: 2em;
|
35
|
-
border: 1px solid black;
|
36
|
-
padding: 1em;
|
37
|
-
color: #444;
|
38
|
-
font-size: 1em;
|
39
|
-
text-align: center;
|
40
|
-
font-family: sans-serif;
|
41
|
-
}
|
42
|
-
|
43
|
-
.main-container {
|
44
|
-
margin: 2em;
|
45
|
-
}
|
46
|
-
|
47
|
-
.nav-container {
|
48
|
-
display: block;
|
49
|
-
border: 1px solid black;
|
50
|
-
float: left;
|
51
|
-
vertical-align; top:
|
52
|
-
font-size: .8em;
|
53
|
-
min-width: 20%;
|
54
|
-
margin-right: 2em;
|
55
|
-
margin-bottom: 2em;
|
56
|
-
}
|
57
|
-
|
58
|
-
.nav-container h1 {
|
59
|
-
margin: 0;
|
60
|
-
padding: 0;
|
61
|
-
border: 0;
|
62
|
-
border-bottom: 1px solid black;
|
63
|
-
font-size: 1.2em;
|
64
|
-
font-weight: bold;
|
65
|
-
color: black;
|
66
|
-
text-align: center;
|
67
|
-
font-family: sans-serif;
|
68
|
-
}
|
69
|
-
|
70
|
-
.nav-container a {
|
71
|
-
display: block;
|
72
|
-
padding: 5px;
|
73
|
-
}
|
74
|
-
|
75
|
-
.nav-container a:hover {
|
76
|
-
background-color: #444;
|
77
|
-
color: white;
|
78
|
-
font-weight: bold;
|
79
|
-
}
|
80
|
-
|
81
|
-
.copyright {
|
82
|
-
display: block;
|
83
|
-
margin: 2em;
|
84
|
-
border: 1px solid black;
|
85
|
-
padding: 1em;
|
86
|
-
color: #444;
|
87
|
-
font-size: 0.6em;
|
88
|
-
text-align: center;
|
89
|
-
font-family: sans-serif;
|
90
|
-
}
|
91
|
-
|
data/lib/dbd/Mysql.rb
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2001, 2002 Michael Neumann <neumann@s-direktnet.de>
|
3
|
-
#
|
4
|
-
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
7
|
-
# modification, are permitted provided that the following conditions
|
8
|
-
# are met:
|
9
|
-
# 1. Redistributions of source code must retain the above copyright
|
10
|
-
# notice, this list of conditions and the following disclaimer.
|
11
|
-
# 2. Redistributions in binary form must reproduce the above copyright
|
12
|
-
# notice, this list of conditions and the following disclaimer in the
|
13
|
-
# documentation and/or other materials provided with the distribution.
|
14
|
-
# 3. The name of the author may not be used to endorse or promote products
|
15
|
-
# derived from this software without specific prior written permission.
|
16
|
-
#
|
17
|
-
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
18
|
-
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
19
|
-
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
20
|
-
# THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
23
|
-
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
24
|
-
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
25
|
-
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
-
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
-
#
|
28
|
-
# $Id$
|
29
|
-
#++
|
30
|
-
|
31
|
-
begin
|
32
|
-
require 'rubygems'
|
33
|
-
gem 'mysql'
|
34
|
-
gem 'dbi'
|
35
|
-
rescue LoadError => e
|
36
|
-
end
|
37
|
-
|
38
|
-
require 'dbi'
|
39
|
-
require "mysql"
|
40
|
-
require "thread" # for Mutex
|
41
|
-
|
42
|
-
module DBI
|
43
|
-
module DBD
|
44
|
-
#
|
45
|
-
# DBD::Mysql - Database Driver for the MySQL database system.
|
46
|
-
#
|
47
|
-
# Requires DBI and the 'mysql' gem or package to work.
|
48
|
-
#
|
49
|
-
# Only things that extend DBI's results are documented.
|
50
|
-
#
|
51
|
-
module Mysql
|
52
|
-
VERSION = "0.4.4"
|
53
|
-
DESCRIPTION = "MySQL DBI DBD, Leverages 'mysql' low-level driver"
|
54
|
-
|
55
|
-
MyError = ::MysqlError
|
56
|
-
|
57
|
-
#
|
58
|
-
# returns 'Mysql'
|
59
|
-
#
|
60
|
-
# See DBI::TypeUtil#convert for more information.
|
61
|
-
#
|
62
|
-
def self.driver_name
|
63
|
-
"Mysql"
|
64
|
-
end
|
65
|
-
|
66
|
-
DBI::TypeUtil.register_conversion(driver_name) do |obj|
|
67
|
-
newobj = case obj
|
68
|
-
when ::DBI::Binary
|
69
|
-
obj = obj.to_s.gsub(/\\/) { "\\\\" }
|
70
|
-
obj = obj.to_s.gsub(/'/) { "''" }
|
71
|
-
"'#{obj}'"
|
72
|
-
when ::DateTime
|
73
|
-
"'#{obj.strftime("%Y-%m-%d %H:%M:%S")}'"
|
74
|
-
when ::Time
|
75
|
-
"'#{obj.strftime("%H:%M:%S")}'"
|
76
|
-
when ::Date
|
77
|
-
"'#{obj.strftime("%Y-%m-%d")}'"
|
78
|
-
when ::NilClass
|
79
|
-
"NULL"
|
80
|
-
else
|
81
|
-
obj
|
82
|
-
end
|
83
|
-
|
84
|
-
if newobj.object_id == obj.object_id
|
85
|
-
[newobj, true]
|
86
|
-
else
|
87
|
-
[newobj, false]
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
#
|
95
|
-
# Utility Methods for the MySQL DBD.
|
96
|
-
#
|
97
|
-
|
98
|
-
module DBI::DBD::Mysql::Util
|
99
|
-
private
|
100
|
-
|
101
|
-
# Raise exception using information from MysqlError object e.
|
102
|
-
# For state value, use SQLSTATE value if mysql-ruby defines
|
103
|
-
# sqlstate method, otherwise nil.
|
104
|
-
def error(e)
|
105
|
-
sqlstate = e.respond_to?("sqlstate") ? e.sqlstate : nil
|
106
|
-
raise DBI::DatabaseError.new(e.message, e.errno, sqlstate)
|
107
|
-
end
|
108
|
-
|
109
|
-
end # module Util
|
110
|
-
|
111
|
-
module DBI::DBD::Mysql::Type
|
112
|
-
#
|
113
|
-
# Custom handling for DATE types in MySQL. See DBI::Type for more
|
114
|
-
# information.
|
115
|
-
#
|
116
|
-
class Date < DBI::Type::Null
|
117
|
-
def self.parse(obj)
|
118
|
-
obj = super
|
119
|
-
return obj unless obj
|
120
|
-
|
121
|
-
case obj.class
|
122
|
-
when ::Date
|
123
|
-
return obj
|
124
|
-
when ::String
|
125
|
-
return ::Date.strptime(obj, "%Y-%m-%d")
|
126
|
-
else
|
127
|
-
return ::Date.parse(obj.to_s) if obj.respond_to? :to_s
|
128
|
-
return ::Date.parse(obj.to_str) if obj.respond_to? :to_str
|
129
|
-
return obj
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
require 'dbd/mysql/driver'
|
136
|
-
require 'dbd/mysql/database'
|
137
|
-
require 'dbd/mysql/statement'
|