Commit Graph

86 Commits

Author SHA1 Message Date
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
0d0a7bf81f Replace row changes/count type (i32) with usize
Breaking change
2018-05-23 21:23:28 +02:00
gwenn
5c44ed79d3 Fix tests 2018-05-23 20:18:18 +02:00
gwenn
89f38b4098
Merge pull request #352 from jgallagher/fix-coherence-issue
merge coherence issue fix
2018-05-12 10:30:57 +02:00
gwenn
994d40da26 Fix clippy warnings 2018-05-04 19:55:55 +02: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
aa64e2fb33 Remove potentially conflicting impl of ToSqlOutput.
Replace with manual implementations of all the types we provided impls
for before.
2017-12-05 19:40:09 -05:00
John Gallagher
4bfbb5f1fe Fix handful of clippy warnings. 2017-11-17 11:37:23 -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
498faac4db Merge branch 'clippy' of https://github.com/gwenn/rusqlite into gwenn-clippy 2017-11-12 16:27:42 -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
gwenn
148dc0baf0 Fix more clippy warnings 2017-08-18 21:26:44 +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
John Gallagher
3827a835ef Add ToSql impls for str and [u8]. 2017-05-29 11:20:52 -04:00
gwenn
08f96a678e Rustfmt 2017-04-07 19:43:24 +02:00
John Gallagher
a1206d5076 Add FromSql/ToSql impls for isize. 2017-04-05 12:52:37 -04: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
60e1f3c02f Add more explicit types in unit tests. 2017-02-05 17:30:53 -05:00
John Gallagher
8054ea4ab8 Derive Clone, Debug, and PartialEq on ToSqlOutput. 2017-01-26 22:02:20 -05:00
reddraggone9
57750fe6a6 Fix doc comment example of FromSql/ToSql
Update a doc test so that it compiles on master. Also remove the ignore
directive so that it runs with the rest of the test suite.
2017-01-24 22:57:42 -06:00
John Gallagher
06583aadf2 fix clippy warnings 2017-01-23 19:46:49 -05:00
John Gallagher
aa6c542202 Add impl ToSql for ToSqlOutput. 2017-01-23 19:42:02 -05:00
John Gallagher
7c072bf55e impl ToSql for i8,i16,u8,u16,u32 2017-01-22 19:55:49 -05:00
John Gallagher
846a59695c Add range-checked FromSql impls for i8, i16, u8, u16, u32. 2017-01-22 19:40:48 -05:00
John Gallagher
1974ee573c Add range checks for i32's FromSql impl. 2017-01-22 19:26:19 -05:00
John Gallagher
4c8b0ab6dd Merge pull request #181 from gwenn/clippy
Fix clippy warnings
2016-12-31 01:23:40 -05:00
John Gallagher
2e140d0684 FromSqlError::cause() returns other error's cause directly (possibly None). 2016-12-31 00:36:52 -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
b10c52f32f Fix clippy warnings 2016-08-08 15:23:55 +02:00
gwenn
95050f10a8 Add test with empty blob (issue #174). 2016-06-13 20:22:21 +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
bafa85a1a0 Fix clippy warnings. 2016-05-26 00:30:01 -04:00
John Gallagher
f3693a993e rustfmt 2016-05-26 00:28:18 -04:00
John Gallagher
9a6e17b478 Add doc comments to ToSqlOutput. 2016-05-26 00:14:46 -04:00
John Gallagher
13bff6fab6 Add ToSql impl for bool. 2016-05-26 00:14:45 -04:00
John Gallagher
9125826534 Move types::Value into its own module. 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
8adb96131b Remove now-unnecessary FFI re-exports. 2016-05-25 19:53:18 -04:00
John Gallagher
2f4990dafd Rename BorrowedValue -> ValueRef. 2016-05-24 21:34:18 -04:00