pyturso 0.3.0rc4__tar.gz → 0.3.0rc5__tar.gz
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.
Potentially problematic release.
This version of pyturso might be problematic. Click here for more details.
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/Cargo.lock +36 -37
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/Cargo.toml +17 -17
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/PKG-INFO +1 -1
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/src/lib.rs +1 -1
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/Cargo.toml +2 -1
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/error.rs +1 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/ext/mod.rs +16 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/functions/datetime.rs +86 -32
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/aggregate_operator.rs +1301 -75
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/compiler.rs +110 -37
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/cursor.rs +1 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/operator.rs +516 -1
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/persistence.rs +14 -5
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/project_operator.rs +1 -1
- pyturso-0.3.0rc5/core/index_method/backing_btree.rs +45 -0
- pyturso-0.3.0rc5/core/index_method/mod.rs +171 -0
- pyturso-0.3.0rc5/core/index_method/toy_vector_sparse_ivf.rs +725 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/generic.rs +1 -3
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/lib.rs +160 -88
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/database/checkpoint_state_machine.rs +5 -5
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/database/mod.rs +2 -2
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/database/tests.rs +50 -50
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/mod.rs +5 -5
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/persistent_storage/logical_log.rs +3 -3
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/schema.rs +65 -31
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/btree.rs +45 -34
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/encryption.rs +13 -2
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/mod.rs +1 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/page_cache.rs +4 -6
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/pager.rs +383 -72
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/sqlite3_ondisk.rs +44 -5
- pyturso-0.3.0rc5/core/storage/subjournal.rs +88 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/wal.rs +60 -59
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/aggregation.rs +1 -1
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/collate.rs +2 -2
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/compound_select.rs +1 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/display.rs +3 -2
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/emitter.rs +29 -24
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/expr.rs +229 -29
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/fkeys.rs +71 -128
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/index.rs +242 -213
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/insert.rs +5 -4
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/main_loop.rs +94 -41
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/mod.rs +3 -17
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/constraints.rs +6 -5
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/join.rs +92 -36
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/mod.rs +19 -5
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/order_by.rs +212 -72
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/plan.rs +145 -13
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/planner.rs +70 -5
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/pragma.rs +39 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/result_row.rs +18 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/select.rs +22 -0
- pyturso-0.3.0rc5/core/translate/subquery.rs +560 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/upsert.rs +5 -2
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/values.rs +29 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/window.rs +1 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/util.rs +53 -4
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/builder.rs +51 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/execute.rs +194 -133
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/explain.rs +4 -4
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/insn.rs +2 -2
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/mod.rs +89 -20
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/sorter.rs +0 -17
- pyturso-0.3.0rc5/macros/src/atomic_enum.rs +290 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/src/lib.rs +28 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/ast/fmt.rs +25 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/ast.rs +38 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/parser.rs +89 -1
- pyturso-0.3.0rc4/core/translate/subquery.rs +0 -139
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/Cargo.toml +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/build.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/example.py +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/requirements-dev.txt +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/requirements.txt +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/src/errors.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/tests/__init__.py +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/tests/test_database.py +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/turso/__init__.py +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/bindings/python/turso/py.typed +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/assert.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/benches/benchmark.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/benches/json_benchmark.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/benches/mvcc_benchmark.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/benches/tpc_h_benchmark.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/build.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/ext/dynamic.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/ext/vtab_xconnect.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/fast_lock.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/function.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/functions/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/functions/printf.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/functions/strftime.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/dbsp.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/expr_compiler.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/filter_operator.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/input_operator.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/join_operator.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/merge_operator.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/incremental/view.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/info.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/clock.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/common.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/completions.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/io_uring.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/memory.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/unix.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/vfs.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/io/windows.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/json/cache.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/json/error.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/json/jsonb.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/json/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/json/ops.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/json/path.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/json/vtab.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/clock.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/cursor.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/mvcc/persistent_storage/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/numeric/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/numeric/nonnan.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/parameters.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/pragma.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/pseudo.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/series.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/state_machine.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/buffer_pool.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/checksum.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/database.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/slot_bitmap.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/storage/state_machines.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/time/internal.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/time/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/alter.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/analyze.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/attach.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/delete.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/group_by.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/integrity_check.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/logical.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/OPTIMIZER.md +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/access_method.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/cost.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/lift_common_subexpressions.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/optimizer/order.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/rollback.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/schema.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/transaction.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/update.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/translate/view.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/types.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/uuid.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/likeop.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vdbe/metrics.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/concat.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/convert.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/distance_cos.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/distance_l2.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/jaccard.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/serialize.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/slice.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/operations/text.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vector/vector_types.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/core/vtab.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/Cargo.toml +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/README.md +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/build.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/src/functions.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/src/lib.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/src/types.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/src/vfs_modules.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/extensions/core/src/vtabs.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/Cargo.toml +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/src/ext/agg_derive.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/src/ext/match_ignore_ascii_case.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/src/ext/mod.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/src/ext/scalars.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/src/ext/vfs_derive.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/macros/src/ext/vtab_derive.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/Cargo.toml +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/README.md +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/benches/parser_benchmark.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/ast/check.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/error.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/lexer.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/lib.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/parser/src/token.rs +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/pyproject.toml +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/turso/__init__.py +0 -0
- {pyturso-0.3.0rc4 → pyturso-0.3.0rc5}/turso/py.typed +0 -0
|
@@ -227,6 +227,12 @@ version = "1.0.98"
|
|
|
227
227
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
228
228
|
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
|
229
229
|
|
|
230
|
+
[[package]]
|
|
231
|
+
name = "arc-swap"
|
|
232
|
+
version = "1.7.1"
|
|
233
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
234
|
+
checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
|
|
235
|
+
|
|
230
236
|
[[package]]
|
|
231
237
|
name = "arrayref"
|
|
232
238
|
version = "0.3.9"
|
|
@@ -822,7 +828,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
|
|
822
828
|
|
|
823
829
|
[[package]]
|
|
824
830
|
name = "core_tester"
|
|
825
|
-
version = "0.3.0-pre.
|
|
831
|
+
version = "0.3.0-pre.5"
|
|
826
832
|
dependencies = [
|
|
827
833
|
"anyhow",
|
|
828
834
|
"assert_cmd",
|
|
@@ -2410,15 +2416,6 @@ dependencies = [
|
|
|
2410
2416
|
"serde",
|
|
2411
2417
|
]
|
|
2412
2418
|
|
|
2413
|
-
[[package]]
|
|
2414
|
-
name = "julian_day_converter"
|
|
2415
|
-
version = "0.4.5"
|
|
2416
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2417
|
-
checksum = "f2987f71b89b85c812c8484cbf0c5d7912589e77bfdc66fd3e52f760e7859f16"
|
|
2418
|
-
dependencies = [
|
|
2419
|
-
"chrono",
|
|
2420
|
-
]
|
|
2421
|
-
|
|
2422
2419
|
[[package]]
|
|
2423
2420
|
name = "kqueue"
|
|
2424
2421
|
version = "1.0.8"
|
|
@@ -2548,7 +2545,7 @@ dependencies = [
|
|
|
2548
2545
|
|
|
2549
2546
|
[[package]]
|
|
2550
2547
|
name = "limbo_completion"
|
|
2551
|
-
version = "0.3.0-pre.
|
|
2548
|
+
version = "0.3.0-pre.5"
|
|
2552
2549
|
dependencies = [
|
|
2553
2550
|
"mimalloc",
|
|
2554
2551
|
"turso_ext",
|
|
@@ -2556,7 +2553,7 @@ dependencies = [
|
|
|
2556
2553
|
|
|
2557
2554
|
[[package]]
|
|
2558
2555
|
name = "limbo_crypto"
|
|
2559
|
-
version = "0.3.0-pre.
|
|
2556
|
+
version = "0.3.0-pre.5"
|
|
2560
2557
|
dependencies = [
|
|
2561
2558
|
"blake3",
|
|
2562
2559
|
"data-encoding",
|
|
@@ -2569,7 +2566,7 @@ dependencies = [
|
|
|
2569
2566
|
|
|
2570
2567
|
[[package]]
|
|
2571
2568
|
name = "limbo_csv"
|
|
2572
|
-
version = "0.3.0-pre.
|
|
2569
|
+
version = "0.3.0-pre.5"
|
|
2573
2570
|
dependencies = [
|
|
2574
2571
|
"csv",
|
|
2575
2572
|
"mimalloc",
|
|
@@ -2579,7 +2576,7 @@ dependencies = [
|
|
|
2579
2576
|
|
|
2580
2577
|
[[package]]
|
|
2581
2578
|
name = "limbo_fuzzy"
|
|
2582
|
-
version = "0.3.0-pre.
|
|
2579
|
+
version = "0.3.0-pre.5"
|
|
2583
2580
|
dependencies = [
|
|
2584
2581
|
"mimalloc",
|
|
2585
2582
|
"turso_ext",
|
|
@@ -2587,7 +2584,7 @@ dependencies = [
|
|
|
2587
2584
|
|
|
2588
2585
|
[[package]]
|
|
2589
2586
|
name = "limbo_ipaddr"
|
|
2590
|
-
version = "0.3.0-pre.
|
|
2587
|
+
version = "0.3.0-pre.5"
|
|
2591
2588
|
dependencies = [
|
|
2592
2589
|
"ipnetwork",
|
|
2593
2590
|
"mimalloc",
|
|
@@ -2596,7 +2593,7 @@ dependencies = [
|
|
|
2596
2593
|
|
|
2597
2594
|
[[package]]
|
|
2598
2595
|
name = "limbo_percentile"
|
|
2599
|
-
version = "0.3.0-pre.
|
|
2596
|
+
version = "0.3.0-pre.5"
|
|
2600
2597
|
dependencies = [
|
|
2601
2598
|
"mimalloc",
|
|
2602
2599
|
"turso_ext",
|
|
@@ -2604,7 +2601,7 @@ dependencies = [
|
|
|
2604
2601
|
|
|
2605
2602
|
[[package]]
|
|
2606
2603
|
name = "limbo_regexp"
|
|
2607
|
-
version = "0.3.0-pre.
|
|
2604
|
+
version = "0.3.0-pre.5"
|
|
2608
2605
|
dependencies = [
|
|
2609
2606
|
"mimalloc",
|
|
2610
2607
|
"regex",
|
|
@@ -2613,7 +2610,7 @@ dependencies = [
|
|
|
2613
2610
|
|
|
2614
2611
|
[[package]]
|
|
2615
2612
|
name = "limbo_sim"
|
|
2616
|
-
version = "0.3.0-pre.
|
|
2613
|
+
version = "0.3.0-pre.5"
|
|
2617
2614
|
dependencies = [
|
|
2618
2615
|
"anyhow",
|
|
2619
2616
|
"bitflags 2.9.4",
|
|
@@ -2649,7 +2646,7 @@ dependencies = [
|
|
|
2649
2646
|
|
|
2650
2647
|
[[package]]
|
|
2651
2648
|
name = "limbo_sqlite_test_ext"
|
|
2652
|
-
version = "0.3.0-pre.
|
|
2649
|
+
version = "0.3.0-pre.5"
|
|
2653
2650
|
dependencies = [
|
|
2654
2651
|
"cc",
|
|
2655
2652
|
]
|
|
@@ -3465,7 +3462,7 @@ dependencies = [
|
|
|
3465
3462
|
|
|
3466
3463
|
[[package]]
|
|
3467
3464
|
name = "py-turso"
|
|
3468
|
-
version = "0.3.0-pre.
|
|
3465
|
+
version = "0.3.0-pre.5"
|
|
3469
3466
|
dependencies = [
|
|
3470
3467
|
"anyhow",
|
|
3471
3468
|
"pyo3",
|
|
@@ -4211,7 +4208,7 @@ checksum = "d372029cb5195f9ab4e4b9aef550787dce78b124fcaee8d82519925defcd6f0d"
|
|
|
4211
4208
|
|
|
4212
4209
|
[[package]]
|
|
4213
4210
|
name = "sql_generation"
|
|
4214
|
-
version = "0.3.0-pre.
|
|
4211
|
+
version = "0.3.0-pre.5"
|
|
4215
4212
|
dependencies = [
|
|
4216
4213
|
"anarchist-readable-name-generator-lib 0.2.0",
|
|
4217
4214
|
"anyhow",
|
|
@@ -4839,8 +4836,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
|
|
4839
4836
|
|
|
4840
4837
|
[[package]]
|
|
4841
4838
|
name = "turso"
|
|
4842
|
-
version = "0.3.0-pre.
|
|
4839
|
+
version = "0.3.0-pre.5"
|
|
4843
4840
|
dependencies = [
|
|
4841
|
+
"mimalloc",
|
|
4844
4842
|
"rand 0.9.2",
|
|
4845
4843
|
"rand_chacha 0.9.0",
|
|
4846
4844
|
"tempfile",
|
|
@@ -4853,7 +4851,7 @@ dependencies = [
|
|
|
4853
4851
|
|
|
4854
4852
|
[[package]]
|
|
4855
4853
|
name = "turso-java"
|
|
4856
|
-
version = "0.3.0-pre.
|
|
4854
|
+
version = "0.3.0-pre.5"
|
|
4857
4855
|
dependencies = [
|
|
4858
4856
|
"jni",
|
|
4859
4857
|
"thiserror 2.0.16",
|
|
@@ -4862,7 +4860,7 @@ dependencies = [
|
|
|
4862
4860
|
|
|
4863
4861
|
[[package]]
|
|
4864
4862
|
name = "turso_cli"
|
|
4865
|
-
version = "0.3.0-pre.
|
|
4863
|
+
version = "0.3.0-pre.5"
|
|
4866
4864
|
dependencies = [
|
|
4867
4865
|
"anyhow",
|
|
4868
4866
|
"cfg-if",
|
|
@@ -4898,12 +4896,13 @@ dependencies = [
|
|
|
4898
4896
|
|
|
4899
4897
|
[[package]]
|
|
4900
4898
|
name = "turso_core"
|
|
4901
|
-
version = "0.3.0-pre.
|
|
4899
|
+
version = "0.3.0-pre.5"
|
|
4902
4900
|
dependencies = [
|
|
4903
4901
|
"aegis",
|
|
4904
4902
|
"aes",
|
|
4905
4903
|
"aes-gcm",
|
|
4906
4904
|
"antithesis_sdk",
|
|
4905
|
+
"arc-swap",
|
|
4907
4906
|
"bitflags 2.9.4",
|
|
4908
4907
|
"built",
|
|
4909
4908
|
"bytemuck",
|
|
@@ -4916,7 +4915,6 @@ dependencies = [
|
|
|
4916
4915
|
"hex",
|
|
4917
4916
|
"intrusive-collections",
|
|
4918
4917
|
"io-uring",
|
|
4919
|
-
"julian_day_converter",
|
|
4920
4918
|
"libc",
|
|
4921
4919
|
"libloading",
|
|
4922
4920
|
"libm",
|
|
@@ -4937,6 +4935,7 @@ dependencies = [
|
|
|
4937
4935
|
"roaring",
|
|
4938
4936
|
"rstest",
|
|
4939
4937
|
"rusqlite",
|
|
4938
|
+
"rustc-hash",
|
|
4940
4939
|
"rustix 1.0.7",
|
|
4941
4940
|
"ryu",
|
|
4942
4941
|
"serde",
|
|
@@ -4958,7 +4957,7 @@ dependencies = [
|
|
|
4958
4957
|
|
|
4959
4958
|
[[package]]
|
|
4960
4959
|
name = "turso_dart"
|
|
4961
|
-
version = "0.3.0-pre.
|
|
4960
|
+
version = "0.3.0-pre.5"
|
|
4962
4961
|
dependencies = [
|
|
4963
4962
|
"flutter_rust_bridge",
|
|
4964
4963
|
"turso_core",
|
|
@@ -4966,7 +4965,7 @@ dependencies = [
|
|
|
4966
4965
|
|
|
4967
4966
|
[[package]]
|
|
4968
4967
|
name = "turso_ext"
|
|
4969
|
-
version = "0.3.0-pre.
|
|
4968
|
+
version = "0.3.0-pre.5"
|
|
4970
4969
|
dependencies = [
|
|
4971
4970
|
"chrono",
|
|
4972
4971
|
"getrandom 0.3.2",
|
|
@@ -4975,7 +4974,7 @@ dependencies = [
|
|
|
4975
4974
|
|
|
4976
4975
|
[[package]]
|
|
4977
4976
|
name = "turso_ext_tests"
|
|
4978
|
-
version = "0.3.0-pre.
|
|
4977
|
+
version = "0.3.0-pre.5"
|
|
4979
4978
|
dependencies = [
|
|
4980
4979
|
"env_logger 0.11.7",
|
|
4981
4980
|
"lazy_static",
|
|
@@ -4986,7 +4985,7 @@ dependencies = [
|
|
|
4986
4985
|
|
|
4987
4986
|
[[package]]
|
|
4988
4987
|
name = "turso_macros"
|
|
4989
|
-
version = "0.3.0-pre.
|
|
4988
|
+
version = "0.3.0-pre.5"
|
|
4990
4989
|
dependencies = [
|
|
4991
4990
|
"proc-macro2",
|
|
4992
4991
|
"quote",
|
|
@@ -4995,7 +4994,7 @@ dependencies = [
|
|
|
4995
4994
|
|
|
4996
4995
|
[[package]]
|
|
4997
4996
|
name = "turso_node"
|
|
4998
|
-
version = "0.3.0-pre.
|
|
4997
|
+
version = "0.3.0-pre.5"
|
|
4999
4998
|
dependencies = [
|
|
5000
4999
|
"chrono",
|
|
5001
5000
|
"napi",
|
|
@@ -5008,7 +5007,7 @@ dependencies = [
|
|
|
5008
5007
|
|
|
5009
5008
|
[[package]]
|
|
5010
5009
|
name = "turso_parser"
|
|
5011
|
-
version = "0.3.0-pre.
|
|
5010
|
+
version = "0.3.0-pre.5"
|
|
5012
5011
|
dependencies = [
|
|
5013
5012
|
"bitflags 2.9.4",
|
|
5014
5013
|
"criterion",
|
|
@@ -5024,7 +5023,7 @@ dependencies = [
|
|
|
5024
5023
|
|
|
5025
5024
|
[[package]]
|
|
5026
5025
|
name = "turso_sqlite3"
|
|
5027
|
-
version = "0.3.0-pre.
|
|
5026
|
+
version = "0.3.0-pre.5"
|
|
5028
5027
|
dependencies = [
|
|
5029
5028
|
"env_logger 0.11.7",
|
|
5030
5029
|
"libc",
|
|
@@ -5037,7 +5036,7 @@ dependencies = [
|
|
|
5037
5036
|
|
|
5038
5037
|
[[package]]
|
|
5039
5038
|
name = "turso_stress"
|
|
5040
|
-
version = "0.3.0-pre.
|
|
5039
|
+
version = "0.3.0-pre.5"
|
|
5041
5040
|
dependencies = [
|
|
5042
5041
|
"anarchist-readable-name-generator-lib 0.1.2",
|
|
5043
5042
|
"antithesis_sdk",
|
|
@@ -5054,7 +5053,7 @@ dependencies = [
|
|
|
5054
5053
|
|
|
5055
5054
|
[[package]]
|
|
5056
5055
|
name = "turso_sync_engine"
|
|
5057
|
-
version = "0.3.0-pre.
|
|
5056
|
+
version = "0.3.0-pre.5"
|
|
5058
5057
|
dependencies = [
|
|
5059
5058
|
"base64 0.22.1",
|
|
5060
5059
|
"bytes",
|
|
@@ -5081,7 +5080,7 @@ dependencies = [
|
|
|
5081
5080
|
|
|
5082
5081
|
[[package]]
|
|
5083
5082
|
name = "turso_sync_js"
|
|
5084
|
-
version = "0.3.0-pre.
|
|
5083
|
+
version = "0.3.0-pre.5"
|
|
5085
5084
|
dependencies = [
|
|
5086
5085
|
"genawaiter",
|
|
5087
5086
|
"napi",
|
|
@@ -5096,7 +5095,7 @@ dependencies = [
|
|
|
5096
5095
|
|
|
5097
5096
|
[[package]]
|
|
5098
5097
|
name = "turso_whopper"
|
|
5099
|
-
version = "0.3.0-pre.
|
|
5098
|
+
version = "0.3.0-pre.5"
|
|
5100
5099
|
dependencies = [
|
|
5101
5100
|
"anyhow",
|
|
5102
5101
|
"clap",
|
|
@@ -8,29 +8,29 @@ exclude = [
|
|
|
8
8
|
]
|
|
9
9
|
|
|
10
10
|
[workspace.package]
|
|
11
|
-
version = "0.3.0-pre.
|
|
11
|
+
version = "0.3.0-pre.5"
|
|
12
12
|
authors = ["the Limbo authors"]
|
|
13
13
|
edition = "2021"
|
|
14
14
|
license = "MIT"
|
|
15
15
|
repository = "https://github.com/tursodatabase/turso"
|
|
16
16
|
|
|
17
17
|
[workspace.dependencies]
|
|
18
|
-
turso = { path = "bindings/rust", version = "0.3.0-pre.
|
|
19
|
-
turso_node = { path = "bindings/javascript", version = "0.3.0-pre.
|
|
20
|
-
limbo_completion = { path = "extensions/completion", version = "0.3.0-pre.
|
|
21
|
-
turso_core = { path = "core", version = "0.3.0-pre.
|
|
22
|
-
turso_sync_engine = { path = "sync/engine", version = "0.3.0-pre.
|
|
23
|
-
limbo_crypto = { path = "extensions/crypto", version = "0.3.0-pre.
|
|
24
|
-
limbo_csv = { path = "extensions/csv", version = "0.3.0-pre.
|
|
25
|
-
turso_ext = { path = "extensions/core", version = "0.3.0-pre.
|
|
26
|
-
turso_ext_tests = { path = "extensions/tests", version = "0.3.0-pre.
|
|
27
|
-
limbo_ipaddr = { path = "extensions/ipaddr", version = "0.3.0-pre.
|
|
28
|
-
turso_macros = { path = "macros", version = "0.3.0-pre.
|
|
29
|
-
limbo_percentile = { path = "extensions/percentile", version = "0.3.0-pre.
|
|
30
|
-
limbo_regexp = { path = "extensions/regexp", version = "0.3.0-pre.
|
|
31
|
-
limbo_uuid = { path = "extensions/uuid", version = "0.3.0-pre.
|
|
32
|
-
turso_parser = { path = "parser", version = "0.3.0-pre.
|
|
33
|
-
limbo_fuzzy = { path = "extensions/fuzzy", version = "0.3.0-pre.
|
|
18
|
+
turso = { path = "bindings/rust", version = "0.3.0-pre.5" }
|
|
19
|
+
turso_node = { path = "bindings/javascript", version = "0.3.0-pre.5" }
|
|
20
|
+
limbo_completion = { path = "extensions/completion", version = "0.3.0-pre.5" }
|
|
21
|
+
turso_core = { path = "core", version = "0.3.0-pre.5" }
|
|
22
|
+
turso_sync_engine = { path = "sync/engine", version = "0.3.0-pre.5" }
|
|
23
|
+
limbo_crypto = { path = "extensions/crypto", version = "0.3.0-pre.5" }
|
|
24
|
+
limbo_csv = { path = "extensions/csv", version = "0.3.0-pre.5" }
|
|
25
|
+
turso_ext = { path = "extensions/core", version = "0.3.0-pre.5" }
|
|
26
|
+
turso_ext_tests = { path = "extensions/tests", version = "0.3.0-pre.5" }
|
|
27
|
+
limbo_ipaddr = { path = "extensions/ipaddr", version = "0.3.0-pre.5" }
|
|
28
|
+
turso_macros = { path = "macros", version = "0.3.0-pre.5" }
|
|
29
|
+
limbo_percentile = { path = "extensions/percentile", version = "0.3.0-pre.5" }
|
|
30
|
+
limbo_regexp = { path = "extensions/regexp", version = "0.3.0-pre.5" }
|
|
31
|
+
limbo_uuid = { path = "extensions/uuid", version = "0.3.0-pre.5" }
|
|
32
|
+
turso_parser = { path = "parser", version = "0.3.0-pre.5" }
|
|
33
|
+
limbo_fuzzy = { path = "extensions/fuzzy", version = "0.3.0-pre.5" }
|
|
34
34
|
sql_generation = { path = "sql_generation" }
|
|
35
35
|
strum = { version = "0.26", features = ["derive"] }
|
|
36
36
|
strum_macros = "0.26"
|
|
@@ -317,7 +317,7 @@ impl Drop for Connection {
|
|
|
317
317
|
#[allow(clippy::arc_with_non_send_sync)]
|
|
318
318
|
#[pyfunction(signature = (path))]
|
|
319
319
|
pub fn connect(path: &str) -> Result<Connection> {
|
|
320
|
-
match turso_core::Connection::from_uri(path, true, false, false, false, false) {
|
|
320
|
+
match turso_core::Connection::from_uri(path, true, false, false, false, false, false) {
|
|
321
321
|
Ok((io, conn)) => Ok(Connection { conn, _io: io }),
|
|
322
322
|
Err(e) => Err(PyErr::new::<ProgrammingError, _>(format!(
|
|
323
323
|
"Failed to create connection: {e:?}"
|
|
@@ -57,7 +57,6 @@ regex-syntax = { workspace = true, default-features = false, features = [
|
|
|
57
57
|
"unicode",
|
|
58
58
|
] }
|
|
59
59
|
chrono = { workspace = true, default-features = false, features = ["clock"] }
|
|
60
|
-
julian_day_converter = "0.4.5"
|
|
61
60
|
rand = { workspace = true }
|
|
62
61
|
libm = "0.2"
|
|
63
62
|
turso_macros = { workspace = true }
|
|
@@ -84,6 +83,8 @@ twox-hash = "2.1.1"
|
|
|
84
83
|
intrusive-collections = "0.9.7"
|
|
85
84
|
roaring = "0.11.2"
|
|
86
85
|
simsimd = "6.5.3"
|
|
86
|
+
arc-swap = "1.7"
|
|
87
|
+
rustc-hash = "2.0"
|
|
87
88
|
|
|
88
89
|
[build-dependencies]
|
|
89
90
|
chrono = { workspace = true, default-features = false }
|
|
@@ -163,6 +163,7 @@ impl From<turso_ext::ResultCode> for LimboError {
|
|
|
163
163
|
|
|
164
164
|
pub const SQLITE_CONSTRAINT: usize = 19;
|
|
165
165
|
pub const SQLITE_CONSTRAINT_PRIMARYKEY: usize = SQLITE_CONSTRAINT | (6 << 8);
|
|
166
|
+
#[allow(dead_code)]
|
|
166
167
|
pub const SQLITE_CONSTRAINT_FOREIGNKEY: usize = SQLITE_CONSTRAINT | (7 << 8);
|
|
167
168
|
pub const SQLITE_CONSTRAINT_NOTNULL: usize = SQLITE_CONSTRAINT | (5 << 8);
|
|
168
169
|
pub const SQLITE_FULL: usize = 13; // we want this in autoincrement - incase if user inserts max allowed int
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#[cfg(feature = "fs")]
|
|
2
2
|
mod dynamic;
|
|
3
3
|
mod vtab_xconnect;
|
|
4
|
+
use crate::index_method::backing_btree::BackingBtreeIndexMethod;
|
|
5
|
+
use crate::index_method::toy_vector_sparse_ivf::VectorSparseInvertedIndexMethod;
|
|
6
|
+
use crate::index_method::{
|
|
7
|
+
BACKING_BTREE_INDEX_METHOD_NAME, TOY_VECTOR_SPARSE_IVF_INDEX_METHOD_NAME,
|
|
8
|
+
};
|
|
4
9
|
use crate::schema::{Schema, Table};
|
|
5
10
|
#[cfg(all(target_os = "linux", feature = "io_uring", not(miri)))]
|
|
6
11
|
use crate::UringIO;
|
|
@@ -162,6 +167,17 @@ impl Database {
|
|
|
162
167
|
/// Register any built-in extensions that can be stored on the Database so we do not have
|
|
163
168
|
/// to register these once-per-connection, and the connection can just extend its symbol table
|
|
164
169
|
pub fn register_global_builtin_extensions(&self) -> Result<(), String> {
|
|
170
|
+
{
|
|
171
|
+
let mut syms = self.builtin_syms.write();
|
|
172
|
+
syms.index_methods.insert(
|
|
173
|
+
TOY_VECTOR_SPARSE_IVF_INDEX_METHOD_NAME.to_string(),
|
|
174
|
+
Arc::new(VectorSparseInvertedIndexMethod),
|
|
175
|
+
);
|
|
176
|
+
syms.index_methods.insert(
|
|
177
|
+
BACKING_BTREE_INDEX_METHOD_NAME.to_string(),
|
|
178
|
+
Arc::new(BackingBtreeIndexMethod),
|
|
179
|
+
);
|
|
180
|
+
}
|
|
165
181
|
let syms = self.builtin_syms.data_ptr();
|
|
166
182
|
// Pass the mutex pointer and the appropriate handler
|
|
167
183
|
let schema_mutex_ptr = &self.schema as *const Mutex<Arc<Schema>> as *mut Mutex<Arc<Schema>>;
|
|
@@ -348,30 +348,35 @@ pub fn exec_julianday(values: &[Register]) -> Value {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
fn to_julian_day_exact(dt: &NaiveDateTime) -> f64 {
|
|
351
|
-
|
|
352
|
-
let
|
|
353
|
-
let
|
|
354
|
-
let
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
351
|
+
// SQLite's computeJD algorithm
|
|
352
|
+
let mut y = dt.year();
|
|
353
|
+
let mut m = dt.month() as i32;
|
|
354
|
+
let d = dt.day() as i32;
|
|
355
|
+
|
|
356
|
+
if m <= 2 {
|
|
357
|
+
y -= 1;
|
|
358
|
+
m += 12;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
let a = (y + 4800) / 100;
|
|
362
|
+
let b = 38 - a + (a / 4);
|
|
363
|
+
let x1 = 36525 * (y + 4716) / 100;
|
|
364
|
+
let x2 = 306001 * (m + 1) / 10000;
|
|
365
|
+
|
|
366
|
+
// iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5) * 86400000)
|
|
367
|
+
let jd_days = (x1 + x2 + d + b) as f64 - 1524.5;
|
|
368
|
+
let mut i_jd = (jd_days * 86400000.0) as i64;
|
|
369
|
+
|
|
370
|
+
// Add time component in milliseconds
|
|
371
|
+
// iJD += h*3600000 + m*60000 + (sqlite3_int64)(s*1000 + 0.5)
|
|
372
|
+
let h_ms = dt.hour() as i64 * 3600000;
|
|
373
|
+
let m_ms = dt.minute() as i64 * 60000;
|
|
374
|
+
let s_ms = (dt.second() as f64 * 1000.0 + dt.nanosecond() as f64 / 1_000_000.0 + 0.5) as i64;
|
|
359
375
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
+ (day as f64)
|
|
365
|
-
+ (b as f64)
|
|
366
|
-
- 1524.5;
|
|
367
|
-
|
|
368
|
-
let seconds = dt.hour() as f64 * 3600.0
|
|
369
|
-
+ dt.minute() as f64 * 60.0
|
|
370
|
-
+ dt.second() as f64
|
|
371
|
-
+ (dt.nanosecond() as f64) / 1_000_000_000.0;
|
|
372
|
-
|
|
373
|
-
let jd_fraction = seconds / 86400.0;
|
|
374
|
-
jd_days + jd_fraction
|
|
376
|
+
i_jd += h_ms + m_ms + s_ms;
|
|
377
|
+
|
|
378
|
+
// Convert back to floating point JD
|
|
379
|
+
i_jd as f64 / 86400000.0
|
|
375
380
|
}
|
|
376
381
|
|
|
377
382
|
pub fn exec_unixepoch(time_value: &Value) -> Result<Value> {
|
|
@@ -490,7 +495,58 @@ fn get_date_time_from_time_value_float(value: f64) -> Option<NaiveDateTime> {
|
|
|
490
495
|
if value.is_infinite() || value.is_nan() || !is_julian_day_value(value) {
|
|
491
496
|
return None;
|
|
492
497
|
}
|
|
493
|
-
|
|
498
|
+
julian_day_to_datetime(value).ok()
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/// Convert a Julian Day number (as f64) to a NaiveDateTime
|
|
502
|
+
/// This uses SQLite's algorithm which converts to integer milliseconds first
|
|
503
|
+
/// to preserve precision, then converts back to date/time components.
|
|
504
|
+
fn julian_day_to_datetime(jd: f64) -> Result<NaiveDateTime> {
|
|
505
|
+
// SQLite approach: Convert JD to integer milliseconds
|
|
506
|
+
// iJD = (sqlite3_int64)(jd * 86400000.0 + 0.5)
|
|
507
|
+
let i_jd = (jd * 86400000.0 + 0.5) as i64;
|
|
508
|
+
|
|
509
|
+
// Compute the date (Year, Month, Day) from iJD
|
|
510
|
+
// Z = (int)((iJD + 43200000)/86400000)
|
|
511
|
+
let z = ((i_jd + 43200000) / 86400000) as i32;
|
|
512
|
+
|
|
513
|
+
// SQLite's algorithm from computeYMD
|
|
514
|
+
let alpha = ((z as f64 + 32044.75) / 36524.25) as i32 - 52;
|
|
515
|
+
let a = z + 1 + alpha - ((alpha + 100) / 4) + 25;
|
|
516
|
+
let b = a + 1524;
|
|
517
|
+
let c = ((b as f64 - 122.1) / 365.25) as i32;
|
|
518
|
+
let d = (36525 * (c & 32767)) / 100;
|
|
519
|
+
let e = ((b - d) as f64 / 30.6001) as i32;
|
|
520
|
+
let x1 = (30.6001 * e as f64) as i32;
|
|
521
|
+
|
|
522
|
+
let day = (b - d - x1) as u32;
|
|
523
|
+
let month = if e < 14 { e - 1 } else { e - 13 } as u32;
|
|
524
|
+
let year = if month > 2 { c - 4716 } else { c - 4715 };
|
|
525
|
+
|
|
526
|
+
// Compute the time (Hour, Minute, Second) from iJD
|
|
527
|
+
// day_ms = (int)((iJD + 43200000) % 86400000)
|
|
528
|
+
let day_ms = ((i_jd + 43200000) % 86400000) as i32;
|
|
529
|
+
|
|
530
|
+
// s = (day_ms % 60000) / 1000.0
|
|
531
|
+
let s_millis = day_ms % 60000;
|
|
532
|
+
let seconds = (s_millis / 1000) as u32;
|
|
533
|
+
let millis = (s_millis % 1000) as u32;
|
|
534
|
+
|
|
535
|
+
// day_min = day_ms / 60000
|
|
536
|
+
let day_min = day_ms / 60000;
|
|
537
|
+
let minutes = (day_min % 60) as u32;
|
|
538
|
+
let hours = (day_min / 60) as u32;
|
|
539
|
+
|
|
540
|
+
// Create the date
|
|
541
|
+
let date = NaiveDate::from_ymd_opt(year, month, day)
|
|
542
|
+
.ok_or_else(|| crate::LimboError::InternalError("Invalid date".to_string()))?;
|
|
543
|
+
|
|
544
|
+
// Create time with millisecond precision converted to nanoseconds
|
|
545
|
+
let nanos = millis * 1_000_000;
|
|
546
|
+
let time = NaiveTime::from_hms_nano_opt(hours, minutes, seconds, nanos)
|
|
547
|
+
.ok_or_else(|| crate::LimboError::InternalError("Invalid time".to_string()))?;
|
|
548
|
+
|
|
549
|
+
Ok(NaiveDateTime::new(date, time))
|
|
494
550
|
}
|
|
495
551
|
|
|
496
552
|
fn is_leap_second(dt: &NaiveDateTime) -> bool {
|
|
@@ -1584,17 +1640,15 @@ mod tests {
|
|
|
1584
1640
|
assert_eq!(weekday_sunday_based(&dt), 5);
|
|
1585
1641
|
}
|
|
1586
1642
|
|
|
1587
|
-
#[allow(deprecated)]
|
|
1588
1643
|
#[test]
|
|
1589
1644
|
fn test_apply_modifier_julianday() {
|
|
1590
|
-
use julian_day_converter::*;
|
|
1591
|
-
|
|
1592
1645
|
let dt = create_datetime(2000, 1, 1, 12, 0, 0);
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1646
|
+
|
|
1647
|
+
// Convert datetime to julian day using our implementation
|
|
1648
|
+
let julian_day_value = to_julian_day_exact(&dt);
|
|
1649
|
+
|
|
1650
|
+
// Convert back
|
|
1651
|
+
let dt_result = julian_day_to_datetime(julian_day_value).unwrap();
|
|
1598
1652
|
assert_eq!(dt_result, dt);
|
|
1599
1653
|
}
|
|
1600
1654
|
|