Commit Graph

898 Commits

Author SHA1 Message Date
gwenn
f5c83af863 Expose query progress information 2020-10-25 11:58:47 +01:00
Tim Hutt
8841187717 Silence clippy 2020-10-24 09:52:05 -07:00
Tim Hutt
f264873999 Cargo format 2020-10-24 09:52:05 -07:00
Tim Hutt
ebcec59969 Implement From/ToSql for more types
This implements `FromSql` for `u64`, `usize` and `f32`, and `ToSql` for `f32`.

I also updated the documentation to describe how it currently works, and changed the implementation to use `try_from` for integral casts rather rather than custom code.

Test added.
2020-10-24 09:52:05 -07:00
gwenn
6ae9802fa3 Feature ptr_offset_from #41079 available in 1.47 2020-10-08 21:12:46 +02:00
Thom Chiovoloni
084d1f535d Replace lru-cache with hashlink 2020-10-06 00:10:22 -07:00
Thom Chiovoloni
587fdeb185 Add write_all_at for compatibility with FileExt, improve docs a little 2020-10-04 15:48:10 -07:00
Thom Chiovoloni
d61fe36237 Improve pos io test coverage 2020-10-04 15:48:10 -07:00
Thom Chiovoloni
67ee5a0586 Add test coverage for positional blob io 2020-10-04 15:48:10 -07:00
Thom Chiovoloni
7cd909fc14 Add positional blob i/o and adjust blob i/o example docs 2020-10-04 15:48:10 -07:00
gwenn
799b5d3f7b Rustfmt 2020-10-04 07:39:35 +02:00
gwenn
d2dcc2d987 Fix clippy warning 2020-10-04 07:38:52 +02:00
Michael Sproul
d7e0536b41
Add must_use attribute to iterators 2020-09-02 16:15:25 +10:00
gwenn
2a7b11320f Fix clippy warnings 2020-08-17 20:07:56 +02:00
gwenn
a4691db6d0 pragma_update fails with ExecuteReturnedResults
Ideally, while executing a batch, we should fail if it contains a SELECT
statement. But currently there is no way to make the distinction between
a SELECT and a PRAGMA which both updates and returns a row.
So we fail only when `extra_check` feature is activated.
2020-08-17 19:30:24 +02:00
Nikhil Benesch
b83d22e2b7 Upgrade to time v0.2 and put it behind a feature flag
This also removes the usage of time in the crate's top-level
documentation example, as was done for the README in #625.

