recordx_sqlite 0.2.4 → 0.2.5
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/recordx_sqlite.rb +13 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 608b01a6d789ee7139213da5a65e9bd1160de9f5
|
4
|
+
data.tar.gz: a58cf47dce501b6cac28b030704832d339f3c867
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b29579a30c0666b295b0c3de86331a4fc5b4f576ead42ac103c516976d565d13109c833110a32d743a528b8cc772844c427bfdc96e819a002ab916794c26b19f
|
7
|
+
data.tar.gz: 4209e323bfe6d09b5f86b0ae09bcec5f1fbdd0ed7f823d4f77a95db7732919487af23775fd333889db21c1a14b6ebe379f38a361b544ac34092f63537dd30e0e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/recordx_sqlite.rb
CHANGED
@@ -53,7 +53,7 @@ class RecordxSqlite
|
|
53
53
|
|
54
54
|
@db.execute(sql, values)
|
55
55
|
|
56
|
-
|
56
|
+
:create
|
57
57
|
end
|
58
58
|
|
59
59
|
def delete(id)
|
@@ -70,17 +70,26 @@ class RecordxSqlite
|
|
70
70
|
@a.find {|x| x.method(@primary_key).call == id}
|
71
71
|
|
72
72
|
end
|
73
|
+
|
74
|
+
# returns the 1st n rows
|
75
|
+
#
|
76
|
+
def first(n=1)
|
77
|
+
query(@sql + ' LIMIT ' + n.to_s, cache: false)
|
78
|
+
end
|
73
79
|
|
74
|
-
def query(sql=@sql)
|
80
|
+
def query(sql=@sql, cache: true)
|
75
81
|
|
76
|
-
@sql = sql
|
77
82
|
rs = @db.query sql
|
78
83
|
|
79
|
-
|
84
|
+
a = rs.map do |h|
|
80
85
|
h2 = h.inject({}) {|r, x| k, v = x; r.merge(k.to_sym => v)}
|
81
86
|
RecordX.new(h2, self, h2[@primary_key])
|
82
87
|
end
|
83
88
|
|
89
|
+
@a = a if cache
|
90
|
+
|
91
|
+
return a
|
92
|
+
|
84
93
|
end
|
85
94
|
|
86
95
|
def refresh()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recordx_sqlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
pewreBQ0QCPuPbV1FPlyX5N5qsGIMHFIYqUlaykOA8156Y6fbIbqQsLwxaSr8WkD
|
32
32
|
eojajR/fTTvliw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-07-
|
34
|
+
date: 2017-07-02 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sqlite3
|
metadata.gz.sig
CHANGED
Binary file
|