Commit graph

360 commits

Author SHA1 Message Date
Ryan Leckey
55ffd989e1 postgres: add support for simple queries (that do not return results) 2020-03-11 01:43:17 -07:00
Ryan Leckey
7404708bab adjust Cursor::map to work through black magic hacks and hope we get GATs soon 2020-03-11 01:43:17 -07:00
Ryan Leckey
a374c18a18 postgres: rewrite protocol in more iterative and lazy fashion 2020-03-11 01:43:17 -07:00
Ryan Leckey
3795d15e1c postgres: break out TLS and SASL into their own files 2020-03-11 01:43:04 -07:00
Ryan Leckey
ea1a4fb042 add Cursor and rewrite Executor/Query over it
* this breaks a lot internally as-is
 * mysql needs a restructure
2020-03-11 01:43:04 -07:00
Ryan Leckey
bb17ebfbbd make Connect extend Connection to simplify bounds 2020-03-11 01:42:34 -07:00
Ryan Leckey
d3d58ef0cf remove unused methods from Arguments: is_empty, len, size 2020-03-11 01:42:34 -07:00
Ryan Leckey
05bc3ba987 Prepare v0.2.6 2020-03-10 15:40:33 -07:00
Wesley Norris
737dd038c5 Fix null bitmap being cleared 2020-03-09 20:31:49 -04:00
Vlad Stepanov
b785f83fc2 [fix] naming + unneeded cast 2020-03-01 18:02:36 +03:00
Vlad Stepanov
0656c880cc cargo fmt 2020-03-01 13:23:57 +03:00
Vlad Stepanov
b2f50de16f review fixes: change test attributes, fix tests, add time encoding-decoding tests 2020-03-01 13:20:24 +03:00
Vlad Stepanov
1975486baa cargo fmt 2020-03-01 00:05:14 +03:00
Vlad Stepanov
084add9cdb #115: implement time-rs support 2020-02-29 22:38:48 +03:00
Oliver Bøving
0de4b5186b Add the array types to the query! macro
This still needs some work, as the inferance and error messages are not
quite where we want them to be
2020-02-25 21:56:07 +01:00
Oliver Bøving
11b36fc7e5 Remove unused method extend on ArrayEncoder 2020-02-21 14:18:20 +01:00
Oliver Bøving
521570d8a7 Remember use std::marker::PhantomData 2020-02-21 14:16:02 +01:00
Oliver Bøving
c9c87b6081 Implement support for 1-dim arrays for PostgreSQL 2020-02-21 14:10:12 +01:00
Ryan Leckey
f8e112f4d9 Prepare v0.2.5 2020-02-01 00:49:27 -08:00
Ryan Leckey
7201f637bf Fix #104, need to advance buffer index to account for the null (one 32-bit length val of -1) 2020-02-01 00:33:59 -08:00
Austin Bonander
eff7c9e125
fix Pool to remove possibility of "leaking" connections (#84)
* fix `Pool` to reduce possibility of "leaking" connections

now uses RAII guards to control `SharedPool::size`

* add smoke test for `Pool` to both Postgres and MySQL tests

add `Pool::is_closed()`

* fix documentation re: pool

* refactor pool implementation to not use futures oneshot channels

https://github.com/launchbadge/sqlx/pull/84#issuecomment-580476223

* run cargo fmt

* Pool: remove superfluous guard struct, document some internal methods
2020-01-31 23:33:42 -08:00
Austin Bonander
2349978417 fix and test floats in MySQL 2020-01-30 12:17:32 -08:00
Jane Lusby
7d3772e23b Resolve PR comments 2020-01-22 20:49:22 -08:00
Jane Lusby
ea03fa47e7 Initial commit with doc_cfg changes 2020-01-22 13:10:10 -08:00
Ryan Leckey
24d6c696f8
Merge pull request #70 from launchbadge/ab/idents-fix
sqlx-macros: fix handling of invalid idents
2020-01-21 16:01:56 -08:00
Wesley Norris
1461891901 Fix passwords not being percent decoded
The password portion of the `Url` type is post-percent encoding
and needs to be manually decoded before processing and being
sent to the server.
2020-01-21 18:53:07 -05:00
Austin Bonander
d55e4568b8 fix build with tls and runtime-tokio features on 2020-01-21 12:24:54 -08:00
Austin Bonander
831ce2d615 fix build with TLS feature on 2020-01-21 11:57:01 -08:00
Austin Bonander
efed9b3d6d sqlx-macros: fix handling of invalid idents
add regression test with Trybuild

fix lint warnings as otherwise Trybuild wanted to include them
2020-01-21 01:52:57 -08:00
Jonas Platte
f93beb460a
Add PgTypeInfo::with_oid 2020-01-18 14:04:17 +01:00
Ryan Leckey
3e6efc57b6 Prepare v0.2.4 2020-01-18 01:22:14 -08:00
Ryan Leckey
60d45ac44b Fix (again) the handling of nulls in mysql and add an integration test for it 2020-01-18 01:20:26 -08:00
Ryan Leckey
ac9aeb2e26 Prepare v0.2.3 2020-01-18 00:47:26 -08:00
Ryan Leckey
d00c18ec75 Fix query! for the no results case in Postgres and MySQL 2020-01-18 00:43:59 -08:00
Ryan Leckey
3b91b06828 Prepare v0.2.2 2020-01-16 18:31:48 -08:00
Ryan Leckey
35c5556512 Update dependencies 2020-01-16 18:29:58 -08:00
Austin Bonander
beba141aec PgConnection: clear buffers after TLS upgrade 2020-01-16 13:30:48 -08:00
Ryan Leckey
d46acb0e0e default sqlx-core and sqlx-macros to runtime-async-std as well to make "cargo c" work during dev 2020-01-16 12:51:08 -08:00
Ryan Leckey
fe3225a8b8 Prepare v0.2.1 2020-01-16 01:52:47 -08:00
Daniel Akhterov
5ad09887e0 Fix mysql null bitmap not starting at bit 3 2020-01-16 01:44:20 -08:00
Ryan Leckey
62e1df5ad9 Prepare v0.2.0 2020-01-15 02:20:19 -08:00
Ryan Leckey
809bc3964c Run rustfmt 2020-01-15 01:34:20 -08:00
Ryan Leckey
ae4fcd1406 Work around bug with format! and await on stable 2020-01-15 01:32:16 -08:00
Ryan Leckey
daf7f6c556 Be explicit with features for docs.rs 2020-01-15 01:27:07 -08:00
Ryan Leckey
92f12e11aa Add support for Tokio 2020-01-15 01:17:33 -08:00
Ryan Leckey
96f14c0700 Merge remote-tracking branch 'origin/ab/proc-macro-unhack-sort-of' into rl-transaction-1 2020-01-15 00:29:43 -08:00
Ryan Leckey
6ddf3184de Run rustfmt 2020-01-15 00:27:19 -08:00
Ryan Leckey
2e5e273565 Fix Pool alias with Pool changes 2020-01-15 00:26:22 -08:00
Ryan Leckey
b1a27ddac2 Add a Transaction type to simplify dealing with Transactions 2020-01-15 00:22:01 -08:00
Austin Bonander
0fdb875c20 support arbitrary numbers of bind parameters in query!() et al 2020-01-15 00:05:34 -08:00
Ryan Leckey
28ed854b03 Extract Connection::open into a new trait Connect::connect 2020-01-14 23:58:17 -08:00
Ryan Leckey
3183413e9e
Merge pull request #50 from launchbadge/rl-refactor-types
Refactor HasSqlType to provide an array of compatible types
2020-01-14 23:32:45 -08:00
Ryan Leckey
6b22fb7489 Refactor HasSqlType to provide an array of compatible types.
* Intending to use in a new Row type to check types at runtime for
   dynamic queries and to guard against schema changes

 * Hoping the query! macro can utilize this to allow accepting N
   rust types for 1 sql type and returning N rust types for 1 sql
   type.
2020-01-14 23:27:42 -08:00
Austin Bonander
114aaa5dfc MySqlConnection: warn if server does not support SSL 2020-01-14 12:14:01 -08:00
Austin Bonander
fc66c8fa3f give examples of connection strings enabling SSL 2020-01-14 12:07:43 -08:00
Ryan Leckey
330b1e2b4e Fix serialization test for postgres 2020-01-14 10:43:54 -08:00
Ryan Leckey
0a5b527d79 fix import errors and run rustfmt 2020-01-14 10:35:50 -08:00
Ryan Leckey
cb1dbff544 mysql: if in a TLS stream, sha2 auth is just "send a clear text password" 2020-01-14 10:32:59 -08:00
Austin Bonander
6682d4dce7 Pool::new(): forward to connection types for string syntax 2020-01-13 20:43:32 -08:00
Austin Bonander
c92ee619c3 fix some behaviors with TLS in MySQL 2020-01-13 20:42:49 -08:00
Austin Bonander
a014accf08 document TLS options for MySQL 2020-01-13 14:58:37 -08:00
Austin Bonander
f04e4bdbeb document TLS options for Postgres 2020-01-13 14:54:29 -08:00
Austin Bonander
ff219061b2 implement TLS for MySQL 2020-01-13 12:34:05 -08:00
Austin Bonander
638852a2dd implement TLS support for Postgres 2020-01-13 11:52:09 -08:00
Ryan Leckey
fe98b0b612 Turn on neccessary feature flags of futures-channel and async-std 2020-01-11 04:06:33 -08:00
Ryan Leckey
1d20926189 Use '+00:00' over UTC for MySQL timezone 2020-01-11 03:54:04 -08:00
Ryan Leckey
9b50dccfce Run rustfmt 2020-01-11 03:52:17 -08:00
Ryan Leckey
c4a0ac50df Indicate that we support both forms of SCRAM (just always reject channel binding for now) 2020-01-11 03:52:12 -08:00
Ryan Leckey
4f28590def Downgrade generic-array to match digest 2020-01-11 03:35:38 -08:00
Daniel Akhterov
db230e2ce0 Resolve Comments
- Remove `hex` from root `Cargo.toml`
    - Make `hmac` crate optional
    - Clean up checking mechanisms for "SCRAM-SHA-256"
    - Use `str::from_utf8` instead of `String::from_utf8_lossyf
    - Update `Sasl*Response` structs be tuple structs
    - Factor out `len` in `SaslInitialResponse.encode()`
    - Use `protocol_err` instead of `expect` when constructing `Hmacf
      instances
    - Remove `it_connects_to_database_user` test as it was too fragile
    - Move `sasl_auth` function into `postgres/connection` as it more
      related to `Connection` rather than `protocl`
    - Return an error when decoding base64 salt rather than panicing
      in `Authentication::SaslContinue`
2020-01-11 03:33:38 -08:00
Daniel Akhterov
507d988fc4 Implememnt SASL Authentication 2020-01-11 03:33:21 -08:00
Ryan Leckey
fec6101e1a Use timeout over .timeout to stay off unstable 2020-01-11 03:31:55 -08:00
Ryan Leckey
619de5aac2 Update dependencies 2020-01-11 03:30:03 -08:00
Ryan Leckey
95fac72abf Use crossbeam queues to achieve fairness in the pool 2020-01-11 03:26:48 -08:00
Ryan Leckey
03251b719b Refactor pool to fix liveness and consistently check 2020-01-11 01:02:03 -08:00
Ryan Leckey
132f7b2944 Add test_on_acquire option to the Pool 2020-01-11 01:01:21 -08:00
Ryan Leckey
42d0a9bc3d has_columns is only used for postgres 2020-01-11 01:00:24 -08:00
Andrey Kuznetsov
e7026ce92d derive Debug for Pool 2020-01-10 23:36:50 +00:00
Kris
7464d35803 Check if enough bytes was received 2020-01-07 11:44:15 +01:00
Kris
bad21b1567 Build docs for all features (#32) 2020-01-06 23:57:55 -08:00
Ryan Leckey
6d525b23ed (cargo-release) sqlx-core: v0.1.3 2020-01-06 11:10:24 -08:00
Ryan Leckey
280f12ea71 Configure release.toml so we can easily release sub crates 2020-01-06 11:10:20 -08:00
Ryan Leckey
92f3f8cf6f Finish reallocation strategy for BufStream
Fixes #30
2020-01-06 10:53:56 -08:00
Ryan Leckey
5c532a8ecc [sqlx-core] prepare v0.1.2 2020-01-05 22:00:56 -08:00
Austin Bonander
589d06ec66 change UnexpectedEof to ConnectionAborted 2020-01-03 19:06:00 -08:00
Ryan Leckey
054d3ed838 Run rustfmt on auth_plugin 2020-01-03 17:55:34 -08:00
Ryan Leckey
d8df21e280 Tweak mysql connection to work with MariaDb
SECURE_CONNECTION has the wrong value in the mariadb docs and that had me stumped for too long
2020-01-03 17:53:24 -08:00
Ryan Leckey
8d8fea874a Use forbid(unsafe_code) over deny(unsafe_code) 2020-01-03 11:45:18 -08:00
Ryan Leckey
ed8cb40245 Remove more unused imports 2020-01-02 23:49:42 -08:00
Ryan Leckey
4ced4058ac Remove unused imports and a couple unused muts 2020-01-02 23:47:49 -08:00
Ryan Leckey
ce343dee9c [MySQL] Add initial support for authenticationSupports caching_sha2_password and sha256_password 2020-01-02 23:22:46 -08:00
Ryan Leckey
e591f0f021 Run rustfmt 2019-12-30 02:11:14 -08:00
Ryan Leckey
19e38ab8d3 [MySQL] [Postgres] Add support for BLOB and BYTEA types 2019-12-30 02:10:09 -08:00
Ryan Leckey
27759a12c7 [MySQL] Allow not specifying database on initial connect 2019-12-30 02:10:09 -08:00
Ryan Leckey
c325feaf9a [MySQL] Configure connection on open 2019-12-30 02:10:09 -08:00
Ryan Leckey
2a42ff9f0d [MySQL] Add an integration tests for chrono + MySQL and fix issues 2019-12-30 02:10:09 -08:00
Ryan Leckey
e161787952 [MySQL] Rename ty.flag to ty.is_unsigned 2019-12-30 02:10:09 -08:00
Ryan Leckey
3a645a1824 [MySQL] Don't adjust the raw bytes coming to the Decode trait
This is a minor adjustment that keeps parity between Encode and Decode
2019-12-30 02:10:09 -08:00
Ryan Leckey
2068f05482 Update dependencies 2019-12-28 04:02:52 -08:00
Ryan Leckey
5e719917c0 Run rustfmt 2019-12-28 03:45:47 -08:00
Ryan Leckey
f67872cbcf Add some ground work for #1 2019-12-28 03:45:37 -08:00
Ryan Leckey
86ac601872 Prepare v0.1.1 2019-12-28 02:42:51 -08:00
Austin Bonander
c98c49ad47 fix docs and guarantees for pool 2019-12-28 02:02:29 -08:00
Ryan Leckey
dc43d3ee2f Merge branch 'master' of ssh://github.com/mehcode/sqlx 2019-12-28 01:01:50 -08:00
Ryan Leckey
e16c043bf9 Add basic docs to MySql and Postgres Connection 2019-12-28 01:01:45 -08:00
Austin Bonander
af4b5b753d fixup docs for Query/QueryAs/Executor 2019-12-28 00:56:55 -08:00
Ryan Leckey
7b8ef0f46b Add more authors 2019-12-28 00:36:37 -08:00
Ryan Leckey
ef98ff2828 Add repo/desc to sub crates 2019-12-28 00:25:04 -08:00
Ryan Leckey
98269ddd20 Fix several nits from Clippy and add back chrono support for MySql 2019-12-27 23:16:13 -08:00
Ryan Leckey
9b0f34b0ce Fix a couple minor nits with Pool and run rustfmt 2019-12-27 22:47:25 -08:00
Ryan Leckey
a23bfb60eb Clean up the example a touch 2019-12-27 21:50:13 -08:00
Ryan Leckey
017ee38725 De-duplicate error impls and forward MySqlConnection/PgConnection to crate root 2019-12-27 21:50:13 -08:00
Austin Bonander
7d745f98ea implement query_as!() et al, document query macros 2019-12-27 21:45:31 -08:00
Ryan Leckey
56a82346f2 Run cargo fmt 2019-12-27 20:44:03 -08:00
Ryan Leckey
d76b1357da Audit MySql and Postgres protocols 2019-12-27 17:31:01 -08:00
Austin Bonander
b85618e5f8 fix errors from .send_raw() additions that I didn't catch 2019-12-19 23:26:59 -08:00
Austin Bonander
892a179787 set default max_lifetime in pool::Options to 30 minutes and explain why 2019-12-19 23:26:59 -08:00
Austin Bonander
786deecc36 replace bitflags::_core with std
for some reason IntelliJ-Rust reaches for this first
2019-12-19 18:46:37 -08:00
Austin Bonander
5192983093 implement Executor::send() 2019-12-19 18:46:37 -08:00
Austin Bonander
56875a8931 finish discussed refactors 2019-12-18 23:02:01 -08:00
Austin Bonander
8aa931356f WIP implement statement caching for MySQL, perform discussed refactors 2019-12-18 23:02:01 -08:00
Austin Bonander
e11f5bcaa7 allow chrono to be used with query!() 2019-12-18 23:02:01 -08:00
Austin Bonander
d8d93867b7 implement prepared statement caching for postgres 2019-12-18 23:02:01 -08:00
Austin Bonander
ca3fbd740a implement support for chrono
fix tests
2019-12-11 19:59:41 -08:00
Daniel Akhterov
918657638b Test all number types and String type 2019-12-05 21:36:09 -08:00
Daniel Akhterov
fdd60eb9b1 Fix null_bitmap size in MariaDb 2019-12-05 19:39:28 -08:00
Daniel Akhterov
6cac5383e3 Fix renamed functions/ response types 2019-12-05 18:29:35 -08:00
Austin Bonander
b0a36ddd5c fix Executor::describe() for MariaDB
prevent exhaustive match of `describe` structs
2019-12-04 18:13:10 -08:00
Daniel Akhterov
4d28424af5 Fix maraidb build errors 2019-12-04 14:18:43 -08:00
Austin Bonander
193e79569a query refactors 2019-12-04 13:30:19 -08:00
Austin Bonander
acca40c88e make query!() output anonymous records 2019-12-03 21:30:53 -08:00
Ryan Leckey
871183d23b Minor fixes and run rustfmt 2019-12-03 00:22:02 -08:00
Ryan Leckey
f16c805f4c Try and trim down the features a bit 2019-12-03 00:14:59 -08:00
Ryan Leckey
9558ab1c50 Remove bytes usage and update dependencies 2019-12-02 23:26:44 -08:00
Ryan Leckey
bf4f65ea2f [MySQL] Add fetch_optional, fix encode/decode for integers 2019-12-02 22:14:41 -08:00
Ryan Leckey
6925d5999c Fix mariadb compile errors and remove useless Row wrapper 2019-12-02 21:11:49 -08:00
Daniel Akhterov
55da9daaf1 WIP: MariaDb fetch 2019-12-02 20:47:38 -08:00
Ryan Leckey
f8f71b1b70 Merge remote-tracking branch 'origin/ab/conn-timeout' 2019-11-27 23:31:24 -08:00
Ryan Leckey
2227303f20 Have Backend require Executor and de-duplicate some logic 2019-11-27 23:26:20 -08:00
Daniel Akhterov
56ca61a22e WIP: MariaDb fetch 2019-11-27 20:19:53 -08:00
Ryan Leckey
f1fa802837 Allow Query::bind to forward the type inference used for FromRow 2019-11-27 15:21:29 -08:00
Austin Bonander
279e329f27 break up pool.rs into multiple files 2019-11-26 10:12:47 -08:00
Austin Bonander
8d9e949cc2 implement pool idle reaper, format relevant files 2019-11-26 10:09:59 -08:00
Austin Bonander
e155aa7aea implement pool closing 2019-11-26 10:09:59 -08:00
Austin Bonander
812c0bee61 implement connection timeouts 2019-11-26 10:09:59 -08:00
Ryan Leckey
73ca673bf2 Integrate FromRow while maintaining type fallback for query! 2019-11-25 23:51:04 -08:00
Ryan Leckey
b87edd5a9a Unify sqlx::CompiledSql and sqlx::SqlQuery into sqlx::Query as a common return type between sqlx::query and sqlx::query! 2019-11-22 22:41:37 +00:00
Ryan Leckey
b14d3da2ee Add sqlx::Row
- Rename the existing trait to an internal RawRow trait
 - Row is used for selecting a dyn and deferring pulling its values out till later
 - FromSqlRow -> FromRow
2019-11-22 18:34:29 +00:00
Austin Bonander
4d033963ce use protocol_err! instead of InvalidData in more places 2019-11-22 17:57:00 +00:00
Austin Bonander
905320ff39 return Error::Protocol instead of io::ErrorKind::InvalidData 2019-11-22 17:33:44 +00:00
Austin Bonander
a9fb263520 simplify pool implementation, run rustfmt 2019-11-22 17:06:32 +00:00
Ryan Leckey
8bd768afe8
Merge pull request #24 from mehcode/ab/codec
rename `FromSql/ToSql` -> `Decode/Encode`
2019-11-22 13:40:45 +00:00
Ryan Leckey
f394acdb1c Minor cargo.toml cleanup 2019-11-22 11:52:03 +00:00
Ryan Leckey
061b7819ab Remove the RawConnection concept and fold into Backend 2019-11-22 11:48:49 +00:00
Austin Bonander
d332558b25 rename FromSql/ToSql -> Decode/Encode
closes #18
2019-11-22 11:05:17 +00:00
Austin Bonander
fc07830639 implement facade crate so macros can be used from same namespace 2019-11-22 10:30:16 +00:00
Ryan Leckey
04f56570a4 Collapse into 1 crate 2019-07-25 23:41:50 -07:00
Ryan Leckey
aa0b27af35 Minor clean up 2019-06-28 21:36:46 -07:00
Ryan Leckey
5c73e220b6 Set up a connection benchmark using a mocked pg server 2019-06-26 12:49:08 -07:00
Ryan Leckey
22f71df7c7 mason -> sqlx 2019-06-22 20:54:43 -07:00