Fix #653.
2020-07-24 11:28:19 -07:00
Tim
83c038107d Fix order of parameters in InvalidParameterCount message
This prints a message like `Error: Wrong number of parameters passed to query. Got 7, needed 8`, but the numbers were the wrong way around - i.e. it should have printed `Got 8, needed 7` in this case.
2020-07-01 08:38:50 -07:00
Thom Chiovoloni
f79a9ca3ef Publically expose Map 2020-06-29 09:36:13 -07:00
gwenn
024e2e6bf0
Merge pull request #773 from gwenn/execute_batch
Implement our own sqlite3_exec
2020-06-28 06:18:56 +02:00
gwenn
dd886578d2 Implement our own sqlite3_exec
Should fix issue related to unlock notify: #767
Caveat: many CString allocated.
2020-06-26 19:35:14 +02:00
gwenn
4114c94585 Clippy 2020-06-26 19:22:20 +02:00
gwenn
57db338537 Rustfmt 2020-06-25 09:45:49 -07:00
gwenn
f37519ad51 Replace execute_batch usages by execute
Because execute_batch does not support unlock_notify
2020-06-25 09:45:49 -07:00
Thom Chiovoloni
1c9e381a21 Clippy fixes 2020-06-07 19:18:46 -07:00
Thom Chiovoloni
f7a573e44a Don't implement Into<RawStatement> for Statement 2020-06-07 19:18:46 -07:00
gwenn
7b08dc9ad5 Try to explain why we need a map function
To tranform the fallible streaming iterator.
2020-06-02 19:05:09 +02:00
gwenn
c577a9d801 Lifetime elision 2020-06-01 18:44:02 +02:00
gwenn
52a80f95f7
Merge pull request #754 from gwenn/phantom_data
Fix some PhantomData declarations
2020-06-01 11:48:02 +02:00
gwenn
265020e589 Fix some PhantomData declarations
Specify the expected type instead of () even if only the lifetime
matters
2020-06-01 10:11:34 +02:00
gwenn
2af75d1f13 VTabCursor lifetime should be bound to VTab lifetime
```c
struct sqlite3_vtab_cursor {
  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */
```
It seems that we need to introduce a lifetime on `VTab` trait
to express such constraint:
https://users.rust-lang.org/t/associated-type-with-lifetime-bound/7256
But there may be another/new way to do it.
2020-06-01 09:48:49 +02:00
Evgeniy A. Dushistov
d16748ac9f adding ability to work with sqlite compiled with -DSQLITE_OMIT_DECLTYPE
fix #751
2020-06-01 06:31:27 +03:00
gwenn
8cb5b2e585 Document Rows::map and FallibleStreamingIterator impl
See
https://www.reddit.com/r/rust/comments/gov817/rusqlite_only_getting_ok_entries_from_query_map/
```
let mut stmt = self
    .db
    .prepare("SELECT tag FROM tags WHERE tags.entry_id = ?1")?;

let tags = stmt.query(params![id])?;

tags
    .map(|res| res.get(0))
    .collect()
```
2020-05-24 20:53:52 +02:00
gwenn
e664f82630 Add still missing docs in session module 2020-05-21 00:48:06 -07:00
gwenn
5ebba26a7e Add missing docs in session module 2020-05-21 00:48:06 -07:00
gwenn
76fc22c653 Fix missing docs 2020-05-21 00:48:06 -07:00
Martin Habovstiak
8a08dff115 Clippy reports redundant closures even in cases in which removing the
closure is impossible. See
https://github.com/rust-lang/rust-clippy/issues/5594

Allow this lint until the issue is resolved in clippy or the compiler.
2020-05-21 00:47:52 -07:00
Martin Habovstiak
c5b2efc099 impl TryFrom<&Row<'_>> for (...)
This change implements `TryFrom<&Row>` for tuples up to 16 fields. This
is a convenience function that can be used to map rows more easily.

The change includes tests for 1-tuple, 2-tuple and 16-tuple.
2020-05-21 00:47:52 -07:00
gwenn
5565ae5629
Merge pull request #735 from gwenn/extended_result_codes
Activate extended result codes asap
2020-05-17 09:53:25 +02:00
gwenn
0060ff8a44 Activate extended result codes asap 2020-05-16 11:01:30 +02:00
gwenn
ceb9f11de8 Replace pub(crate) by pub(super) visibilty 2020-05-16 10:18:25 +02:00
Thom Chiovoloni
12cb228c9c Fix SqliteMallocString::from_str on arm32 2020-04-23 13:58:50 -07:00
Thom Chiovoloni
d88fe1c1b1 Remove parameter count caching -- should be cheap (if statically linked at least...) 2020-04-16 12:05:56 -07:00
Thom Chiovoloni
a776f460e8 Cache param count and make statement cache more effective 2020-04-16 12:05:56 -07:00
Thom Chiovoloni
6485b324d7 Name fields of RawStatement 2020-04-16 12:05:56 -07:00
Thom Chiovoloni
1207a7cc06 Make clippy behave slightly more reasonably 2020-04-16 08:21:43 -07:00
Thom Chiovoloni
418ef10af2 Add a wrapper for strings allocated on sqlite heap 2020-04-16 08:21:43 -07:00
Thom Chiovoloni
9322b0e881 Update links & copyright statement 2020-04-15 21:37:39 -07:00
Thom Chiovoloni
45fd77ee43 UnlockNotification should hold mutex when calling condvar 2020-04-15 13:52:19 -07:00
Thom Chiovoloni
c9ef5bd63c Make VTab / VTabCursor unsafe trait as implmenting them on the wrong type is unsound 2020-04-15 10:33:04 -07:00
Thom Chiovoloni
3c6b57fe1b Fix vtab::Module lifetime 2020-04-15 10:33:04 -07:00