libsql2 0.1.4 → 0.1.5
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/Cargo.lock +1 -1
- data/README.md +14 -0
- data/ext/libsql2/Cargo.toml +1 -1
- data/ext/libsql2/src/connection.rs +14 -2
- data/lib/libsql/version.rb +1 -1
- 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: c0781bc9d230dc294a8db2adabc205ef96e235eb852a98b7b60f2c485a4d53eb
|
|
4
|
+
data.tar.gz: 6052e8eda9cdefde4f171acdb23158a6b5d11f3778ca40d17f4b6726f8cdcc8a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db88ea38ab18f73e60c49f04a39bc63c25a389ab6643812995a5825318e926d6d746850efd7058ac1457350192bd3f6c4aef6d123757c4fb02ed18a9ab2f0590
|
|
7
|
+
data.tar.gz: 8096dea4e5b674fa3a33af40a810201e981eb8166c8766464054dc7fdc35219daddf37fd6f912837b8d59d67caf7a4f09c4e8f835e6e0b775c9cf07dda93e176
|
data/Cargo.lock
CHANGED
data/README.md
CHANGED
|
@@ -132,6 +132,8 @@ end
|
|
|
132
132
|
|
|
133
133
|
## Type Mapping
|
|
134
134
|
|
|
135
|
+
### Query Results (libSQL → Ruby)
|
|
136
|
+
|
|
135
137
|
| libSQL Type | Ruby Type | Notes |
|
|
136
138
|
|---|---|---|
|
|
137
139
|
| INTEGER | `Integer` | Signed 64-bit |
|
|
@@ -140,6 +142,18 @@ end
|
|
|
140
142
|
| BLOB | `Libsql::Blob` | `String` subclass with `ASCII-8BIT` encoding |
|
|
141
143
|
| NULL | `nil` | |
|
|
142
144
|
|
|
145
|
+
### Bind Parameters (Ruby → libSQL)
|
|
146
|
+
|
|
147
|
+
| Ruby Type | libSQL Type | Notes |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| `Integer` | INTEGER | |
|
|
150
|
+
| `Float` | REAL | |
|
|
151
|
+
| `true` / `false` | INTEGER (1 / 0) | SQLite convention — no native Boolean type |
|
|
152
|
+
| `String` (UTF-8 etc.) | TEXT | |
|
|
153
|
+
| `String` (ASCII-8BIT) | BLOB | Ruby convention for binary data |
|
|
154
|
+
| `Libsql::Blob` | BLOB | `String` subclass, checked before `String` |
|
|
155
|
+
| `nil` | NULL | |
|
|
156
|
+
|
|
143
157
|
## Development
|
|
144
158
|
|
|
145
159
|
Requirements: Ruby >= 3.4, Rust >= 1.74, and a C compiler.
|
data/ext/libsql2/Cargo.toml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
use std::cell::RefCell;
|
|
2
2
|
use std::sync::Arc;
|
|
3
3
|
|
|
4
|
+
use magnus::encoding::EncodingCapable;
|
|
4
5
|
use magnus::{prelude::*, Error, RArray, RModule, RString, Ruby, TryConvert, Value};
|
|
5
6
|
use tokio::runtime::Runtime;
|
|
6
7
|
|
|
@@ -197,14 +198,25 @@ pub(crate) fn ruby_array_to_params(val: &Value) -> Result<Vec<ParamValue>, Error
|
|
|
197
198
|
} else if item.is_kind_of(ruby.class_float()) {
|
|
198
199
|
let f: f64 = TryConvert::try_convert(item)?;
|
|
199
200
|
params.push(ParamValue::Real(f));
|
|
201
|
+
} else if item.is_kind_of(ruby.class_true_class()) {
|
|
202
|
+
params.push(ParamValue::Integer(1));
|
|
203
|
+
} else if item.is_kind_of(ruby.class_false_class()) {
|
|
204
|
+
params.push(ParamValue::Integer(0));
|
|
200
205
|
} else if is_blob(item) {
|
|
201
206
|
// Blob is a String subclass — must check before String
|
|
202
207
|
let rstr: RString = TryConvert::try_convert(item)?;
|
|
203
208
|
let bytes = unsafe { rstr.as_slice() }.to_vec();
|
|
204
209
|
params.push(ParamValue::Blob(bytes));
|
|
205
210
|
} else if item.is_kind_of(ruby.class_string()) {
|
|
206
|
-
let
|
|
207
|
-
|
|
211
|
+
let rstr: RString = TryConvert::try_convert(item)?;
|
|
212
|
+
if rstr.enc_get() == ruby.ascii8bit_encindex() {
|
|
213
|
+
// ASCII-8BIT String is treated as binary data
|
|
214
|
+
let bytes = unsafe { rstr.as_slice() }.to_vec();
|
|
215
|
+
params.push(ParamValue::Blob(bytes));
|
|
216
|
+
} else {
|
|
217
|
+
let s: String = TryConvert::try_convert(item)?;
|
|
218
|
+
params.push(ParamValue::Text(s));
|
|
219
|
+
}
|
|
208
220
|
} else {
|
|
209
221
|
return Err(Error::new(
|
|
210
222
|
error::libsql_error(),
|
data/lib/libsql/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: libsql2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- speria-jp
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-03-
|
|
10
|
+
date: 2026-03-18 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rb_sys
|