sqlite_server2018 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sqlite_server2018.rb +17 -5
- metadata +21 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8dabc2f58a7195db0527ca0b645cffd531e301fa7f4f02e869d022037d110d
|
4
|
+
data.tar.gz: 5dc2efceeef1cf9d7fd9085ad128cf5a2004f0cb85a4df14831d462ab7bbede8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4bbbb4eb7ea93f80e960400b0e9e08aea7c8be13ecf6abe0f83b42a272f34b1ef3c7545afeba314e94d228a4026fe79b867d110bfe11e368bb7f32696bdfc78
|
7
|
+
data.tar.gz: 7f629b4e21710d7f7db28e46f633af23e72b5d45316bae1e550b2425a949ede9529f43e974bb381a17b869ab063efcd308d506eeb3dfe0de98bcef5fe7865f7f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/sqlite_server2018.rb
CHANGED
@@ -4,17 +4,19 @@
|
|
4
4
|
|
5
5
|
require 'drb'
|
6
6
|
require 'sqlite3'
|
7
|
+
require 'rxfhelper'
|
7
8
|
require 'hashcache'
|
8
9
|
|
9
10
|
|
10
11
|
class SQLiteServer
|
11
12
|
include SQLite3
|
12
13
|
|
13
|
-
def initialize(cache: 5, debug: false)
|
14
|
+
def initialize(cache: 5, debug: false, filepath: '.')
|
14
15
|
|
15
16
|
@dbcache = HashCache.new(cache: cache)
|
16
17
|
@h = {}
|
17
18
|
@debug = debug
|
19
|
+
Dir.chdir filepath
|
18
20
|
|
19
21
|
end
|
20
22
|
|
@@ -31,14 +33,25 @@ class SQLiteServer
|
|
31
33
|
begin
|
32
34
|
read(dbfile).execute(*args, &blk)
|
33
35
|
rescue
|
34
|
-
($!).inspect
|
36
|
+
'SQLiteServerError: ' + ($!).inspect
|
35
37
|
end
|
36
38
|
|
37
39
|
end
|
38
40
|
|
41
|
+
def exists?(raw_dbfile)
|
42
|
+
|
43
|
+
dbfile = if raw_dbfile =~ /^sqlite:\/\// then
|
44
|
+
raw_dbfile[/^sqlite:\/\/[^\/]+\/(.*)/,1]
|
45
|
+
else
|
46
|
+
raw_dbfile
|
47
|
+
end
|
48
|
+
|
49
|
+
File.exists? dbfile
|
50
|
+
end
|
51
|
+
|
39
52
|
def load(dbfile)
|
40
53
|
read dbfile
|
41
|
-
'loaded'
|
54
|
+
'loaded ' + dbfile
|
42
55
|
end
|
43
56
|
|
44
57
|
def query(*args, &blk)
|
@@ -46,7 +59,7 @@ class SQLiteServer
|
|
46
59
|
begin
|
47
60
|
read(dbfile).query(*args, &blk)
|
48
61
|
rescue
|
49
|
-
($!).inspect
|
62
|
+
'SQLiteServerError: ' + ($!).inspect
|
50
63
|
end
|
51
64
|
|
52
65
|
end
|
@@ -75,4 +88,3 @@ class SQLiteServer2018
|
|
75
88
|
|
76
89
|
end
|
77
90
|
end
|
78
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqlite_server2018
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -57,6 +57,26 @@ dependencies:
|
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 1.3.13
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rxfhelper
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0.8'
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.8.6
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0.8'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 0.8.6
|
60
80
|
- !ruby/object:Gem::Dependency
|
61
81
|
name: hashcache
|
62
82
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|