swiss_db 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/swiss_db/cursor.rb +1 -1
- data/lib/swiss_db/data_store.rb +5 -4
- data/lib/swiss_db/swiss_model.rb +0 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2313d48751d8db38ddeb8d6b35b77505b81f0e19
|
4
|
+
data.tar.gz: 8b913b2cd08f1cbd529409c30babbc2d2e5f298d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 531bd255a92c5b20754354c5ddc8982bbfd717af76f0a905b6eefd79e4b78064793ca5ff25746ea422dd73371aa1d7c4f71edcbdc3e2e48a888d0318da5f4833
|
7
|
+
data.tar.gz: dcde38e09562c53dea3404e1f5db68d967232910f6cf8e67975fedc4b3116242a2d224fe83c22ee1b585fc4be81be4aa34ffe249ffaa73cf3cf91a7a3f6deab4
|
data/lib/swiss_db/cursor.rb
CHANGED
@@ -69,7 +69,7 @@ class Cursor # < Array
|
|
69
69
|
if args.count == 0
|
70
70
|
index = cursor.getColumnIndex(str)
|
71
71
|
type = cursor.getType(index)
|
72
|
-
puts "getting field #{str} at index #{index} of type #{type}"
|
72
|
+
# puts "getting field #{str} at index #{index} of type #{type}"
|
73
73
|
if type == FIELD_TYPE_STRING
|
74
74
|
cursor.getString(index)
|
75
75
|
elsif type == FIELD_TYPE_INTEGER
|
data/lib/swiss_db/data_store.rb
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
#create
|
38
38
|
def onCreate(db)
|
39
|
-
puts "table creation... running schema"
|
39
|
+
# puts "table creation... running schema"
|
40
40
|
# THIS RELIES ON SCHEMA CODE TO SUCCEED
|
41
41
|
# NOTE: I don't know a better way of passing the schema here
|
42
42
|
# If you do just change it. For now this works.
|
@@ -49,7 +49,7 @@
|
|
49
49
|
|
50
50
|
#insert
|
51
51
|
def insert(db=writable_db, table, hash_values)
|
52
|
-
puts "inserting data in #{table}"
|
52
|
+
# puts "inserting data in #{table}"
|
53
53
|
values = ContentValues.new(hash_values.count)
|
54
54
|
hash_values.each do |k, v|
|
55
55
|
values.put(k, v)
|
@@ -59,8 +59,9 @@
|
|
59
59
|
end
|
60
60
|
#retrieve
|
61
61
|
def select_all(db=writable_db, table, model)
|
62
|
-
|
63
|
-
|
62
|
+
sql = "select * from '#{table}'"
|
63
|
+
puts sql
|
64
|
+
cursor = db.rawQuery(sql, nil)
|
64
65
|
Cursor.new(cursor, model) # we wrap their cursor
|
65
66
|
end
|
66
67
|
|
data/lib/swiss_db/swiss_model.rb
CHANGED
@@ -85,18 +85,4 @@ class SwissModel
|
|
85
85
|
store.destroy_all(@table_name)
|
86
86
|
end
|
87
87
|
|
88
|
-
# borrowed from rails
|
89
|
-
private
|
90
|
-
|
91
|
-
def underscore(camel_cased_word)
|
92
|
-
return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/
|
93
|
-
word = camel_cased_word.to_s.gsub(/::/, '/')
|
94
|
-
word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'}#{$2.downcase}" }
|
95
|
-
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
96
|
-
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
97
|
-
word.gsub!("-", "_")
|
98
|
-
word.downcase!
|
99
|
-
word
|
100
|
-
end
|
101
|
-
|
102
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swiss_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Silverman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|