turso_libsql 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c771d247e215a74a9fdedcc98bf1a72988acbcc6eadf81430f1fbc16224a93b
|
4
|
+
data.tar.gz: bb1095381153f88cdae29edb953be1da8120b8e29d063f27b0a87a9183e83430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea3f93e03e44a62b8181f99f5aedd41f6d2f3973006a9f8f9ef3a06c56f160d4d2fa5fbab30e08fc13fdb347f7fe8b3c44c9967ba2164c38f9faebf2e2037d46
|
7
|
+
data.tar.gz: b9f6f44c6f105669f0bc47c4638b6c0eed869b6811d836246df6257ac3da1c20d804ea54471f6c11f2a88555a4c58902d4e5765398ef0e6eb55b3db5b0c75baf
|
Binary file
|
Binary file
|
Binary file
|
data/lib/libsql.rb
CHANGED
@@ -6,6 +6,7 @@ module CLibsql # :nodoc:
|
|
6
6
|
file =
|
7
7
|
case RUBY_PLATFORM
|
8
8
|
in /arm64-darwin/ then 'aarch64-apple-darwin/liblibsql.dylib'
|
9
|
+
in /x86_84-darwin/ then 'x86_64-apple-darwin/liblibsql.dylib'
|
9
10
|
in /x86_64-linux/ then 'x86_64-unknown-linux-gnu/liblibsql.so'
|
10
11
|
in /aarch64-linux/ then 'aarch64-unknown-linux-gnu/liblibsql.so'
|
11
12
|
in /arm64-linux/ then 'aarch64-unknown-linux-gnu/liblibsql.so'
|
@@ -50,6 +51,7 @@ module CLibsql # :nodoc:
|
|
50
51
|
layout err: :pointer,
|
51
52
|
inner: :pointer
|
52
53
|
|
54
|
+
def info = CLibsql.libsql_connection_info(self).tap(&:verify)
|
53
55
|
def transaction = CLibsql.libsql_connection_transaction(self).tap(&:verify)
|
54
56
|
def prepare(sql) = CLibsql.libsql_connection_prepare(self, sql).tap(&:verify)
|
55
57
|
def execute_batch(sql) = CLibsql.libsql_connection_batch(self, sql).tap(&:verify)
|
@@ -93,7 +95,7 @@ module CLibsql # :nodoc:
|
|
93
95
|
def next = CLibsql.libsql_rows_next(self).tap(&:verify)
|
94
96
|
def deinit = CLibsql.libsql_rows_deinit(self)
|
95
97
|
def name_at(index) = CLibsql.libsql_rows_column_name(self, index)
|
96
|
-
def
|
98
|
+
def column_count = CLibsql.libsql_rows_column_count(self)
|
97
99
|
end
|
98
100
|
|
99
101
|
class Row < FFI::Struct # :nodoc:
|
@@ -109,6 +111,14 @@ module CLibsql # :nodoc:
|
|
109
111
|
def deinit = CLibsql.libsql_row_deinit(self)
|
110
112
|
end
|
111
113
|
|
114
|
+
class ConnectionInfo < FFI::Struct # :nodoc:
|
115
|
+
include Verify
|
116
|
+
|
117
|
+
layout err: :pointer,
|
118
|
+
last_inserted_id: :int64,
|
119
|
+
total_changes: :uint64
|
120
|
+
end
|
121
|
+
|
112
122
|
class DatabaseDesc < FFI::Struct # :nodoc:
|
113
123
|
layout url: :pointer,
|
114
124
|
path: :pointer,
|
@@ -117,7 +127,9 @@ module CLibsql # :nodoc:
|
|
117
127
|
sync_interval: :uint64,
|
118
128
|
cypher: Cypher,
|
119
129
|
disable_read_your_writes: :bool,
|
120
|
-
webpki: :bool
|
130
|
+
webpki: :bool,
|
131
|
+
synced: :bool,
|
132
|
+
disable_safety_assert: :bool
|
121
133
|
end
|
122
134
|
|
123
135
|
class Bind < FFI::Struct # :nodoc:
|
@@ -209,6 +221,7 @@ module CLibsql # :nodoc:
|
|
209
221
|
attach_function :libsql_connection_transaction, [Connection.by_value], Transaction.by_value
|
210
222
|
attach_function :libsql_connection_prepare, [Connection.by_value, :string], Statement.by_value
|
211
223
|
attach_function :libsql_connection_batch, [Connection.by_value, :string], Batch.by_value
|
224
|
+
attach_function :libsql_connection_info, [Connection.by_value], ConnectionInfo.by_value
|
212
225
|
|
213
226
|
attach_function :libsql_transaction_prepare, [Transaction.by_value, :string], Statement.by_value
|
214
227
|
attach_function :libsql_transaction_commit, [Transaction.by_value], :void
|
@@ -223,7 +236,7 @@ module CLibsql # :nodoc:
|
|
223
236
|
attach_function :libsql_statement_reset, [Statement.by_value], :void
|
224
237
|
|
225
238
|
attach_function :libsql_rows_next, [Rows.by_value], Row.by_value
|
226
|
-
attach_function :
|
239
|
+
attach_function :libsql_rows_column_count, [Rows.by_value], :uint32
|
227
240
|
attach_function :libsql_rows_column_name, [Rows.by_value, :uint32], Slice.by_value
|
228
241
|
|
229
242
|
attach_function :libsql_row_empty, [Row.by_value], :bool
|
@@ -321,7 +334,7 @@ module Libsql
|
|
321
334
|
def column_count
|
322
335
|
raise ClosedException if closed?
|
323
336
|
|
324
|
-
@inner.
|
337
|
+
@inner.column_count
|
325
338
|
end
|
326
339
|
|
327
340
|
def columns
|
@@ -495,6 +508,18 @@ module Libsql
|
|
495
508
|
end
|
496
509
|
end
|
497
510
|
|
511
|
+
def total_changes
|
512
|
+
raise ClosedException if closed?
|
513
|
+
|
514
|
+
@inner.info[:total_changes]
|
515
|
+
end
|
516
|
+
|
517
|
+
def last_inserted_id
|
518
|
+
raise ClosedException if closed?
|
519
|
+
|
520
|
+
@inner.info[:last_inserted_id]
|
521
|
+
end
|
522
|
+
|
498
523
|
def prepare(sql)
|
499
524
|
raise ClosedException if closed?
|
500
525
|
|
@@ -527,8 +552,8 @@ module Libsql
|
|
527
552
|
desc[sym] = FFI::MemoryPointer.from_string options[sym] unless options[sym].nil?
|
528
553
|
end
|
529
554
|
|
530
|
-
desc[:sync_interval] = options[:sync_interval]
|
531
|
-
desc[:disable_read_your_writes] = !options[:read_your_writes]
|
555
|
+
desc[:sync_interval] = options[:sync_interval] || 0
|
556
|
+
desc[:disable_read_your_writes] = !options[:read_your_writes] || true
|
532
557
|
|
533
558
|
@inner = CLibsql::Database.init desc
|
534
559
|
|