Commit Graph

479 Commits

Author SHA1 Message Date
gwenn
403e840c4a Fix clippy warnings 2018-05-04 19:05:48 +02:00
gwenn
b0e22fc372 Wait in a loop 2018-05-04 18:07:11 +02:00
gwenn
fee4bfcc86 Merge remote-tracking branch 'jgallagher/master' into unlock-notify 2018-05-04 18:06:41 +02:00
gwenn
83775ee62d Remove second field from RawStatement
Use sqlite3_db_handle instead
2018-04-03 20:18:51 +02:00
gwenn
7f6d7f3346
Merge pull request #319 from traviscross/fix/datetime-format-rfc3339
Fix date/time format for SQLite, use RFC 3339
2018-04-03 19:45:44 +02:00
gwenn
a0151f9073 Introduce is_locked 2018-03-31 10:22:19 +02:00
gwenn
cccdf9735f Factorize check on code returned by prepare/step. 2018-03-27 21:49:09 +02:00
gwenn
78511d6257
Merge pull request #334 from gwenn/stmt-cache
Fix statement cache
2018-03-27 21:26:42 +02:00
gwenn
50d379b564 Make Statement::column_index case insensitive
Fix #330
2018-03-27 20:07:46 +02:00
gwenn
83c8db2d21 Fix Connection::open documentation (#332) 2018-03-24 10:58:42 +01:00
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
gwenn
c612a44207 Fix errors relative to OpenFlags
Also handle extended error codes.
2018-03-24 10:15:10 +01:00
gwenn
5fd76aa54b Unlock notification
Test added
2018-03-24 08:06:30 +01:00
gwenn
154a70d41b WIP: Unlock Notification
To be tested
2018-03-24 08:06:30 +01:00
gwenn
455e7d4060 WIP: Unlock Notification
To do: unlock_notify_cb
2018-03-24 08:06:30 +01:00
gwenn
5d91fb088f Unlock notification 2018-03-24 08:03:21 +01:00
gwenn
0b85c5a1f2
Merge pull request #266 from gwenn/hooks
Implementation of sqlite3_update_hook #260
2018-03-24 07:33:29 +01:00
gwenn
718b985d86
Merge pull request #338 from gwenn/future-compatibility
Fix tyvar_behind_raw_pointer warnings
2018-03-24 03:14:16 +01:00
gwenn
3b5e224f82 Fix tyvar_behind_raw_pointer warnings 2018-03-10 18:07:30 +01: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
96103b0662 Merge remote-tracking branch 'jgallagher/master' into hooks 2018-01-20 10:08:40 +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
Travis Cross
5d8a840b5d Fix date/time format for SQLite, use RFC 3339
We implement `ToSql` and `FromSql` for `time::Timespec` values.  Our
documentation indicates that we store the value in the same format
used by SQLite's built-in date/time functions, but this was not
correct.

We were using the format:

    %Y-%m-%d %H:%M:%S:%f %Z

This format cannot be interpreted at all by SQLite's built-in
date/time functions.  There are three reasons for this:

- SQLite supports only two timezone formats: `[+-]HH:MM` and the
  literal character `Z` (indicating UTC)

- SQLite does not support a space before the timezone indicator

- SQLite supports a period (`.`) between the seconds field and the
  fractional seconds field, but not a colon (`:`)

SQLite does support the RFC 3339 date/time format, which is standard
in many other places.  As we're always storing a UTC value, we'll
simply use a trailing `Z` to indicate the timezone, as allowed by RFC
3339.  The new format is:

    %Y-%m-%dT%H:%M:%S.%fZ

To avoid breaking applications using databases with values in the old
format, we'll continue to support it as a fallback for `FromSql`.

[1] https://www.sqlite.org/lang_datefunc.html
[2] https://tools.ietf.org/html/rfc3339
2017-12-24 22:15:31 +00:00
John Gallagher
4bfbb5f1fe Fix handful of clippy warnings. 2017-11-17 11:37:23 -07:00
John Gallagher
5f800eb285
Merge pull request #306 from jgallagher/twistedfall-master
Export RowIndex trait to allow external code to be generic over what can index be
2017-11-13 11:33:12 -07:00
John Gallagher
ccf9e6fe6c Merge branch 'master' of https://github.com/twistedfall/rusqlite into twistedfall-master 2017-11-13 08:30:29 -07:00
John Gallagher
6b81979eea Merge branch 'master' of https://github.com/lgarczyn/rusqlite into lgarczyn-master 2017-11-13 08:27:33 -07:00
John Gallagher
217e12fcee
Merge pull request #304 from jgallagher/gwenn-clippy
Fix some clippy warnings
2017-11-13 08:23:52 -07:00
John Gallagher
498faac4db Merge branch 'clippy' of https://github.com/gwenn/rusqlite into gwenn-clippy 2017-11-12 16:27:42 -07:00
John Gallagher
d000aa52d7 Merge branch 'flush_prepared_cached' of https://github.com/edelangh/rusqlite into edelangh-flush_prepared_cached 2017-11-12 16:23:59 -07:00
John Gallagher
4852d826c8 Merge branch 'update-deps' of https://github.com/oherrala/rusqlite into oherrala-update-deps 2017-11-12 15:07:31 -07:00
John Gallagher
08228ec7c6
Merge pull request #283 from king6cong/master
code indent
2017-11-12 15:03:31 -07:00
John Gallagher
b5f57c14c5
Merge pull request #276 from cactorium/master
Add Other variant for the Error type
2017-11-12 15:02:41 -07:00
Ossi Herrala
28d58529b7 Update dependencies
* Gcc crate has been renamed to cc.
* Chrono::UTC has been renamed to Chrono::Utc.
* bitflags 1.0 uses associated constants. So prefix OpenFlags.
2017-10-09 23:25:40 +03:00
Pro
c08ee8be82 Export RowIndex trait to allow external code to be generic over what can index be 2017-09-20 15:34:06 +02:00
edelangh
ab643c90ce review panic in InnerConnection.drop 2017-09-06 16:50:21 +02:00
gwenn
148dc0baf0 Fix more clippy warnings 2017-08-18 21:26:44 +02:00
edelangh
0d1907887e add cfg for test 2017-07-20 16:40:24 +02:00
gwenn
f7c1a8e7b8 Fix some clippy warnings 2017-07-19 21:26:39 +02:00
edelangh
bdd4f9a1a9 Added drop for Connection to prevent fd leak
Added call to flush_prepared_statement_cache
otherwise InnerConnection receives DatabaseBusy on sqlite3_close
2017-07-19 12:22:31 +02:00
louis
301634add7 fixed timezone issue 2017-07-18 09:56:02 -06:00
louis
6188a6a97c added more tests 2017-07-18 17:46:49 +02:00
louis
8bc97972f8 fixed %F instead of %F:%s 2017-07-18 17:43:25 +02:00
louis
0a114c4436 Fixed loss of time information during string conversion 2017-07-11 17:15:07 +02:00
louis
0d001583b2 Fixed loss of time information during string conversion 2017-07-11 17:01:25 +02:00
king6cong
13a32e4004 code indent 2017-06-02 17:19:39 +08:00
Kelvin Ly
dde762bf0e Rename Error::Other to Error::ToSqlConversionFailure 2017-05-30 19:22:14 -04:00
John Gallagher
20de96083a Merge pull request #280 from jgallagher/to-sql-str-u8
Add ToSql impls for str and [u8].
2017-05-29 13:39:35 -04:00
John Gallagher
3827a835ef Add ToSql impls for str and [u8]. 2017-05-29 11:20:52 -04:00