nssql 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -1
- data/lib/nssql.rb +5 -4
- data/lib/nssql/settings.rb +2 -0
- data/lib/nssql/table.rb +10 -4
- data/lib/nssql/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29a14e303af8a7a3adf5bd10c115095f2690c1dde7d7b9bca930f669e3b279fb
|
4
|
+
data.tar.gz: fbd6d7e0032ed00f4a12dc6bc3032aea5b0b135935b703c64de14a44fda0bfe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f112c9987540c853e48ff1fc3f41c2c9fe1f281675eec16d27e9366ee8c75fb3dd1886df23240ef968bccdf100d93cac8bc629f99df2b169776fb9cfcadfbff
|
7
|
+
data.tar.gz: b2baa0aaf4a14a71bad05f8fe50ac1a89e86b0bf46e38b23dd3d9a3219032d11097737932679ebd49d2924fd58d75131e485a89d4538593a0ccc60127cda0a52
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# NSSQL
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/nssql.svg)](https://badge.fury.io/rb/nssql)
|
3
4
|
[![Build Status](https://travis-ci.org/apoex/nssql.svg?branch=master)](https://travis-ci.org/apoex/nssql)
|
4
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/0bc97f0e7fef36bcf922/maintainability)](https://codeclimate.com/github/apoex/nssql/maintainability)
|
5
6
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/0bc97f0e7fef36bcf922/test_coverage)](https://codeclimate.com/github/apoex/nssql/test_coverage)
|
@@ -45,7 +46,7 @@ class TestTable < NSSQL::Table
|
|
45
46
|
end
|
46
47
|
```
|
47
48
|
|
48
|
-
###
|
49
|
+
### Select columns
|
49
50
|
|
50
51
|
`TestTable.select_columns_query` will generate:
|
51
52
|
|
data/lib/nssql.rb
CHANGED
@@ -35,11 +35,12 @@ module NSSQL
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def execute(query)
|
38
|
-
netsuite_connection.prepare(query).execute
|
39
|
-
|
38
|
+
statement = netsuite_connection.prepare(query).execute
|
39
|
+
result = yield statement
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
statement.drop
|
42
|
+
|
43
|
+
result
|
43
44
|
end
|
44
45
|
|
45
46
|
def system_call(command)
|
data/lib/nssql/settings.rb
CHANGED
data/lib/nssql/table.rb
CHANGED
@@ -10,24 +10,30 @@ module NSSQL
|
|
10
10
|
|
11
11
|
<<~SQL
|
12
12
|
SELECT
|
13
|
-
#{
|
13
|
+
#{columns.join(',')}
|
14
14
|
FROM
|
15
|
-
#{
|
15
|
+
#{table_name}
|
16
16
|
#{where_statement if where}
|
17
17
|
ORDER BY
|
18
|
-
#{
|
18
|
+
#{primary_keys.first}
|
19
19
|
SQL
|
20
20
|
end
|
21
21
|
|
22
|
-
def table_name(table_name)
|
22
|
+
def table_name(table_name = nil)
|
23
|
+
return @table_name if table_name.nil?
|
24
|
+
|
23
25
|
@table_name = table_name
|
24
26
|
end
|
25
27
|
|
26
28
|
def primary_keys(*primary_keys)
|
29
|
+
return @primary_keys if primary_keys.empty?
|
30
|
+
|
27
31
|
@primary_keys = primary_keys
|
28
32
|
end
|
29
33
|
|
30
34
|
def columns(*columns)
|
35
|
+
return @columns if columns.empty?
|
36
|
+
|
31
37
|
@columns = columns
|
32
38
|
end
|
33
39
|
end
|
data/lib/nssql/version.rb
CHANGED