Commit Graph

157 Commits

Author SHA1 Message Date
Steven Fackler
bb837bd872 Make the default notifications iterator read nonblocking
It is always super confusing as to when a notification that's been sent
to the client will actually show up in the old version of this iterator,
so it's best to have it see if there's anything waiting in the TCP
buffer.

Closes #149
2015-12-27 10:15:49 -07:00
Steven Fackler
278ee1cfd7 Drop WrongType variant
Following the tradition of WasNull
2015-12-26 22:05:23 -07:00
Steven Fackler
4f37625cd6 Shorten error variant names
No reason to repeat Error
2015-12-25 20:14:09 -07:00
Steven Fackler
fe14c82541 Remove Error::InvalidColumn
Change get_opt to return an Option<Result<T>> as its name would hint
2015-12-25 19:32:51 -07:00
Steven Fackler
8fac512919 Make DbError fields public
All of them are directly exposed via accessors and the internal
representation is never realistically going to change. A single private
field allows for expansion in the future.
2015-12-12 20:30:50 -08:00
Steven Fackler
9d8b009aea Wait for thread termination in cancel_query test 2015-12-06 23:39:40 -08:00
Steven Fackler
47f9a660de Make cancel_query take a ref
Even though CancelData is Copy it's a bit weird for a function to take
ownership when it doesn't need to.
2015-12-06 23:38:26 -08:00
Steven Fackler
7ea10a151e Remove deprecated methods in tests 2015-12-06 23:35:28 -08:00
Steven Fackler
811b0ffde9 Restructure SslMode
This is a large breaking change but makes things make way more sense
2015-12-06 23:35:28 -08:00
Steven Fackler
736f530ae9 Add Connection::query
Same deal as Connection::execute - a bit cheaper than preparing and
executing the statement normally.
2015-12-06 23:35:28 -08:00
Steven Fackler
fcc2768434 Second half of infrastructure for Connection::query
There are weird dropck issues introduced here that require those extra
semicolons in the test code.
2015-12-06 23:35:28 -08:00
Steven Fackler
58bb6c0e9a Remove rows::IntoIter
It's incompatible with Connection::query
2015-12-06 23:35:28 -08:00
Steven Fackler
0e6b03d06b Use a smaller crate for hex stuff
It's really overkill to pull in rustc_serialize just for hex conversions
2015-12-06 14:28:12 -08:00
Steven Fackler
cc4441f958 Cleanup 2015-12-06 13:35:52 -08:00
Steven Fackler
d77577eaaa Support BIT/VARBIT to BitVec
Closes #148
2015-12-06 12:40:12 -08:00
Steven Fackler
a217c5cd00 NegotiateSsl implementation for security_framework 2015-12-05 14:35:17 -08:00
Steven Fackler
d3182d96a6 Update serde support 2015-11-07 16:32:16 -08:00
Steven Fackler
78818f9fb0 Handle errors when running copy statements 2015-10-23 22:55:39 -07:00
Steven Fackler
01153f784a Add a notifications iterator that waits with a timeout
Closes #105
2015-10-20 23:13:45 -07:00
Mathieu Rheaume
f5ee8686ae To_String() cleanup for to_owned on method calls 2015-09-28 01:19:02 -04:00
Steven Fackler
8b80eba9ed Add a name accessor to Type
Also fix up some misentered type info and add a test to ensure it's
correct.
2015-09-26 22:59:40 -07:00
Steven Fackler
f551a86c0f Expose containing schema for custom types 2015-09-26 22:59:40 -07:00
Steven Fackler
a2609f6c90 Refactor notification API 2015-09-18 22:51:11 -07:00
Steven Fackler
008f14b459 Move notification stuff to its own module 2015-09-18 20:55:01 -07:00
Steven Fackler
03150f4cae Overhaul the copy_out API
Returning a Reader ends up with a really weird user experience where you
have to make sure to drop it before making any other calls and it has to
internally fast forward to the end of the data even if the user drops it
early. Simply taking a Writer that all data is pushed into is
sigificantly more straightforward.
2015-09-15 23:11:14 -07:00
Steven Fackler
6e99874bd9 Add COPY TO STDOUT support.
Closes #51
2015-08-15 23:21:39 -07:00
Steven Fackler
dc2f04de96 Start work on COPY TO statements 2015-08-15 20:39:13 -07:00
Jonathan Reem
4b545ca466 Implement ToSql for &'a T where T: ToSql
This allows more flexible use of ToSql in generic contexts by allowing
references to be used for encoding.
2015-08-03 13:32:44 -07:00
Steven Fackler
64de6abb1e Look up column names case insensitively
It tries a case sensitive comparison first so all existing uses should
continue to be OK. It should really have some form of unicode awarenes
but it's unclear exactly what. The JDBC driver uses the US locale when
lowercasing and libpq uses tolower with the system locale.

