fluent-query-sqlite3 0.9.0
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.
- data/.document +5 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +46 -0
- data/LICENSE.txt +20 -0
- data/README.md +31 -0
- data/Rakefile +29 -0
- data/VERSION +1 -0
- data/lib/fluent-query/drivers/sqlite3.rb +95 -0
- data/lib/fluent-query/sqlite3.rb +3 -0
- metadata +131 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
gem "fluent-query-dbi", ">= 0.9.0"
|
5
|
+
gem "fluent-query-sql", ">= 0.9.0"
|
6
|
+
gem "fluent-query", ">= 0.9.0"
|
7
|
+
gem "dbd-sqlite3", ">= 1.2.5"
|
8
|
+
|
9
|
+
# Add dependencies to develop your gem here.
|
10
|
+
# Include everything needed to run rake, tests, features, etc.
|
11
|
+
group :development do
|
12
|
+
gem "bundler", ">= 1.0.13"
|
13
|
+
gem "jeweler", ">= 1.6.0"
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
# fluent-query-sql
|
19
|
+
# fluent-query-dbh
|
20
|
+
# fluent-query-mysql
|
21
|
+
# fluent-query-sqlite
|
22
|
+
# fluent-query-postgresql
|
23
|
+
# native-query
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
dbd-sqlite3 (1.2.5)
|
6
|
+
dbi (>= 0.4.0)
|
7
|
+
sqlite3-ruby
|
8
|
+
dbi (0.4.5)
|
9
|
+
deprecated (= 2.0.1)
|
10
|
+
deprecated (2.0.1)
|
11
|
+
fluent-query (0.9.1)
|
12
|
+
abstract (>= 1.0.0)
|
13
|
+
hash-utils (>= 0.18.0)
|
14
|
+
hashie (>= 1.0.0)
|
15
|
+
fluent-query-dbi (0.9.1)
|
16
|
+
abstract (>= 1.0.0)
|
17
|
+
dbi (>= 0.4.5)
|
18
|
+
fluent-query (>= 0.9.0)
|
19
|
+
fluent-query-sql (>= 0.9.0)
|
20
|
+
hash-utils (>= 0.18.0)
|
21
|
+
fluent-query-sql (0.9.1)
|
22
|
+
abstract (>= 1.0.0)
|
23
|
+
fluent-query (>= 0.9.0)
|
24
|
+
hash-utils (>= 0.18.0)
|
25
|
+
git (1.2.5)
|
26
|
+
hash-utils (0.18.0)
|
27
|
+
hashie (1.0.0)
|
28
|
+
jeweler (1.6.4)
|
29
|
+
bundler (~> 1.0)
|
30
|
+
git (>= 1.2.5)
|
31
|
+
rake
|
32
|
+
rake (0.9.2)
|
33
|
+
sqlite3 (1.3.3)
|
34
|
+
sqlite3-ruby (1.3.3)
|
35
|
+
sqlite3 (>= 1.3.3)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
bundler (>= 1.0.13)
|
42
|
+
dbd-sqlite3 (>= 1.2.5)
|
43
|
+
fluent-query (>= 0.9.0)
|
44
|
+
fluent-query-dbi (>= 0.9.0)
|
45
|
+
fluent-query-sql (>= 0.9.0)
|
46
|
+
jeweler (>= 1.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 - 2011 Martin Kozák (martinkozak@martinkozak.net)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Fluent Query SQLite3 Driver
|
2
|
+
===========================
|
3
|
+
|
4
|
+
**Fluent Query** is cool way how to write SQL queries and general way
|
5
|
+
how to convert series of method calls to string query in an universal
|
6
|
+
and system independent manner.
|
7
|
+
|
8
|
+
This is **PostgreSQL** DBI based driver for *Fluent Query*. It can be
|
9
|
+
used with [Fluent Query][4] or [Native Query][5] only, not standalone.
|
10
|
+
|
11
|
+
|
12
|
+
Contributing
|
13
|
+
------------
|
14
|
+
|
15
|
+
1. Fork it.
|
16
|
+
2. Create a branch (`git checkout -b 20101220-my-change`).
|
17
|
+
3. Commit your changes (`git commit -am "Added something"`).
|
18
|
+
4. Push to the branch (`git push origin 20101220-my-change`).
|
19
|
+
5. Create an [Issue][2] with a link to your branch.
|
20
|
+
6. Enjoy a refreshing Diet Coke and wait.
|
21
|
+
|
22
|
+
Copyright
|
23
|
+
---------
|
24
|
+
|
25
|
+
Copyright © 2009-2011 [Martin Kozák][3]. See `LICENSE.txt` for
|
26
|
+
further details.
|
27
|
+
|
28
|
+
[2]: http://github.com/martinkozak/fluent-query-sqlite3/issues
|
29
|
+
[3]: http://www.martinkozak.net/
|
30
|
+
[4]: http://github.com/martinkozak/fluent-query
|
31
|
+
[5]: http://github.com/martinkozak/native-query
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'rake'
|
14
|
+
require 'jeweler'
|
15
|
+
|
16
|
+
Jeweler::Tasks.new do |gem|
|
17
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
18
|
+
gem.name = "fluent-query-sqlite3"
|
19
|
+
gem.homepage = "http://github.com/martinkozak/fluent-query-sqlite3"
|
20
|
+
gem.license = "MIT"
|
21
|
+
gem.summary = 'SQlite3 support for the Fluent Query. Fluent Query is cool way how to write SQL queries in Ruby.'
|
22
|
+
gem.email = "martinkozak@martinkozak.net"
|
23
|
+
gem.authors = ["Martin Kozák"]
|
24
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
25
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
26
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
27
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
28
|
+
end
|
29
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.0
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "fluent-query/drivers/dbi"
|
3
|
+
require "fluent-query/drivers/exception"
|
4
|
+
|
5
|
+
module FluentQuery
|
6
|
+
module Drivers
|
7
|
+
|
8
|
+
##
|
9
|
+
# SQLite3 database driver.
|
10
|
+
#
|
11
|
+
|
12
|
+
class SQLite3 < FluentQuery::Drivers::DBI
|
13
|
+
|
14
|
+
##
|
15
|
+
# Known tokens index.
|
16
|
+
# (internal cache)
|
17
|
+
#
|
18
|
+
|
19
|
+
@@__known_tokens = Hash::new do |hash, key|
|
20
|
+
hash[key] = { }
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# Indicates token is known.
|
25
|
+
#
|
26
|
+
|
27
|
+
public
|
28
|
+
def known_token?(group, token_name)
|
29
|
+
super(group, token_name, @@__known_tokens)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
##### EXECUTING
|
34
|
+
|
35
|
+
##
|
36
|
+
# Returns the DBI driver name.
|
37
|
+
# @return [String] driver name
|
38
|
+
#
|
39
|
+
|
40
|
+
public
|
41
|
+
def driver_name
|
42
|
+
"SQLite3"
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Opens the connection.
|
47
|
+
#
|
48
|
+
# It's lazy, so it will open connection before first request through
|
49
|
+
# {@link native_connection()} method.
|
50
|
+
#
|
51
|
+
|
52
|
+
public
|
53
|
+
def open_connection(settings)
|
54
|
+
if not settings[:file]
|
55
|
+
raise FluentQuery::Drivers::Exception::new("Database file name is required for connection.")
|
56
|
+
end
|
57
|
+
|
58
|
+
super(settings)
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Builds connection string.
|
63
|
+
# @return [String] connection string
|
64
|
+
#
|
65
|
+
|
66
|
+
public
|
67
|
+
def connection_string
|
68
|
+
if @_nconnection_settings.nil?
|
69
|
+
raise FluentQuery::Drivers::Exception::new('Connection settings hasn\'t been assigned yet.')
|
70
|
+
end
|
71
|
+
|
72
|
+
# Gets settings
|
73
|
+
file = @_nconnection_settings[:file]
|
74
|
+
|
75
|
+
# Builds connection string and other parameters
|
76
|
+
connection_string = "DBI:SQLite3:" << file.to_s
|
77
|
+
|
78
|
+
# Returns
|
79
|
+
return connection_string
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Returns authentification settings.
|
84
|
+
# @return [Array] with username and password
|
85
|
+
#
|
86
|
+
|
87
|
+
public
|
88
|
+
def authentification
|
89
|
+
@_nconnection_settings.take_values(:username, :password)
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-query-sqlite3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.9.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- "Martin Koz\xC3\xA1k"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-07-18 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: fluent-query-dbi
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: fluent-query-sql
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: fluent-query
|
39
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.9.0
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: dbd-sqlite3
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.2.5
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: bundler
|
61
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 1.0.13
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *id005
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: jeweler
|
72
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.6.0
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *id006
|
81
|
+
description:
|
82
|
+
email: martinkozak@martinkozak.net
|
83
|
+
executables: []
|
84
|
+
|
85
|
+
extensions: []
|
86
|
+
|
87
|
+
extra_rdoc_files:
|
88
|
+
- LICENSE.txt
|
89
|
+
- README.md
|
90
|
+
files:
|
91
|
+
- .document
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- VERSION
|
98
|
+
- lib/fluent-query/drivers/sqlite3.rb
|
99
|
+
- lib/fluent-query/sqlite3.rb
|
100
|
+
homepage: http://github.com/martinkozak/fluent-query-sqlite3
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: -690694131132350629
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
requirements: []
|
124
|
+
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 1.8.5
|
127
|
+
signing_key:
|
128
|
+
specification_version: 3
|
129
|
+
summary: SQlite3 support for the Fluent Query. Fluent Query is cool way how to write SQL queries in Ruby.
|
130
|
+
test_files: []
|
131
|
+
|