snowflake_rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/snowflake-darwin-arm64.so +0 -0
- data/ext/snowflake-linux-amd64.so +0 -0
- data/ext/snowflake-linux-arm64.so +0 -0
- data/ext/snowflake.so +0 -0
- data/lib/snowflake_rb.rb +2 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a94c064ba5cf498085fca7c2138d08b352f83b3a94a2a1f7465fb3f9de13c50
|
4
|
+
data.tar.gz: b5772f5dfa28f418a50dbdd60d579fdab0e0eb43d34c8e88e9e20d88fc9be923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51abadd71833419043c7d569c22e9a6be05191db4dcfa3a014bf2b8ccf480bb43ec6c8637e518d8def995bd9a334afb6263219cc6c5c7e0e24134d4677a32052
|
7
|
+
data.tar.gz: b1cf22485fc54d7d47f26e6a5e0980f089024325a84a8e54cad86c829e7f7978b047482112b818d6dd253c0007e3e80a888f6b73c916db3874eb09b7e36a8ef3
|
Binary file
|
Binary file
|
Binary file
|
data/ext/snowflake.so
CHANGED
Binary file
|
data/lib/snowflake_rb.rb
CHANGED
@@ -2,9 +2,6 @@ require 'ffi'
|
|
2
2
|
require 'snowflake_rb/extension'
|
3
3
|
require 'snowflake_rb/configuration'
|
4
4
|
|
5
|
-
# Note: this library is not thread safe as it caches the last error
|
6
|
-
# The call pattern expectation is to call last_error after any call which may have gotten an error. If last_error is
|
7
|
-
# `nil`, there was no error.
|
8
5
|
module Snowflake
|
9
6
|
module LibC
|
10
7
|
extend FFI::Library
|
@@ -19,7 +16,6 @@ module Snowflake
|
|
19
16
|
POINTER_SIZE = FFI.type_size(:pointer)
|
20
17
|
|
21
18
|
ffi_lib(File.expand_path(SnowflakeRB::Extension.env_specific_extension_path, __dir__))
|
22
|
-
attach_function(:last_error, 'LastError', [], :strptr)
|
23
19
|
# ugh, `port` in gosnowflake is just :int; however, ruby - ffi -> go is passing 32bit int if I just decl :int.
|
24
20
|
attach_function(:connect, 'Connect', %i[string string string string string string string int64], :pointer)
|
25
21
|
attach_function(:close, 'Close', [:pointer], :void)
|
@@ -33,13 +29,6 @@ module Snowflake
|
|
33
29
|
module Client
|
34
30
|
module_function
|
35
31
|
|
36
|
-
# @return String last error or nil. May be end of file which is not really an error
|
37
|
-
def last_error
|
38
|
-
error, cptr = ::Snowflake::Binding.last_error
|
39
|
-
LibC.free(cptr) if error
|
40
|
-
error
|
41
|
-
end
|
42
|
-
|
43
32
|
# @param account[String] should include everything in the db url ahead of 'snowflakecomputing.com'
|
44
33
|
# @param port[Integer]
|
45
34
|
# @return query_object[Pointer] a pointer to use for subsequent calls not inspectable nor viewable by Ruby
|
@@ -88,12 +77,12 @@ module Snowflake
|
|
88
77
|
return to_enum(__method__, db_pointer, sql) unless block_given?
|
89
78
|
|
90
79
|
query_pointer = fetch(db_pointer, sql)
|
91
|
-
return
|
80
|
+
return 'query_pointer is missing' if query_pointer.nil? || query_pointer == FFI::Pointer::NULL
|
92
81
|
|
93
82
|
field_count ||= column_count(query_pointer)
|
94
83
|
loop do
|
95
84
|
row = get_next_row(query_pointer, field_count)
|
96
|
-
return
|
85
|
+
return 'row not present' unless row
|
97
86
|
|
98
87
|
yield row
|
99
88
|
end
|
@@ -103,7 +92,6 @@ module Snowflake
|
|
103
92
|
# @param db_pointer[Pointer] the pointer which `connect` returned.
|
104
93
|
# @param query[String] a select query to run.
|
105
94
|
# @return query_object[Pointer] a pointer to use for subsequent calls not inspectable nor viewable by Ruby; however,
|
106
|
-
# if it's `nil`, check `last_error`
|
107
95
|
def fetch(db_pointer, query)
|
108
96
|
::Snowflake::Binding.fetch(db_pointer, query)
|
109
97
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snowflake_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Cheng
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ffi
|