Commit Graph

53 Commits

Author SHA1 Message Date
Thom Chiovoloni
a776f460e8 Cache param count and make statement cache more effective 2020-04-16 12:05:56 -07:00
gwenn
edfd7658c3 Segmentation fault on prepare_cached with an empty query
With an empty query is prepared, sqlite3 returns no error but a null pointer.
And then `sqlite3_sql` returns null.
Which make `CStr::from_ptr` crash.
2019-10-29 19:24:18 +01:00
gwenn
ceb1ce4a55 Rustfmt 2019-03-19 20:45:04 +01:00
gwenn
71a2004894 Add Rows::map method 2019-03-10 12:58:20 +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
e9896a7734 Lifetime elision in impl 2019-02-03 11:02:38 +01:00
gwenn
4c4578851b Remove needless lifetimes 2019-02-02 11:08:04 +01:00
gwenn
1262238229 Rustfmt 2018-10-30 20:15:19 +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
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
c925d1aa97 Rustfmt 2018-08-11 12:48:21 +02:00
gwenn
7310cac6f5 Use pub(crate) 2018-07-31 22:17:17 +02:00
gwenn
5c44ed79d3 Fix tests 2018-05-23 20:18:18 +02:00
gwenn
994d40da26 Fix clippy warnings 2018-05-04 19:55:55 +02:00
gwenn
96e5cf2239 Fix statement cache
SQLite ignores the SQL tail (whitespaces, comments).
We can easily ignore whitespaces by trimming the SQL.
2018-02-17 10:28:20 +01:00
gwenn
08f96a678e Rustfmt 2017-04-07 19:43:24 +02:00
John Gallagher
ec78a2b5fa Reorganize: Extract Row/Rows and helper types into their own mod files. 2017-03-08 17:03:31 -05:00
John Gallagher
38c9a4a159 Reorganize: Extract Statement and its impl into its own module. 2017-03-08 10:48:14 -05:00
John Gallagher
60e1f3c02f Add more explicit types in unit tests. 2017-02-05 17:30:53 -05:00
gwenn
ffe605150a Ensure cache is flushed when closing the connection
Fix #186
2016-11-04 20:47:28 +01:00
John Gallagher
8ce2f5888f Document CachedStatement::discard. 2016-05-19 20:36:41 -05:00
John Gallagher
57d2ae42cf Fix clippy needless_borrow warning 2016-05-19 15:03:01 -05:00
John Gallagher
74b57ee47a Add test and fix for invalid cached column_count.
Issue raised in
https://github.com/jgallagher/rusqlite/pull/113#issuecomment-220122048.
2016-05-18 22:19:04 -05:00
John Gallagher
e71c3c5207 Add Connection::set_prepared_statement_cache_capacity. 2016-05-17 14:20:56 -05:00
John Gallagher
d923d8c670 Use a real LruCache instead of a VecDeque. 2016-05-17 13:35:23 -05:00
John Gallagher
20b93bdb96 rustfmt 2016-05-17 13:35:23 -05:00
John Gallagher
bd81b727f0 Simplify CachedStatement lifetimes 2016-05-17 13:35:21 -05:00
John Gallagher
3c15eb0218 Add Connection::prepare_cached. 2016-05-17 13:34:54 -05:00
John Gallagher
0ab9421e6a Detach StatementCache from Connection so we can embed it (coming later) 2016-05-17 11:59:54 -05:00
John Gallagher
1978568d01 Make StatementCache hold RawStatements instead of Statements. 2016-05-17 11:55:10 -05:00
John Gallagher
b76196ae1a Merge branch 'master' into gwenn-stmt-cache 2016-05-17 08:54:47 -05:00
John Gallagher
0a371b7145 Rename StatementCache::release -> cache_stmt 2016-01-07 11:30:51 -05:00
John Gallagher
7b29277d6f Use discard() instead of cacheable = false to avoid prevent cached
statements from returning to the cache.
2016-01-07 11:24:20 -05:00
John Gallagher
ed0923bba9 Update for RowIndex change 2016-01-07 11:20:42 -05:00
gwenn
68b4943a39 Add some doc 2015-12-19 17:14:06 +01:00
gwenn
5876be3d48 Add test with cacheable set to false 2015-12-19 17:01:06 +01:00
gwenn
cb1951c21a Fix borrowing 2015-12-19 16:56:41 +01:00
gwenn
7bdf80ccdb Introduce two distinct lifetime parameters. 2015-12-19 16:49:11 +01:00
Gwenael Treguier
30c8910d19 Still some lifetime problem... 2015-12-18 20:18:46 +01:00
Gwenael Treguier
85fb89b280 Fail to create a new CachedStatement. 2015-12-17 20:33:34 +01:00
Gwenael Treguier
109c26fea4 Replace LruCache by VecDeque. 2015-12-17 20:02:49 +01:00
Gwenael Treguier
ff02213b53 Introduce a RefCell in CachedStatement. 2015-12-16 20:10:31 +01:00
Gwenael Treguier
9257987b37 Try to introduce a CachedStatement struct. 2015-12-16 19:42:03 +01:00
Gwenael Treguier
880a78ae83 Partial fix following John suggestions. 2015-12-15 21:49:59 +01:00
Gwenael Treguier
d5faf2fab3 Merge branch 'master' of https://github.com/jgallagher/rusqlite into stmt-cache 2015-12-13 11:23:54 +01:00
Gwenael Treguier
7ab79d6de6 Add Failure documentation. 2015-12-06 19:57:20 +01:00
Gwenael Treguier
fa03bcd564 Fix use declaration. 2015-12-05 12:28:12 +01:00