stoolap 0.4.0 → 0.4.2

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: 4759db159d3f737aa354462f4a277c365f96a3f53fe52c986a1b615d177bcd4b
4
- data.tar.gz: cd47c731deaa29d7f447eca2e536de20e1570ff6ca590af188e16ede156c0742
3
+ metadata.gz: c029e1f0c8d3021041d3e3fb24ba42f11a38d5a673a52ee87e1a6b90f359b196
4
+ data.tar.gz: 027a534cff5ae108d457887eb97639383e206833c60428a8cc55733ae24916aa
5
5
  SHA512:
6
- metadata.gz: d4661500c977868a763bc6fc1b4f4b4f9f1a232ed52022dff1bc05bf2fdf4c22d0535d8eb778562005fc31a2fa144e001e057a670d4a92f28346b50ac981b3ea
7
- data.tar.gz: 724605385566e30400dcf2f4a9535ef23aaeaefe098c898892c9e7c9732c2214bc66eb6d1fbb331340e074264ddee6edb6391a7b5ff3fe31455d7a86615f6936
6
+ metadata.gz: 54b3d7c5ef1665a0e9d5dc7ffbd26b994f9354fb97b6db85803d5449fef1d4df0bafb603c4e2899828846a8416becd1ecbc56889e28ab16a812fe6ea9d2fd79b
7
+ data.tar.gz: 7ac8dea95e69f855b3aa6527df94a08ca28d233c754450debf59298ef4e5fe671b7a0033996c5229ce58281ea9ce839d8c9e4fc21fcaf0f0f9b9cc53427fb68f
data/Cargo.lock CHANGED
@@ -1,6 +1,6 @@
1
1
  # This file is automatically @generated by Cargo.
2
2
  # It is not intended for manual editing.
3
- version = 3
3
+ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "ahash"
@@ -393,6 +393,27 @@ dependencies = [
393
393
  "typenum",
394
394
  ]
395
395
 
396
+ [[package]]
397
+ name = "csv"
398
+ version = "1.4.0"
399
+ source = "registry+https://github.com/rust-lang/crates.io-index"
400
+ checksum = "52cd9d68cf7efc6ddfaaee42e7288d3a99d613d4b50f76ce9827ae0c6e14f938"
401
+ dependencies = [
402
+ "csv-core",
403
+ "itoa",
404
+ "ryu",
405
+ "serde_core",
406
+ ]
407
+
408
+ [[package]]
409
+ name = "csv-core"
410
+ version = "0.1.13"
411
+ source = "registry+https://github.com/rust-lang/crates.io-index"
412
+ checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782"
413
+ dependencies = [
414
+ "memchr",
415
+ ]
416
+
396
417
  [[package]]
397
418
  name = "dashmap"
398
419
  version = "6.1.0"
@@ -569,6 +590,9 @@ name = "hashbrown"
569
590
  version = "0.17.0"
570
591
  source = "registry+https://github.com/rust-lang/crates.io-index"
571
592
  checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
593
+ dependencies = [
594
+ "foldhash",
595
+ ]
572
596
 
573
597
  [[package]]
574
598
  name = "heck"
@@ -710,11 +734,11 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
710
734
 
711
735
  [[package]]
712
736
  name = "lru"
713
- version = "0.16.3"
737
+ version = "0.18.5"
714
738
  source = "registry+https://github.com/rust-lang/crates.io-index"
715
- checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593"
739
+ checksum = "ef9ac18847474e638e3702b76c65d4eb93428471a74778ef0f1be711717f89b5"
716
740
  dependencies = [
717
- "hashbrown 0.16.1",
741
+ "hashbrown 0.17.0",
718
742
  ]
719
743
 
720
744
  [[package]]
@@ -1125,6 +1149,12 @@ dependencies = [
1125
1149
  "windows-sys 0.60.2",
1126
1150
  ]
1127
1151
 
