Commit Graph

35 Commits

Author SHA1 Message Date
gwenn
d962ebab55
Merge pull request #325 from rnewman/rnewman/panic
Add DropBehavior::Panic to enforce intentional commit or rollback.
2018-03-24 10:29:02 +01:00
Richard Newman
2a03c1ad4d Add DropBehavior::Panic to enforce intentional commit or rollback. 2018-01-11 16:52:32 -08:00
Travis Cross
7e280d4e64 Add comment to justify &mut Connection in Transaction
The `Transaction` implementation never actually mutates the
`Connection` reference we give it.  In fact, the `Transaction`
structure itself only requires an immutable connection.  So it can be
surprising to readers that the constructor requires a `&mut
Connection`.  We do this so as to prevent at compile-time nested or
concurrent transactions on the same connection as these are not
allowed by SQLite.

In this commit, we add a comment explaining this nuance.
2017-12-31 10:30:23 +00:00
gwenn
08f96a678e Rustfmt 2017-04-07 19:43:24 +02:00
John Gallagher
60e1f3c02f Add more explicit types in unit tests. 2017-02-05 17:30:53 -05:00
gwenn
8f28ff17b8 Fix rustdoc warnings 2016-08-15 12:41:15 +02:00
gwenn
b10c52f32f Fix clippy warnings 2016-08-08 15:23:55 +02:00
John Gallagher
7c0eba0475 Add since and note for all deprecation tags. 2016-05-29 20:36:20 -04:00
gwenn
f817ec86bc Use new Rust 1.9 attribute: #[deprecated]. 2016-05-26 21:16:09 +02:00
John Gallagher
71aa41c27a rustfmt 2016-05-19 20:04:33 -05:00
John Gallagher
cacda916f9 Fix doctest failures on rust nightly.
These should've been failing on stable too as they were all wrong.

Closes #154.
2016-05-19 14:25:39 -05:00
John Gallagher
703cf22b52 Separate Savepoint out from Transaction.
Replaces `set_commit` and `set_rollback` with `set_drop_behavior`.

Allows specification of savepoint names.

Savepoint::rollback() does not consume the savepoint;
Transaction::rollback() does consume the transaction.
2016-05-18 16:38:09 -05:00
John Gallagher
678b301494 Make rollback take (&mut self) instead of (self) 2016-05-18 14:25:57 -05:00
John Gallagher
599bf5acfe Add test and fix for nested savepoint rollbacks.
This requires giving savepoints distinct names.
2016-05-17 20:19:44 -05:00
John Gallagher
92834951e3 Make the creation of transactions and savepoints take &mut self.
Transactions in SQLite are nested, but the previous API allowed rusqlite
transaction wrappers to be created as "siblings". This resulted in
unexpected (and usually wrong) behavior.
2016-05-17 19:53:53 -05: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
f529d130b9 Rustfmt 2016-02-02 19:12:00 +01:00
John Gallagher
6bcc3edccd BREAKING CHANGE: Remove common prefix on TransactionBehavior case names. 2015-12-12 14:22:50 -05:00
John Gallagher
3d15a8a15c Rename SqliteTransaction* -> Transaction*. 2015-12-12 14:17:43 -05:00
John Gallagher
eb60bb3111 Rename SqliteResult -> Result. 2015-12-12 14:06:03 -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
a1f1480b18 Run rustfmt on all crate files 2015-12-10 16:48:09 -05:00
John Gallagher
03be8e0cd6 Make query_row a synonym for query_row_safe.
This is a breaking change for anyone using `query_row`. To update code
that used the old `query_row`, you must now `.unwrap()` the returned
result.
2015-05-04 20:12:18 -04:00
John Gallagher
038d30e2c8 Remove unstable features for Rust-1.0-beta 2015-04-03 14:48:35 -05:00
John Gallagher
5e04b98840 Updates to track rustc nightly 2015-04-03 08:32:11 -05:00
John Gallagher
632d87de2f Remove most uses of #[feature(core)] 2015-03-17 00:55:28 -04:00
John Gallagher
1dc78b66da SqliteConnection::open takes a std::path.
Add new constructors, `open_in_memory` and `open_in_memory_with_flags`,
for opening in-memory databases.

Closes #13.
2015-02-06 20:07:23 -05:00
John Gallagher
5902b9106c sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-05 10:59:55 -05:00
John Gallagher
678fd0f3a3 Add #[deriving(Copy)] as appropriate 2014-12-23 12:22:05 -05:00
John Gallagher
f2c6389601 Track changes in rust-nightly 2014-11-19 10:48:40 -05:00
John Gallagher
b34f255aac Add documentation 2014-11-03 17:11:00 -05:00
John Gallagher
949260046c Change query_row to unwrap the SqliteResult 2014-10-28 15:14:52 -04:00
John Gallagher
68e9d81283 Rename transaction mode to behavior to match SQLite docs 2014-10-23 17:57:02 -04:00
John Gallagher
ca3a0f0580 Initial commit 2014-10-19 19:56:41 -04:00