Commit Graph

156 Commits

Author SHA1 Message Date
gwenn
f1198dd9ff Add binding to sqlite3_create_window_function 2019-06-25 20:33:49 +02:00
gwenn
bb70718ca1 Fix nightly build
error[E0277]: the type
`std::cell::UnsafeCell<std::option::Option<std::boxed::Box<std::cell::RefCell<regex::exec::ProgramCacheInner>>>>`
may contain interior mutability and a reference may not be safely
transferrable across a catch_unwind boundary
2019-06-02 09:04:47 +02:00
Richard Dodd (dodj)
5430715982
Fix error when building with uuid and functions features. 2019-04-26 15:15:07 +01:00
gwenn
6d9ae896b5 Do not panic by default
Replace `Row::get` by `Row::get_checked`,
And rename original `Row::get` to `Row::get_unwrap`.
`Stmt::query_map`, `Stmt::query_map_named`, `Stmt::query_row`,
`Conn::query_row` and `Conn::query_row_named` callback parameter must return a `Result`.
2019-02-21 20:48:09 +01:00
gwenn
d70286e98a Remove unwrap from examples 2019-02-09 07:16:05 +01:00
gwenn
e9896a7734 Lifetime elision in impl 2019-02-03 11:02:38 +01:00
gwenn
be98290bbd Replace assert! by assert_eq! 2019-02-02 11:09:00 +01:00
gwenn
0a46a34e3d Clean examples
Remove `extern crate` usages.
Rustfmt.
2019-01-30 20:14:46 +01:00
Thom Chiovoloni
ef757240c1 Use rusqlite::ffi instead of extern crate libsqlite3_sys 2019-01-29 14:59:41 -08:00
gwenn
4be7900bab Rustfmt 2019-01-26 11:02:34 +01:00
Thom Chiovoloni
b6539a0fbf Make get_aux safe by storing the TypeId 2019-01-26 00:52:50 -08:00
gwenn
9381e5a11b
Merge pull request #449 from gwenn/catch_unwind
Callbacks must not be able to unwind into sqlite code
2018-12-16 18:10:55 +01:00
gwenn
bd9b850c43 Callbacks must not be able to unwind into sqlite code 2018-12-16 09:40:14 +01:00
gwenn
9dfc56811b Fix compilation error with functions and i128 features 2018-12-16 08:19:54 +01:00
gwenn
d874180333 Rust 2018 idioms 2018-12-07 21:57:04 +01:00
gwenn
f04047db01 Rust 2018 2018-10-30 20:15:08 +01:00
gwenn
1598d4bc30 Rustfmt 2018-10-28 08:51:02 +01:00
Thom Chiovoloni
3d82f7199a Allow getting a ValueRef out of Row and Context, fixes #259 2018-10-18 12:14:38 -07:00
gwenn
e7e03c3443 Introduce NO_PARAMS constant
As suggested here:
https://users.rust-lang.org/t/sql-parameter-values/20469/2
2018-09-16 11:10:19 +02:00
gwenn
c4ae541eac Take IntoIterator rather than &[&ToSql] (#312) 2018-09-16 09:49:23 +02:00
gwenn
5e9c7bac4e Rustfmt 2018-08-16 18:29:46 +02:00
gwenn
8c6ce46c17 Make sure scalar functions and hooks outlive the connection 2018-08-15 20:04:01 +02:00
gwenn
4770060396 Make sure scalar functions and hooks are Sendable 2018-08-15 18:30:18 +02:00
gwenn
0ccf98d214 Merge remote-tracking branch 'jgallagher/master' into vtab 2018-08-11 13:37:56 +02:00
gwenn
c925d1aa97 Rustfmt 2018-08-11 12:48:21 +02:00
gwenn
2a29717c5a Fix hooks 2018-08-11 11:14:17 +02:00
gwenn
d72c4582d9 Merge remote-tracking branch 'jgallagher/master' into vtab 2018-06-10 19:16:20 +02:00
gwenn
fa64a4d0bf Draft for carray module in Rust
Incomplete support for sqlite3_bind_pointer.
Make Context::set_result return a Result.
Add Values::get_array.
2018-06-10 18:29:38 +02:00
gwenn
c6f4ae632a Replace column index/count type (i32) with usize
Breaking change
2018-05-23 21:04:13 +02:00
gwenn
6cbeb6ef59 Introduce context module
To make `set_result` and `report_error` in functions module
visible to vtab module.
2018-05-13 11:44:31 +02:00
gwenn
5fa3810a4b Fix Clippy warnings 2018-05-06 08:45:56 +02:00
gwenn
1e3dc542a4 Merge remote-tracking branch 'jgallagher/master' into vtab 2018-05-06 08:00:12 +02:00
gwenn
994d40da26 Fix clippy warnings 2018-05-04 19:55:55 +02:00
gwenn
9c5c9e3c7e Merge remote-tracking branch 'jgallagher/master' into vtab 2018-04-30 22:02:14 +02:00
gwenn
3b5e224f82 Fix tyvar_behind_raw_pointer warnings 2018-03-10 18:07:30 +01:00
gwenn
c842e789bd Merge remote-tracking branch 'jgallagher/master' into vtab 2017-09-11 19:45:22 +02:00
John Gallagher
6b360a11c2 Merge pull request #258 from gwenn/constants
Constants
2017-05-29 10:37:26 -04:00
gwenn
1d684ae653 Merge remote-tracking branch 'jgallagher/master' into vtab 2017-04-21 20:01:04 +02:00
Aidan Hobson Sayers
7bd969b8fd Fix functions for empty blobs
Expands fix from #175
2017-04-16 16:49:28 +01:00
gwenn
08f96a678e Rustfmt 2017-04-07 19:43:24 +02:00
John Gallagher
549373f764 Fix incorrect ffi constant accesses. 2017-04-05 13:58:33 -04:00
gwenn
7f0082e44e Merge remote-tracking branch 'jgallagher/master' into vtab 2017-03-08 20:35:07 +01:00
gwenn
faa94d1246 Fix clippy warnings
And fix bench.
2017-02-24 20:10:51 +01:00
Sean Griffin
2c58b3f804 Remove the dependency on libc
Recent versions of bindgen use `std::os::raw` over `libc`, but currently
`libsqlite3-sys` is overriding that. `std::os::raw` is a subset of
`libc` that exports only the relevant type definitions, but not any
functions which require additional linking. This enables
`libsqlite3-sys` to be more easily used on targets that may not have a
libc available (presumably sqlite itself would have been compiled with
musl in that case)
2017-02-16 11:17:24 -05:00
gwenn
80f822db28 rustfmt v0.7.1 2017-02-08 21:11:15 +01:00
John Gallagher
e180ab15ce Fix incomplete match under functions feature 2017-01-22 20:05:06 -05:00
gwenn
46df930881 Merge remote-tracking branch 'jgallagher/master' into vtab 2016-12-31 09:15:26 +01:00
John Gallagher
4c8b0ab6dd Merge pull request #181 from gwenn/clippy
Fix clippy warnings
2016-12-31 01:23:40 -05:00
John Gallagher
4181441d63 Merge branch 'master' into gwenn-invalid-column-type 2016-12-31 00:35:47 -05:00
John Gallagher
0d685af2d5 Merge branch 'master' into safe-tosql 2016-12-30 23:18:32 -05:00
gwenn
8c6f585d52 Fix clippy warnings 2016-12-04 10:18:56 +01:00
gwenn
8f28ff17b8 Fix rustdoc warnings 2016-08-15 12:41:15 +02:00
gwenn
505abc0331 Change signature of VTabCursor::filter 2016-08-14 09:31:53 +02:00
gwenn
8f079819f7 Change VTabCursor::filter signature 2016-08-13 13:55:30 +02:00
gwenn
3eb3b22ad5 Merge remote-tracking branch 'jgallagher/master' into vtab 2016-07-02 11:28:59 +02:00
gwenn
e2cf171192 Introduce FromSqlError as specified by John Gallagher 2016-06-02 21:03:25 +02:00
gwenn
91dc30b04d Simplify InvalidType 2016-05-30 21:20:07 +02:00
gwenn
fb19e718cf Introduce an intermediary InvalidType error.
InvalidType is used where the column/parameter index is not known.
2016-05-30 20:35:56 +02:00
gwenn
cabcaf3dcb Better error reporting on invalid column type. 2016-05-26 21:03:05 +02:00
John Gallagher
f3693a993e rustfmt 2016-05-26 00:28:18 -04:00
John Gallagher
2b830fde2d Remove pub re-export of FFI helpers from functions. 2016-05-26 00:14:45 -04:00
John Gallagher
6467815d02 Replace functions::ToResult with ToSql. 2016-05-26 00:14:45 -04:00
John Gallagher
e4926ac0d7 Rework ToSql to be implementable without unsafe. 2016-05-26 00:14:45 -04:00
John Gallagher
2f4990dafd Rename BorrowedValue -> ValueRef. 2016-05-24 21:34:18 -04:00
John Gallagher
0fbfad2452 Remove functions::FromValue.
With the new definition of FromSql, we can reuse it since we can convert
a sqlite3_value into a BorrowedValue.
2016-05-24 20:08:12 -04:00
gwenn
0740620ffe Merge remote-tracking branch 'jgallagher/master' into vtab 2016-05-20 18:31:30 +02:00
John Gallagher
c4417bee0e Manual fixes for rustfmt overly long lines. 2016-05-19 20:09:40 -05:00
gwenn
29373e7d0d Merge remote-tracking branch 'jgallagher/master' into vtab 2016-05-16 22:30:58 +02:00
gwenn
3a52dd65f0 Rustfmt 2016-05-16 19:52:17 +02:00
gwenn
6fb549420b Rustfmt 2016-05-03 21:00:59 +02:00
gwenn
5541cb06fe Merge remote-tracking branch 'jgallagher/master' into vtab 2016-03-30 18:26:26 +02:00
John Gallagher
41fe698cec Address additional clippy warnings 2016-03-29 14:18:56 -04:00
gwenn
0fe1990d34 Fix clippy warnings 2016-02-14 16:11:59 +01:00
gwenn
eab16402be Merge remote-tracking branch 'jgallagher/master' into vtab 2016-02-01 20:35:30 +01:00
John Gallagher
f4c3ba0fa2 rustfmt 2016-02-01 10:48:30 -05:00
gwenn
ea14115d6c Ensure there is no allocation in final aggregation step. 2016-01-28 18:12:23 +01:00
gwenn
2d6705b03e First, try to implement a simple virtual table. 2016-01-23 18:34:09 +01:00
John Gallagher
ca761d7697 Avoid creating an aggregation context unnecessarily if the function is
called against 0 rows.
2016-01-07 15:14:24 -05:00
John Gallagher
199dfc455b Internal refactor - extract common error handling code 2016-01-07 12:39:16 -05:00
John Gallagher
b189f6ba66 Change how Aggregate works when called on no rows.
Before this commit, if the aggregate function was called on 0 rows, it
would always return NULL (and never call Aggregate::init() or
finalize()). Now, init() and finalize() are always called to get the
result of the function, even if step() is never called.
2016-01-07 12:35:27 -05:00
John Gallagher
e4819b6adc Give Aggregate::finalize ownership of the context it created 2016-01-07 11:42:39 -05:00
John Gallagher
ab262a55de Merge branch 'aggregate' of https://github.com/gwenn/rusqlite into gwenn-aggregate 2016-01-07 11:40:40 -05:00
gwenn
12f26e78b3 Introduce RowIndex trait (like in rust-postgres) 2016-01-02 12:13:37 +01:00
gwenn
987b06cf79 Add some documentation 2015-12-20 19:27:28 +01:00
gwenn
83b9fd0aba Test a user-defined aggregate function: my_sum. 2015-12-20 12:23:51 +01:00
gwenn
468ded3e08 Merge branch 'master' of https://github.com/jgallagher/rusqlite into aggregate 2015-12-18 20:39:08 +01:00
John Gallagher
aac4d59fcc Change Error from a struct to an enum (BREAKING CHANGE).
This allows us to separate out the underlying SQLite error codes from
errors that occur on the Rust side.
2015-12-16 20:30:27 -05:00
Gwenael Treguier
13c93e0f8b Rustfmt 2015-12-15 20:57:32 +01:00
Gwenael Treguier
458951e2d5 First draft to support user defined aggregate functions. 2015-12-15 20:54:23 +01:00
John Gallagher
b883ab651d Update unsafety of C function pointers for new bindgen 2015-12-13 08:40:51 -05:00
John Gallagher
eb60bb3111 Rename SqliteResult -> Result. 2015-12-12 14:06:03 -05:00
John Gallagher
f0b6bf9152 Rename SqliteError -> Error. 2015-12-12 13:53:58 -05:00
John Gallagher
4327a84edb Rename SqliteConnection -> Connection.
Leave old name in as a (deprecated) typealias.
2015-12-12 13:53:34 -05:00
John Gallagher
4830b0a648 Add unit test for function with variable number of arguments 2015-12-12 10:44:08 -05:00
John Gallagher
3bcde498bd Expand comments. 2015-12-11 16:27:39 -05:00
John Gallagher
ecef092303 Add remove_function to clear a user-defined function. 2015-12-11 15:47:52 -05:00
John Gallagher
3baf7b10f8 Add unit test demonstrating a closure-based UDF. 2015-12-11 15:35:59 -05:00
John Gallagher
3913e89f94 Allow user scalar functions to return results.
This removes the need for scalar functions to have direct access to the
context (in order to set the return value).
2015-12-11 15:08:40 -05:00
John Gallagher
81ec7fe7cd Add get to function::Context.
This allows user-defined functions to now only accept a `Context`, as it
embeds the arguments inside itself.
2015-12-11 14:46:28 -05:00
John Gallagher
94d40c41c7 Introduce Context wrapper for user-defined functions.
This commit adds get/set auxilliary data for arguments; more to come.
2015-12-11 13:54:08 -05:00