1152
+ [[package]]
1153
+ name = "ryu"
1154
+ version = "1.0.23"
1155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1156
+ checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
1157
+
1128
1158
  [[package]]
1129
1159
  name = "scopeguard"
1130
1160
  version = "1.2.0"
@@ -1231,18 +1261,18 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
1231
1261
 
1232
1262
  [[package]]
1233
1263
  name = "stoolap"
1234
- version = "0.4.0"
1264
+ version = "0.4.2"
1235
1265
  dependencies = [
1236
1266
  "chrono",
1237
1267
  "magnus",
1238
- "stoolap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1268
+ "stoolap 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
1239
1269
  ]
1240
1270
 
1241
1271
  [[package]]
1242
1272
  name = "stoolap"
1243
- version = "0.4.0"
1273
+ version = "0.4.2"
1244
1274
  source = "registry+https://github.com/rust-lang/crates.io-index"
1245
- checksum = "420d8bd65519e56f55a9f13a891a373b1cda74ebc49a65a35dc4f2efe4441b40"
1275
+ checksum = "88932817e3bb9551486e091b0c6400323086409cca8c35a37c3a68afe089e083"
1246
1276
  dependencies = [
1247
1277
  "ahash",
1248
1278
  "anyhow",
@@ -1252,6 +1282,7 @@ dependencies = [
1252
1282
  "comfy-table",
1253
1283
  "crc32fast",
1254
1284
  "crossbeam",
1285
+ "csv",
1255
1286
  "dashmap",
1256
1287
  "dirs",
1257
1288
  "getrandom 0.2.17",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "stoolap"
3
- version = "0.4.0"
3
+ version = "0.4.2"
4
4
  edition = "2021"
5
5
  authors = ["Stoolap Contributors"]
6
6
  license = "Apache-2.0"
@@ -14,7 +14,7 @@ name = "stoolap"
14
14
  crate-type = ["cdylib"]
15
15
 
16
16
  [dependencies]
17
- stoolap = "0.4.0"
17
+ stoolap = "0.4.2"
18
18
  magnus = "0.8"
19
19
  chrono = "0.4"
20
20
 
@@ -72,10 +72,6 @@ impl PreparedStatement {
72
72
  &self.plan
73
73
  }
74
74
 
75
- pub(crate) fn sql_text(&self) -> &str {
76
- &self.sql_text
77
- }
78
-
79
75
  /// Return the cached column-key array, creating it from `rows.columns()`
80
76
  /// on first call. The returned `RArray` is rooted through this struct's
81
77
  /// `mark` callback and is safe to hold across subsequent Ruby calls.
@@ -139,58 +139,60 @@ impl Transaction {
139
139
  }
140
140
 
141
141
  /// Execute a prepared statement within the transaction. Returns rows affected.
142
- ///
143
- /// Note: named parameters fall back to `tx.execute_named` which reparses
144
- /// the SQL, because stoolap's `Transaction::execute_prepared` only
145
- /// accepts positional `Params` and the AST encodes `:name` references
146
- /// that cannot be resolved through positional indexing. Use positional
147
- /// `$1, $2` params for the full prepared fast path.
148
142
  pub fn execute_prepared(&self, args: &[Value]) -> Result<i64, Error> {
149
- let (plan, sql, params) = parse_stmt_args(args)?;
143
+ let (plan, params) = parse_stmt_args(args)?;
150
144
  let bind = parse_params(params)?;
151
145
  self.with_tx(|tx| match bind {
152
146
  BindParams::Positional(p) => tx
153
147
  .execute_prepared(plan.statement.as_ref(), p)
154
148
  .map_err(to_magnus),
155
- BindParams::Named(n) => tx.execute_named(&sql, n).map_err(to_magnus),
149
+ BindParams::Named(n) => tx
150
+ .execute_prepared_named(plan.statement.as_ref(), n)
151
+ .map_err(to_magnus),
156
152
  })
157
153
  }
158
154
 
159
155
  /// Query rows using a prepared statement. Returns Array of Hashes.
160
156
  pub fn query_prepared(&self, args: &[Value]) -> Result<RArray, Error> {
161
- let (plan, sql, params) = parse_stmt_args(args)?;
157
+ let (plan, params) = parse_stmt_args(args)?;
162
158
  let bind = parse_params(params)?;
163
159
  let rows = self.with_tx(|tx| match bind {
164
160
  BindParams::Positional(p) => tx
165
161
  .query_prepared(plan.statement.as_ref(), p)
166
162
  .map_err(to_magnus),
167
- BindParams::Named(n) => tx.query_named(&sql, n).map_err(to_magnus),
163
+ BindParams::Named(n) => tx
164
+ .query_prepared_named(plan.statement.as_ref(), n)
165
+ .map_err(to_magnus),
168
166
  })?;
169
167
  rows_to_hashes(rows)
170
168
  }
171
169
 
172
170
  /// Query a single row using a prepared statement. Returns Hash or nil.
173
171
  pub fn query_one_prepared(&self, args: &[Value]) -> Result<Value, Error> {
174
- let (plan, sql, params) = parse_stmt_args(args)?;
172
+ let (plan, params) = parse_stmt_args(args)?;
175
173
  let bind = parse_params(params)?;
176
174
  let rows = self.with_tx(|tx| match bind {
177
175
  BindParams::Positional(p) => tx
178
176
  .query_prepared(plan.statement.as_ref(), p)
179
177
  .map_err(to_magnus),
180
- BindParams::Named(n) => tx.query_named(&sql, n).map_err(to_magnus),
178
+ BindParams::Named(n) => tx
179
+ .query_prepared_named(plan.statement.as_ref(), n)
180
+ .map_err(to_magnus),
181
181
  })?;
182
182
  first_row_to_hash(rows)
183
183
  }
184
184
 
185
185
  /// Query rows using a prepared statement in raw format.
186
186
  pub fn query_raw_prepared(&self, args: &[Value]) -> Result<RHash, Error> {
187
- let (plan, sql, params) = parse_stmt_args(args)?;
187
+ let (plan, params) = parse_stmt_args(args)?;
188
188
  let bind = parse_params(params)?;
189
189
  let rows = self.with_tx(|tx| match bind {
190
190
  BindParams::Positional(p) => tx
191
191
  .query_prepared(plan.statement.as_ref(), p)
192
192
  .map_err(to_magnus),
193
- BindParams::Named(n) => tx.query_named(&sql, n).map_err(to_magnus),
193
+ BindParams::Named(n) => tx
194
+ .query_prepared_named(plan.statement.as_ref(), n)
195
+ .map_err(to_magnus),
194
196
  })?;
195
197
  rows_to_raw(rows)
196
198
  }
@@ -234,13 +236,9 @@ fn parse_sql_args(args: &[Value]) -> Result<(String, Option<Value>), Error> {
234
236
  Ok((scanned.required.0, scanned.optional.0))
235
237
  }
236
238
 
237
- fn parse_stmt_args(args: &[Value]) -> Result<(CachedPlanRef, String, Option<Value>), Error> {
239
+ fn parse_stmt_args(args: &[Value]) -> Result<(CachedPlanRef, Option<Value>), Error> {
238
240
  use magnus::TryConvert;
239
241
  let scanned = scan_args::<(Value,), (Option<Value>,), (), (), (), ()>(args)?;
240
242
  let stmt: &PreparedStatement = TryConvert::try_convert(scanned.required.0)?;
241
- Ok((
242
- stmt.plan().clone(),
243
- stmt.sql_text().to_string(),
244
- scanned.optional.0,
245
- ))
243
+ Ok((stmt.plan().clone(), scanned.optional.0))
246
244
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stoolap
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stoolap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stoolap Contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-10 00:00:00.000000000 Z
11
+ date: 2026-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys