turso_libsql 0.1.2 → 0.2.0
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 +4 -4
- data/lib/libsql.rb +22 -0
- 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: feeae4f9f6834be45e59f04689846b0f9d35317a5b2a573337919bea85ef4aa0
|
4
|
+
data.tar.gz: c1db75ecae4084c5a0d613dd3a33c3f9ff1f309e83e0ac3f2e2ed5a8ec2dbc95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5bcd6581a6cd4df2498ec1f33f3e475837d47b9892fc773611ae80ad621effff9480113575d693df9792254ec0070c4111ab344550feb4d2eacee9be86ca84
|
7
|
+
data.tar.gz: 75228a8af12ea9a5026dd68054178793582e489e9b587e29e61d71df6ca5b18024ff08ebf8c8635e13f514ac0a281af539f1304a81db97359e514409fd4644a3
|
data/lib/libsql.rb
CHANGED
@@ -50,6 +50,7 @@ module CLibsql # :nodoc:
|
|
50
50
|
layout err: :pointer,
|
51
51
|
inner: :pointer
|
52
52
|
|
53
|
+
def info = CLibsql.libsql_connection_info(self).tap(&:verify)
|
53
54
|
def transaction = CLibsql.libsql_connection_transaction(self).tap(&:verify)
|
54
55
|
def prepare(sql) = CLibsql.libsql_connection_prepare(self, sql).tap(&:verify)
|
55
56
|
def execute_batch(sql) = CLibsql.libsql_connection_batch(self, sql).tap(&:verify)
|
@@ -109,6 +110,14 @@ module CLibsql # :nodoc:
|
|
109
110
|
def deinit = CLibsql.libsql_row_deinit(self)
|
110
111
|
end
|
111
112
|
|
113
|
+
class ConnectionInfo < FFI::Struct # :nodoc:
|
114
|
+
include Verify
|
115
|
+
|
116
|
+
layout err: :pointer,
|
117
|
+
last_inserted_id: :int64,
|
118
|
+
total_changes: :uint64
|
119
|
+
end
|
120
|
+
|
112
121
|
class DatabaseDesc < FFI::Struct # :nodoc:
|
113
122
|
layout url: :pointer,
|
114
123
|
path: :pointer,
|
@@ -209,6 +218,7 @@ module CLibsql # :nodoc:
|
|
209
218
|
attach_function :libsql_connection_transaction, [Connection.by_value], Transaction.by_value
|
210
219
|
attach_function :libsql_connection_prepare, [Connection.by_value, :string], Statement.by_value
|
211
220
|
attach_function :libsql_connection_batch, [Connection.by_value, :string], Batch.by_value
|
221
|
+
attach_function :libsql_connection_info, [Connection.by_value], ConnectionInfo.by_value
|
212
222
|
|
213
223
|
attach_function :libsql_transaction_prepare, [Transaction.by_value, :string], Statement.by_value
|
214
224
|
attach_function :libsql_transaction_commit, [Transaction.by_value], :void
|
@@ -495,6 +505,18 @@ module Libsql
|
|
495
505
|
end
|
496
506
|
end
|
497
507
|
|
508
|
+
def total_changes
|
509
|
+
raise ClosedException if closed?
|
510
|
+
|
511
|
+
@inner.info[:total_changes]
|
512
|
+
end
|
513
|
+
|
514
|
+
def last_inserted_id
|
515
|
+
raise ClosedException if closed?
|
516
|
+
|
517
|
+
@inner.info[:last_inserted_id]
|
518
|
+
end
|
519
|
+
|
498
520
|
def prepare(sql)
|
499
521
|
raise ClosedException if closed?
|
500
522
|
|