sqlite-ruby 2.1.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/README +34 -0
- data/doc/faq/faq.html +390 -0
- data/doc/faq/faq.rb +145 -0
- data/doc/faq/faq.yml +453 -0
- data/ext/extconf.rb +8 -0
- data/ext/sqlite-api.c +1414 -0
- data/lib/sqlite.rb +34 -0
- data/lib/sqlite/database.rb +682 -0
- data/lib/sqlite/parsed_statement.rb +233 -0
- data/lib/sqlite/pragmas.rb +236 -0
- data/lib/sqlite/resultset.rb +168 -0
- data/lib/sqlite/statement.rb +145 -0
- data/lib/sqlite/translator.rb +135 -0
- data/lib/sqlite/version.rb +45 -0
- data/lib/sqlite_api.so +0 -0
- data/test/db/fixtures.sql +25 -0
- data/test/tc_api_core.rb +201 -0
- data/test/tc_arrayfields.rb +74 -0
- data/test/tc_database.rb +335 -0
- data/test/tc_parsed_statement.rb +160 -0
- data/test/tc_pragmas.rb +207 -0
- data/test/tc_translator.rb +115 -0
- data/test/tc_type_translation.rb +55 -0
- data/test/tests.rb +133 -0
- metadata +67 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
#--
|
2
|
+
# =============================================================================
|
3
|
+
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
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 are met:
|
8
|
+
#
|
9
|
+
# * Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# * Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# * The names of its contributors may not be used to endorse or promote
|
17
|
+
# products derived from this software without specific prior written
|
18
|
+
# permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
# =============================================================================
|
31
|
+
#++
|
32
|
+
|
33
|
+
$:.unshift "lib"
|
34
|
+
|
35
|
+
require 'sqlite'
|
36
|
+
require 'test/unit'
|
37
|
+
|
38
|
+
class TC_TypeTranslation < Test::Unit::TestCase
|
39
|
+
|
40
|
+
def setup
|
41
|
+
@db = SQLite::Database.open( "db/fixtures.db" )
|
42
|
+
@db.type_translation = true
|
43
|
+
end
|
44
|
+
|
45
|
+
def teardown
|
46
|
+
@db.close
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_execute_no_block
|
50
|
+
rows = @db.execute( "select * from A order by name limit 2" )
|
51
|
+
|
52
|
+
assert_equal [ [nil, 6], ["Amber", 5] ], rows
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
data/test/tests.rb
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
#--
|
2
|
+
# =============================================================================
|
3
|
+
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
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 are met:
|
8
|
+
#
|
9
|
+
# * Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# * Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# * The names of its contributors may not be used to endorse or promote
|
17
|
+
# products derived from this software without specific prior written
|
18
|
+
# permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
24
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
# =============================================================================
|
32
|
+
#++
|
33
|
+
|
34
|
+
$:.unshift "lib"
|
35
|
+
|
36
|
+
require 'test/unit/testsuite'
|
37
|
+
require 'fileutils'
|
38
|
+
require 'rbconfig'
|
39
|
+
|
40
|
+
Dir.chdir( File.dirname( __FILE__ ) )
|
41
|
+
|
42
|
+
# =============================================================================
|
43
|
+
# ENSURE THAT THE EXTENSION LIBRARY IS AVAILABLE AND UP-TO-DATE
|
44
|
+
# =============================================================================
|
45
|
+
|
46
|
+
FileUtils.mkdir_p "lib"
|
47
|
+
|
48
|
+
ext_lib = "lib/sqlite_api.#{Config::CONFIG['DLEXT']}"
|
49
|
+
ext_src = %w{ ../ext/sqlite-api.c ../ext/extconf.rb }
|
50
|
+
unless FileUtils.uptodate?( ext_lib, ext_src )
|
51
|
+
FileUtils.mkdir_p "build", :verbose=>true
|
52
|
+
FileUtils.cp ext_src, "build"
|
53
|
+
FileUtils.cd( "build" ) do
|
54
|
+
puts "Building extension library"
|
55
|
+
system "ruby extconf.rb > /dev/null" or
|
56
|
+
fail "could not configure SQLite/Ruby module"
|
57
|
+
system "make > /dev/null" or
|
58
|
+
fail "could not build SQLite/Ruby module"
|
59
|
+
end
|
60
|
+
FileUtils.cp "build/sqlite_api.#{Config::CONFIG['DLEXT']}", "lib",
|
61
|
+
:verbose=>true
|
62
|
+
FileUtils.rm_rf "build"
|
63
|
+
end
|
64
|
+
|
65
|
+
Dir["../lib/**/*.rb"].map { |i| i[3..-1] }.each do |file|
|
66
|
+
unless FileUtils.uptodate?( file, "../#{file}" )
|
67
|
+
dir = File.dirname( file )
|
68
|
+
FileUtils.mkdir_p dir, :verbose=>true unless File.exist?( dir )
|
69
|
+
FileUtils.cp "../#{file}", file, :verbose=>true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# =============================================================================
|
74
|
+
# LOAD THE TEST CASES
|
75
|
+
# =============================================================================
|
76
|
+
|
77
|
+
Dir["**/tc_*.rb"].each { |file| load file }
|
78
|
+
|
79
|
+
class TS_AllTests
|
80
|
+
def self.suite
|
81
|
+
suite = Test::Unit::TestSuite.new( "All SQLite/Ruby Unit Tests" )
|
82
|
+
|
83
|
+
ObjectSpace.each_object( Class ) do |unit_test|
|
84
|
+
next unless unit_test.name =~ /^T[CS]_/ &&
|
85
|
+
unit_test.superclass == Test::Unit::TestCase
|
86
|
+
suite << unit_test.suite
|
87
|
+
end
|
88
|
+
|
89
|
+
return suite
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
require 'test/unit/ui/console/testrunner'
|
94
|
+
test_runner = Test::Unit::UI::Console::TestRunner
|
95
|
+
|
96
|
+
case ARGV[0]
|
97
|
+
when "GTK"
|
98
|
+
require 'test/unit/ui/gtk/testrunner'
|
99
|
+
test_runner = Test::Unit::UI::GTK::TestRunner
|
100
|
+
when "GTK2"
|
101
|
+
require 'test/unit/ui/gtk2/testrunner'
|
102
|
+
test_runner = Test::Unit::UI::GTK2::TestRunner
|
103
|
+
when "Fox"
|
104
|
+
require 'test/unit/ui/fox/testrunner'
|
105
|
+
test_runner = Test::Unit::UI::Fox::TestRunner
|
106
|
+
when "Tk"
|
107
|
+
require 'test/unit/ui/tk/testrunner'
|
108
|
+
test_runner = Test::Unit::Tk::Fox::TestRunner
|
109
|
+
end
|
110
|
+
|
111
|
+
use_reporter = ARGV.find { |arg| arg.downcase == "report" }
|
112
|
+
|
113
|
+
if use_reporter
|
114
|
+
begin
|
115
|
+
require 'test/unit/util/reporter'
|
116
|
+
rescue LoadError => l
|
117
|
+
use_reporter = false
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
FileUtils.rm_f "db/fixtures.db"
|
122
|
+
system "sqlite db/fixtures.db < db/fixtures.sql"
|
123
|
+
|
124
|
+
if use_reporter
|
125
|
+
path = File.join( File.dirname( __FILE__ ), "..", "report" )
|
126
|
+
FileUtils.mkdir_p path
|
127
|
+
Test::Unit::Util::Reporter.run( test_runner, TS_AllTests.suite, path, :html )
|
128
|
+
puts "An HTML report of these unit tests has been written to #{path}"
|
129
|
+
else
|
130
|
+
test_runner.run( TS_AllTests )
|
131
|
+
end
|
132
|
+
|
133
|
+
FileUtils.rm_f "db/fixtures.db"
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.1
|
3
|
+
specification_version: 1
|
4
|
+
name: sqlite-ruby
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 2.1.0
|
7
|
+
date: 2004-09-29
|
8
|
+
summary: SQLite/Ruby is a module to allow Ruby scripts to interface with a SQLite database.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
author: Jamis Buck
|
12
|
+
email: jgb3@email.byu.edu
|
13
|
+
homepage: http://sqlite-ruby.rubyforge.org
|
14
|
+
rubyforge_project:
|
15
|
+
description:
|
16
|
+
autorequire: sqlite
|
17
|
+
default_executable:
|
18
|
+
bindir: bin
|
19
|
+
has_rdoc: true
|
20
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
|
+
requirements:
|
22
|
+
-
|
23
|
+
- ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 1.8.0
|
26
|
+
version:
|
27
|
+
platform: mswin32
|
28
|
+
files:
|
29
|
+
- doc/faq
|
30
|
+
- doc/faq/faq.html
|
31
|
+
- doc/faq/faq.yml
|
32
|
+
- doc/faq/faq.rb
|
33
|
+
- ext/extconf.rb
|
34
|
+
- ext/sqlite-api.c
|
35
|
+
- lib/sqlite_api.so
|
36
|
+
- lib/sqlite.rb
|
37
|
+
- lib/sqlite
|
38
|
+
- lib/sqlite/statement.rb
|
39
|
+
- lib/sqlite/database.rb
|
40
|
+
- lib/sqlite/parsed_statement.rb
|
41
|
+
- lib/sqlite/translator.rb
|
42
|
+
- lib/sqlite/resultset.rb
|
43
|
+
- lib/sqlite/version.rb
|
44
|
+
- lib/sqlite/pragmas.rb
|
45
|
+
- test/db
|
46
|
+
- test/tc_parsed_statement.rb
|
47
|
+
- test/tc_api_core.rb
|
48
|
+
- test/tests.rb
|
49
|
+
- test/tc_pragmas.rb
|
50
|
+
- test/tc_arrayfields.rb
|
51
|
+
- test/tc_translator.rb
|
52
|
+
- test/tc_type_translation.rb
|
53
|
+
- test/tc_database.rb
|
54
|
+
- test/db/fixtures.sql
|
55
|
+
- README
|
56
|
+
test_files:
|
57
|
+
- test/tests.rb
|
58
|
+
rdoc_options:
|
59
|
+
- "--main"
|
60
|
+
- README
|
61
|
+
extra_rdoc_files:
|
62
|
+
- README
|
63
|
+
- ext/sqlite-api.c
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
requirements: []
|
67
|
+
dependencies: []
|