Closes #136
2015-07-30 22:04:22 -07:00
Steven Fackler
913678e9bf Properly return ioerrors to the caller in copy_in 2015-06-12 00:39:12 -07:00
Steven Fackler
0883918f06 Allow direct indexing of Rows. 2015-06-07 09:15:52 -07:00
Mark Lee
bbebf83749 Fix typos in tests' panic messages 2015-06-03 22:04:15 -07:00
Steven Fackler
f72bc4303a Hide Type constructor 2015-05-26 21:47:42 -07:00
Steven Fackler
f800835456 Move error types to error module 2015-05-25 22:47:25 -07:00
Steven Fackler
417fb09b13 Un-reexport some type-related types 2015-05-25 22:09:00 -07:00
Steven Fackler
9b9b82a7db Add copy_in to Statement 2015-05-25 20:40:57 -07:00
Steven Fackler
b5d9a38a59 Remove CopyInStatement
The API's awful to use.
2015-05-23 08:13:17 -07:00
Steven Fackler
35197960b2 Restructure errors
WasNull and BadResponse are gone, and Conversion was added. IoError
covers the BadResponse case and Conversion is a more general version of
WasNull.
2015-05-22 21:21:30 -07:00
Steven Fackler
ed26ff0042 Merge branch 'breaks' 2015-05-16 20:42:25 -07:00
Steven Fackler
0d63eeba50 Add optional chrono support 2015-05-13 22:25:43 -07:00
Steven Fackler
26e55ff2bc Change negotiate_ssl back to taking &self
It's not clear that &mut is necessary and it makes connection calls a
bit nicer looking.
2015-05-13 15:17:37 -07:00
Steven Fackler
f957f10b19 Use a Box<NegotiateSsl> instead of a default param
Default parameter's aren't used in type inference yet, so the old setup
would result in overly verbose things like &mut SslMode::None::<NoSsl>.
In the future we can add the parameter back with a default of
Box<NegotiateSsl> to avoid forcing people to box stuff.
2015-05-13 15:14:37 -07:00
Steven Fackler
bf4820375d Make openssl an optional dependency 2015-05-13 14:43:39 -07:00
Steven Fackler
be49982286 Make SSL infrastructure implementation agnostic 2015-05-13 14:42:22 -07:00
Steven Fackler
569ff870c2 Properly escape table and column names in prepare_copy_in
We have to assemble queries by hand here which is a bit sketchy.
Manually escaping the individual identifiers to avoid introducing
injection vulernabilities is unfortunate but necessary.
2015-05-05 21:57:06 -07:00
Steven Fackler
cd5537f803 Rename get_transaction_isolation to transaction_isolation 2015-04-24 22:10:57 -07:00
Steven Fackler
afb3bcf08b Fix url breakage 2015-04-22 22:09:07 -07:00
Steven Fackler
8b43f0e3cf Add methods to access the session transaction isolation level
Closes #115
2015-04-22 22:03:09 -07:00
Steven Fackler
411a8c495c Fix percent-encoded usernames and passwords
Closes #113
2015-04-15 20:31:38 -07:00
Steven Fackler
62459f6944 Support serde's JSON type 2015-04-12 21:48:38 -07:00