PackageTrack
Sign in Get early access

sqlx-rt

Runtime abstraction used by SQLx, the Rust SQL toolkit. Not intended to be used directly.

0.6.3 22M downloads/mo #1971 most downloaded on crates.io launchbadge/sqlx

What this package is like to depend on

Last release 3 years ago

no release in 18 months

Ships fairly regularly

a new release about every 2 months

Most releases are documented

notes for 16 of 18 stable releases

2 versions withdrawn

withdrawn after publishing

6 years old

20 releases · first in 2020

0 releases in the last 12 months

see the full history below

Release timeline

20 releases · Jul 2020 to Mar 2023
2021 2022 2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 20
  1. 0.6.3 21 Mar 2023
    Release notes

    This is a hotfix to address the breakage caused by transitive dependencies upgrading to syn = "2".

    We set default-features = false for our dependency on syn = "1" to be good crates.io citizens, but failed to enable the features we actually used, which went undetected because we transitively depended on syn with the default features enabled through other crates, and so they were also on for us because features are additive.

    When those other dependencies upgraded to syn = "2" it was no longer enabling those features for us, and so compilation broke for projects that don't also depend on syn = "1", transitively or otherwise.

    There is no PR for this fix as there was no longer a dedicated development branch for 0.6, but discussion can be found in issue #2418.

    As of this release, the 0.7 release is in alpha and so development is no longer occurring against 0.6. This fix will be forward-ported to 0.7.

    Open source →
  2. 0.6.2 14 Sep 2022
    Release notes

    25 pull requests were merged this release cycle.

    Added

    • [#1081]: Add try_from attribute for FromRow derive [[@zzhengzhuo]]
      • Exemplifies "out of sight, out of mind." It's surprisingly easy to forget about PRs when they get pushed onto the second page. We'll be sure to clean out the backlog for 0.7.0.
    • [#2014]: Support additional SQLCipher options in SQLite driver. [[@szymek156]]
    • [#2052]: Add issue templates [[@abonander]]
    • [#2053]: Add documentation for IpAddr support in Postgres [[@rakshith-ravi]]
    • [#2062]: Add extension support for SQLite [[@bradfier]]
    • [#2063]: customizable db locking during migration [[@fuzzbuck]]

    Changed

    • [#2025]: Bump sqlformat to 2.0 [[@NSMustache]]
    • [#2056]: chore: Switch to sha1 crate [[@stoically]]
    • [#2071]: Use cargo check consistently in prepare [[@cycraig]]

    Fixed

    • [#1991]: Ensure migration progress is not lost for Postgres, MySQL and SQLite. [[@crepererum]]
    • [#2023]: Fix expansion of #[sqlx(flatten)] for FromRow derive [[@RustyYato]]
    • [#2028]: Use fully qualified path when forwarding to #[test] from #[sqlx::test] [[@alexander-jackson]]
    • [#2040]: Fix typo in FromRow docs [[@zlidner]]
    • [#2046]: added flag for PIPES_AS_CONCAT connection setting for MySQL to fix #2034 [[@marcustut]]
    • [#2055]: Use unlock notify also on sqlite3_exec [[@madadam]]
    • [#2057]: Make begin,commit,rollback cancel-safe in sqlite [[@madadam]]
    • [#2058]: fix typo in documentation [[@lovasoa]]
    • [#2067]: fix(docs): close code block in query_builder.rs [[@abonander]]
    • [#2069]: Fix prepare race condition in workspaces [[@cycraig]]\
      • NOTE: this changes the directory structure under target/ that cargo sqlx prepare depends on. If you use offline mode in your workflow, please rerun cargo install sqlx-cli to upgrade.
    • [#2072]: SqliteConnectOptions typo [[@fasterthanlime]]
    • [#2074]: fix: mssql uses unsigned for tinyint instead of signed [[@he4d]]
    • [#2081]: close unnamed portal after each executed extended query [[@DXist]]
    • [#2086]: PgHasArrayType for transparent types fix. [[@Wopple]]
      • NOTE: this is a breaking change and has been postponed to 0.7.0.
    • [#2089]: fix: Remove default chrono dep on time for sqlx-cli [[@TravisWhitehead]]
    • [#2091]: Sqlite explain plan log efficiency [[@tyrelr]]
    Open source →
  3. 0.6.1 03 Aug 2022
    Release notes

    33 pull requests were merged this release cycle.

    Added

    • [#1495]: Add example for manual implementation of the FromRow trait [[@Erik1000]]
    • [#1822]: (Postgres) Add support for std::net::IpAddr [[@meh]]
      • Decoding returns an error if the INET value in Postgres is a prefix and not a full address (/32 for IPv4, /128 for IPv6).
    • [#1865]: Add SQLite support for the time crate [[@johnbcodes]]
    • [#1902]: Add an example of how to use QueryBuilder::separated() [[@sbeckeriv]]
    • [#1917]: Added docs for sqlx::types::Json [[@jayy-lmao]]
    • [#1919]: Implement Clone for PoolOptions [[@Thomasdezeeuw]]
    • [#1953]: Support Rust arrays in Postgres [[@e00E]]
    • [#1954]: Add push_tuples for QueryBuilder [[@0xdeafbeef]]
    • [#1959]: Support #[sqlx(flatten)] attribute in FromRow [[@TheoOiry]]
    • [#1967]: Add example with external query files [[@JoeyMckenzie]]
    • [#1985]: Add query_builder::Separated::push_bind_unseparated() [[@0xdeafbeef]]
    • [#2001]: Implement #[sqlx::test] for general use
      • Includes automatic database management, migration and fixture application.
      • Drops support for end-of-lifed database versions, see PR for details.
    • [#2005]: QueryBuilder improvements [[@abonander]]
      • Raw SQL getters, new method to build QueryAs instead of Query.
    • [#2013]: (SQLite) Allow VFS to be set as URL query parameter [[@liningpan]]

    Changed

    • [#1679]: refactor: alias actix-* features to their equivalent tokio-* features [[@robjtede]]
    • [#1906]: replaced all uses of "uri" to "url" [[@RomainStorai]]
    • [#1965]: SQLite improvements [[@abonander]]
    • [#1977]: Docs: clarify relationship between query_as!() and FromRow [[@abonander]]
    • [#2003]: Replace dotenv with dotenvy [[@abonander]]

    Fixed

    • [#1802]: Try avoiding a full clean in cargo sqlx prepare --merged [[@LovecraftianHorror]]
    • [#1848]: Fix type info access in Any database driver [[@raviqqe]]
    • [#1910]: Set CARGO_TARGET_DIR when compiling queries [[@sedrik]]
    • [#1915]: Pool: fix panic when using callbacks [[@abonander]]
    • [#1930]: Don't cache SQLite connection for macros [[@LovecraftianHorror]]
    • [#1948]: Fix panic in Postgres BYTEA decode [[@e00E]]
    • [#1955]: Fix typo in FAQ [[@kenkoooo]]
    • [#1968]: (Postgres) don't panic if S or V notice fields are not UTF-8 [[@abonander]]
    • [#1969]: Fix sqlx-cli build [[@ivan]]
    • [#1974]: Use the rust-cache action for CI [[@abonander]]
    • [#1988]: Agree on a single default runtime for the whole workspace [[@crepererum]]
    • [#1989]: Fix panics in PgListener [[@crepererum]]
    • [#1990]: Switch master to main in docs [[@crepererum]]
      • The change had already been made in the repo, the docs were out of date.
    • [#1993]: Update versions in quickstart examples in README [[@UramnOIL]]
    Open source →
  4. 0.6.0 16 Jun 2022
    Release notes

    This release marks the end of the 0.5.x series of releases and contains a number of breaking changes, mainly to do with backwards-incompatible dependency upgrades.

    As we foresee many more of these in the future, we surveyed the community on how to handle this; the consensus appears to be "just release breaking changes more often."

    As such, we expect the 0.6.x release series to be a shorter one.

    39 pull requests(!) (not counting "prepare 0.5.12 release", of course) were merged this release cycle.

    Breaking

    • [#1384]: (Postgres) Move server_version_num from trait to inherent impl [[@AtkinsChang]]
    • [#1426]: Bump ipnetwork to 0.19 [[@paolobarbolini]]
    • [#1455]: Upgrade time to 0.3 [[@paolobarbolini]]
    • [#1505]: Upgrade rustls to 0.20 [[@paolobarbolini]]
      • Fortunately, future upgrades should not be breaking as webpki is no longer exposed in the API.
    • [#1529]: Upgrade bigdecimal to 0.3 [[@e00E]]
    • [#1602]: postgres: use Oid everywhere instead of u32 [[@paolobarbolini]]
      • This drops the Type, Decode, Encode impls for u32 for Postgres as it was misleading. Postgres doesn't support unsigned ints without using an extension. These impls were decoding Postgres OIDs as bare u32s without any context (and trying to bind a u32 to a query would produce an OID value in SQL). This changes that to use a newtype instead, for clarity.
    • [#1612]: Make all ConnectOptions types cloneable [[@05storm26]]
    • [#1618]: SQLite chrono::DateTime<FixedOffset> timezone fix [[@05storm26]]
      • DateTime<FixedOffset> will be stored in SQLite with the correct timezone instead of always in UTC. This was flagged as a "potentially breaking change" since it changes how dates are sent to SQLite.
    • [#1733]: Update git2 to 0.14 [[@joshtriplett]]
    • [#1734]: Make PgLTree::push() infallible and take PgLTreeLabel directly [[@sebpuetz]]
    • [#1785]: Fix Rust type for SQLite REAL [[@pruthvikar]]
      • Makes the macros always map a REAL column to f64 instead of f32 as SQLite uses only 64-bit floats.
    • [#1816]: Improve SQLite support for sub-queries and CTEs [[@tyrelr]]
      • This likely will change the generated code for some invocations sqlx::query!() with SQLite.
    • [#1821]: Update uuid crate to v1 [[@paolobarbolini]]
    • [#1901]: Pool fixes and breaking changes [[@abonander]]
      • Renamed PoolOptions::connect_timeout to acquire_timeout for clarity.
      • Changed the expected signatures for PoolOptions::after_connect, before_acquire, after_release
      • Changed the signature for Pool::close() slightly
        • Now eagerly starts the pool closing, .awaiting is only necessary if you want to ensure a graceful shutdown.
      • Deleted PoolConnection::release() which was previously deprecated in favor of PoolConnection::detach().
      • Fixed connections getting leaked even when calling .close().
    • [[#1748]]: Derive PgHasArrayType for #[sqlx(transparent)] types [[@carols10cents]]

    Added

    • [#1843]: Expose some useful methods on PgValueRef [[@mfreeborn]]
    • [#1889]: SQLx-CLI: add --connect-timeout [[@abonander]]
      • Adds a default 10 second connection timeout to all commands.
    • [#1890]: Added test for mssql LoginAck [[@walf443]]
    • [#1891]: Added test for mssql ProtocolInfo [[@walf443]]
    • [#1892]: Added test for mssql ReturnValue [[@walf443]]
    • [#1895]: Add support for i16 to Any driver [[@EthanYuan]]
    • [#1897]: Expose ConnectOptions and PoolOptions on Pool and database name on PgConnectOptions [[@Nukesor]]

    Changed

    • [#1782]: Reuse a cached DB connection instead of always opening a new one for sqlx-macros [[@LovecraftianHorror]]
    • [#1807]: Bump remaining dependencies [[@paolobarbolini]]
    • [#1808]: Update to edition 2021 [[@paolobarbolini]]
      • Note that while SQLx does not officially track an MSRV and only officially supports the latest stable Rust, this effectively places a lower bound of 1.56.0 on the range of versions it may work with.
    • [#1823]: (sqlx-macros) Ignore deps when getting metadata for workspace root [[@LovecraftianHorror]]
    • [#1831]: Update crc to 3.0 [[@djc]]
    • [#1887]: query_as: don't stop stream after decoding error [[@lovasoa]]

    Fixed

    • [#1814]: SQLx-cli README: move Usage to the same level as Install [[@tobymurray]]
    • [#1815]: SQLx-cli README: reword "building in offline mode" [[@tobymurray]]
    • [#1818]: Trim [] from host string before passing to TcpStream [[@smonv]]
      • This fixes handling of database URLs with IPv6 hosts.
    • [#1842]: Fix usage of serde_json in macros [[@mfreeborn]]
    • [#1855]: Postgres: fix panics on unknown type OID when decoding [[@demurgos]]
    • [#1856]: MySQL: support COLLATE_UTF8MB4_0900_AI_CI [[@scottwey]]
      • Fixes the MySQL driver thinking text columns are bytestring columns when querying against a Planetscale DB.
    • [#1861]: MySQL: avoid panic when streaming packets are empty [[@e-rhodes]]
    • [#1863]: Fix nullability check for inner joins in Postgres [[@OskarPersson]]
    • [#1881]: Fix field is never read warnings on Postgres test [[@walf443]]
    • [#1882]: Fix unused result must be used warnings [[@walf443]]
    • [#1888]: Fix migration checksum comparison during sqlx migrate info [[@mdtusz]]
    • [#1894]: Fix typos [[@kianmeng]]
    Open source →
  5. 0.5.13 15 Apr 2022
    Release notes

    This is a hotfix that reverts [#1748] as that was an accidental breaking change:
    the generated PgHasArrayType impl conflicts with manual impls of the trait.
    This change will have to wait for 0.6.0.

    Open source →
  6. 0.5.12 14 Apr 2022 withdrawn
    Release notes

    27 pull requests were merged this release cycle.

    Added

    • [#1641]: Postgres: Convenient wrapper for advisory locks [[@abonander]]
    • [#1675]: Add function to undo migrations [[@jdrouet]]
    • [#1722]: Postgres: implement PgHasArrayType for serde_json::{Value, RawValue} [[@abreis]]
    • [#1736]: Derive Clone for MySqlArguments and MssqlArguments [[@0xdeafbeef]]
    • [#1748]: Derive PgHasArrayType for #[sqlx(transparent)] types [[@carols10cents]]
    • [#1754]: Include affected rows alongside returned rows in query logging [[@david-mcgillicuddy-moixa]]
    • [#1757]: Implement Type for Cow<str> for MySQL, MSSQL and SQLite [[@ipetkov]]
    • [#1769]: sqlx-cli: add --source to migration subcommands [[@pedromfedricci]]
    • [#1774]: Postgres: make extra_float_digits settable [[@abonander]]
      • Can be set to None for Postgres or third-party database servers that don't support the option.
    • [#1776]: Implement close-event notification for Pool [[@abonander]]
      • Also fixes PgListener preventing Pool::close() from resolving.
    • [#1780]: Implement query builder [[@crajcan]]
      • See also [#1790]: Document and expand query builder [[@abonander]]
    • [#1781]: Postgres: support NUMERIC[] using decimal feature [[@tm-drtina]]
    • [#1784]: SQLite: add FromStr, Copy, PartialEq, Eq impls for options enums [[@andrewwhitehead]]

    Changed

    • [#1625]: Update RustCrypto crates [[@paolobarbolini]]
    • [#1725]: Update heck to 0.4 [[@paolobarbolini]]
    • [#1738]: Update regex [[@Dylan-DPC]]
    • [#1763]: SQLite: update libsqlite3-sys [[@espindola]]

    Fixed

    • [#1719]: Fix a link in query!() docs [[@vbmade2000]]
    • [#1731]: Postgres: fix option passing logic [[@liushuyu]]
    • [#1735]: sqlx-cli: pass DATABASE_URL to command spawned in prepare [[@LovecraftianHorror]]
    • [#1741]: Postgres: fix typo in TSTZRANGE [[@mgrachev]]
    • [#1761]: Fix link from QueryAs to query_as() in docs [[@mgrachev]]
    • [#1786]: MySQL: silence compile warnings for unused fields [[@andrewwhitehead]]
    • [#1789]: SQLite: fix left-joins breaking query!() macros [[@tyrelr]]
    • [#1791]: Postgres: fix newline parsing of .pgpass files [[@SebastienGllmt]]
    • [#1799]: PoolConnection: don't leak connection permit if drop task fails to run [[@abonander]]
    Open source →
  7. 0.5.11 18 Feb 2022
    Release notes

    20 pull requests were merged this release cycle.

    Added

    • [#1610]: Allow converting AnyConnectOptions to a specific ConnectOptions [[@05storm26]]
    • [#1652]: Implement From for AnyConnection [[@genusistimelord]]
    • [#1658]: Handle SQLITE_LOCKED [[@madadam]]
    • [#1665]: Document offline mode usage with feature flags [[@sedrik]]
    • [#1680]: Show checksum mismatches in sqlx migrate info [[@ifn3]]
    • [#1685]: Add tip for setting opt-level for sqlx-macros [[@LovecraftianHorror]]
    • [#1687]: Docs: Acquire examples and alternative [[@stoically]]
    • [#1696]: Postgres: support for ltree [[@cemoktra]]
    • [#1710]: Postgres: support for lquery [[@cemoktra]]

    Changed

    • [#1605]: Remove unused dependencies [[@paolobarbolini]]
    • [#1606]: Add target context to Postgres NOTICE logs [[@dbeckwith]]
    • [#1684]: Macros: Cache parsed sqlx-data.json instead of reparsing [[@LovecraftianHorror]]

    Fixed

    • [#1608]: Drop worker shared state in shutdown (SQLite) [[@andrewwhitehead]]
    • [#1619]: Docs(macros): remove sentences banning usage of as _ [[@k-jun]]
    • [#1626]: Simplify cargo-sqlx command-line definition [[@tranzystorek-io]]
    • [#1636]: Fix and extend Postgres transaction example [[@taladar]]
    • [#1657]: Fix typo in macro docs [[@p9s]]
    • [#1661]: Fix binding Option<T> for Any driver [[@ArGGu]]
    • [#1667]: MySQL: Avoid panicking if packet is empty [[@nappa85]]
    • [#1692]: Postgres: Fix power calculation when encoding BigDecimal into NUMERIC [[@VersBinarii]]

    Additionally, we have introduced two mitigations for the issue of the cyclic dependency on ahash:

    • We re-downgraded our version requirement on indexmap from 1.7.0 back to 1.6.2 so users can pin it to that version as recommended in aHash#95.
    • Thanks to the work of [@LovecraftianHorror] in #1684, we no longer require the preserve_order feature of serde_json which gives users another place to break the cycle by simply not enabling that feature.
      • This may introduce extra churn in Git diffs for sqlx-data.json, however. If this is an issue for you but the dependency cycle isn't, you can re-enable the preserve_order feature:
      [dependencies]
      serde_json = { version = "1", features = ["preserve_order"] }
      
    Open source →
  8. 0.5.10 30 Dec 2021
    Release notes

    A whopping 31 pull requests were merged this release cycle!

    According to this changelog, we saw 18 new contributors! However, some of these folks may have missed getting mentioned in previous entries since we only listed highlights. To avoid anyone feeling left out, I put in the effort this time and tried to list every single one here.

    Added

    • [#1228]: Add Pool::any_kind() [[@nitnelave]]
    • [#1343]: Add Encode/Decode impl for Cow<'_, str> [[@Drevoed]]
    • [#1474]: Derive Clone, Copy for AnyKind [[@yuyawk]]
    • [#1497]: Update FAQ to explain how to configure docs.rs to build a project using SQLx [[@russweas]]
    • [#1498]: Add description of migration file structure to migrate!() docs [[@zbigniewzolnierowicz]]
    • [#1508]: Add .persistent(bool) to QueryAs, QueryScalar [[@akiradeveloper]]
    • [#1514]: Add support for serialized threading mode to SQLite [[@LLBlumire]]
    • [#1523]: Allow rust_decimal::Decimal in PgRange [[@meh]]
    • [#1539]: Support PGOPTIONS and adding custom configuration options in PgConnectOptions [[@liushuyu]]
    • [#1562]: Re-export either::Either used by Executor::fetch_many() [[@DoumanAsh]]
    • [#1584]: Add feature to use RusTLS instead of native-tls for sqlx-cli [[@SonicZentropy]]
    • [#1592]: Add AnyConnection::kind() [[@05storm26]]

    Changes

    • [#1385]: Rewrite Postgres array handling to reduce boilerplate and allow custom types [[@jplatte]]
    • [#1479]: Remove outdated mention of runtime-async-std-native-tls as the default runtime in README.md [[@yerke]]
    • [#1526]: Revise Pool docs in a couple places [[@abonander]]
    • [#1535]: Bump libsqlite-sys to 0.23.1 [[@nitsky]]
    • [#1551]: SQLite: make worker thread responsible for all FFI calls [[@abonander]]
      • If you were encountering segfaults with the SQLite driver, there's a good chance this will fix it!
    • [#1557]: CI: test with Postgres 14 [[@paolobarbolini]]
    • [#1571]: Make whoami dep optional, only pull it in for Postgres [[@joshtriplett]]
    • [#1572]: Update rsa crate to 0.5 [[@paolobarbolini]]
    • [#1591]: List SeaORM as an ORM option in the README [[@kunjee17]]
    • [#1601]: Update itoa and dirs [[@paolobarbolini]]

    Fixes

    • [#1475]: Fix panic when converting a negative chrono::Duration to PgInterval [[@yuyawk]]
    • [#1483]: Fix error when decoding array of custom types from Postgres [[@demurgos]
    • [#1501]: Reduce indexmap version requirement to 1.6.2 [[@dimfeld]]
    • [#1511]: Fix element type given to Postgres for arrays of custom enums [[@chesedo]]
    • [#1517]: Fix mismatched type errors in MySQL type tests [[@abonander]]
    • [#1537]: Fix missing re-export of PgCopyIn [[@akiradeveloper]]
    • [#1566]: Match ~/.pgpass password after URL parsing and fix user and database ordering [[@D1plo1d]]
    • [#1582]: cargo sqlx prepare: Append to existing RUSTFLAGS instead of overwriting [[@tkintscher]]
    • [#1587]: SQLite: if set, send PRAGMA key on a new connection before anything else. [[@parazyd]]
      • This should fix problems with being unable to open databases using SQLCipher.
    Open source →
  9. 0.5.9 01 Oct 2021
    Release notes

    A hotfix release to address the issue of the sqlx crate itself still depending on older versions of sqlx-core and sqlx-macros.

    No other changes from 0.5.8.

    Open source →
  10. 0.5.8 01 Oct 2021 withdrawn
    Release notes

    A total of 24 pull requests were merged this release cycle! Some highlights:

    • [#1289] Support the immutable option on SQLite connections [[@djmarcin]]
    • [#1295] Support custom initial options for SQLite [[@ghassmo]]
      • Allows specifying custom PRAGMAs and overriding those set by SQLx.
    • [#1345] Initial support for Postgres COPY FROM/TO[[@montanalow], [@abonander]]
    • [#1439] Handle multiple waiting results correctly in MySQL [[@eagletmt]]
    Open source →
  11. 0.5.7 21 Aug 2021
    Release notes
    • [#1392] use resolve_path when getting path for include_str!() [[@abonander]]
      • Fixes a regression introduced by [[#1332]].
    • [#1393] avoid recursively spawning tasks in PgListener::drop() [[@abonander]]
      • Fixes a panic that occurs when PgListener is dropped in async fn main().
    Open source →
  12. 0.5.6 17 Aug 2021
    Release notes

    A large bugfix release, including but not limited to:

    • [#1329] Implement MACADDR type for Postgres [[@nomick]]
    • [#1363] Fix PortalSuspended for array of composite types in Postgres [[@AtkinsChang]]
    • [#1320] Reimplement sqlx::Pool internals using futures-intrusive [[@abonander]]
      • This addresses a number of deadlocks/stalls on acquiring connections from the pool.
    • [#1332] Macros: tell the compiler about external files/env vars to watch [[@abonander]]
      • Includes sqlx build-script to create a build.rs to watch migrations/ for changes.
      • Nightly users can try RUSTFLAGS=--cfg sqlx_macros_unstable to tell the compiler to watch migrations/ for changes instead of using a build script.
      • See the new section in the docs for sqlx::migrate!() for details.
    • [#1351] Fix a few sources of segfaults/errors in SQLite driver [[@abonander]]
      • Includes contributions from [[@link2ext]] and [[@madadam]].
    • [#1323] Keep track of column typing in SQLite EXPLAIN parsing [[@marshoepial]]
      • This fixes errors in the macros when using INSERT/UPDATE/DELETE ... RETURNING ... in SQLite.

    A total of 25 pull requests were merged this release cycle!

    Open source →
  13. 0.5.5 24 May 2021
    Release notes
    • [#1242] Fix infinite loop at compile time when using query macros [[@toshokan]]
    Open source →
  14. 0.5.4 22 May 2021
    Release notes
    • [#1235] Fix compilation with rustls from an eager update to webpki [[@ETCaton]]
    Open source →
  15. 0.5.3 22 May 2021
    Release notes
    • [#1211] Even more tweaks and fixes to the Pool internals [[@abonander]]

    • [#1213] Add support for bytes and chrono::NaiveDateTime to Any [[@guylapid]]

    • [#1224] Add support for chrono::DateTime<Local> to Any with MySQL [[@NatPRoach]]

    • [#1216] Skip empty lines and comments in pgpass files [[@feikesteenbergen]]

    • [#1218] Add support for PgMoney to the compile-time type-checking [[@iamsiddhant05]]

    Open source →
  16. 0.5.2 16 Apr 2021
    Release notes
    • [#1149] Tweak and optimize Pool internals [[@abonander]]

    • [#1132] Remove 'static bound on Connection::transaction [[@argv-minus-one]]

    • [#1128] Fix -y flag for sqlx db reset -y [[@qqwa]]

    • [#1099] [#1097] Truncate buffer when BufStream is dropped [[@Diggsey]]

    PostgreSQL

    • [#1170] Remove Self: Type bounds in Encode / Decode implementations for arrays [[@jplatte]]

      Enables working around the lack of support for user-defined array types:

      #[derive(sqlx::Encode)]
      struct Foos<'a>(&'a [Foo]);
      
      impl sqlx::Type<sqlx::Postgres> for Foos<'_> {
          fn type_info() -> PgTypeInfo {
              PgTypeInfo::with_name("_foo")
          }
      }
      
      query_as!(
          Whatever,
          "<QUERY with $1 of type foo[]>",
          Foos(&foo_vec) as _,
      )
      
    • [#1141] Use u16::MAX instead of i16::MAX for a check against the largest number of parameters in a query [[@crajcan]]

    • [#1112] Add support for DOMAIN types [[@demurgos]]

    • [#1100] Explicitly UNLISTEN before returning connections to the pool in PgListener [[@Diggsey]]

    SQLite

    • [#1161] Catch SQLITE_MISUSE on connection close and panic [[@link2xt]]

    • [#1160] Do not cast pointers to i32 (cast to usize) [[@link2xt]]

    • [#1156] Reset the statement when fetch_many stream is dropped [[@link2xt]]

    Open source →
  17. 0.3.0 04 Feb 2021
    Release notes

    Breaking Changes

    • sqlx::Row now has a lifetime ('c) tied to the database connection. In effect, this means that you cannot store Rows or collect them into a collection. Query (returned from sqlx::query()) has map() which takes a function to map from the Row to another type to make this transition easier.

      In 0.2.x

      let rows = sqlx::query("SELECT 1")
          .fetch_all(&mut conn).await?;
      

      In 0.3.x

      let values: Vec<i32> = sqlx::query("SELECT 1")
          .map(|row: PgRow| row.get(0))
          .fetch_all(&mut conn).await?;
      

      To assist with the above, sqlx::query_as() now supports querying directly into tuples (up to 9 elements) or struct types with a #[derive(FromRow)].

      // This extension trait is needed until a rust bug is fixed
      use sqlx::postgres::PgQueryAs;
      
      let values: Vec<(i32, bool)> = sqlx::query_as("SELECT 1, false")
          .fetch_all(&mut conn).await?;
      
    • HasSqlType<T>: Database is now T: Type<Database> to mirror Encode and Decode

    • Query::fetch (returned from query()) now returns a new Cursor type. Cursor is a Stream-like type where the item type borrows into the stream (which itself borrows from connection). This means that using query().fetch() you can now stream directly from the database with zero-copy and zero-allocation.

    • Remove PgTypeInfo::with_oid and replace with PgTypeInfo::with_name

    Added

    • Results from the database are now zero-copy and no allocation beyond a shared read buffer for the TCP stream ( in other words, almost no per-query allocation ). Bind arguments still do allocate a buffer per query.

    • [#129] Add support for SQLite. Generated code should be very close to normal use of the C API.

      • Adds Sqlite, SqliteConnection, SqlitePool, and other supporting types
    • [#97] [#134] Add support for user-defined types. [[@Freax13]]

      • Rust-only domain types or transparent wrappers around SQL types. These may be used transparently inplace of the SQL type.

        #[derive(sqlx::Type)]
        #[repr(transparent)]
        struct Meters(i32);
        
      • Enumerations may be defined in Rust and can match SQL by integer discriminant or variant name.

        #[derive(sqlx::Type)]
        #[repr(i32)] // Expects a INT in SQL
        enum Color { Red = 1, Green = 2, Blue = 3 }
        
        #[derive(sqlx::Type)]
        #[sqlx(rename = "TEXT")] // May also be the name of a user defined enum type
        #[sqlx(rename_all = "lowercase")] // similar to serde rename_all
        enum Color { Red, Green, Blue } // expects 'red', 'green', or 'blue'
        
      • Postgres further supports user-defined composite types.

        #[derive(sqlx::Type)]
        #[sqlx(rename = "interface_type")]
        struct InterfaceType {
            name: String,
            supplier_id: i32,
            price: f64
        }
        
    • [#98] [#131] Add support for asynchronous notifications in Postgres (LISTEN / NOTIFY). [[@thedodd]]

      • Supports automatic reconnection on connection failure.

      • PgListener implements Executor and may be used to execute queries. Be careful however as if the intent is to handle and process messages rapidly you don't want to be tying up the connection for too long. Messages received during queries are buffered and will be delivered on the next call to recv().

      let mut listener = PgListener::new(DATABASE_URL).await?;
      
      listener.listen("topic").await?;
      
      loop {
          let message = listener.recv().await?;
      
          println!("payload = {}", message.payload);
      }
      
    • Add unchecked variants of the query macros. These will still verify the SQL for syntactic and semantic correctness with the current database but they will not check the input or output types.

      This is intended as a temporary solution until query_as! is able to support user defined types.

      • query_as_unchecked!
      • query_file_as_unchecked!
    • Add support for many more types in Postgres

      • JSON, JSONB [[@oeb25]]
      • INET, CIDR [[@PoiScript]]
      • Arrays [[@oeb25]]
      • Composites ( Rust tuples or structs with a #[derive(Type)] )
      • NUMERIC [[@abonander]]
      • OID (u32)
      • "CHAR" (i8)
      • TIMESTAMP, TIMESTAMPTZ, etc. with the time crate [[@utter-step]]
      • Enumerations ( Rust enums with a #[derive(Type)] ) [[@Freax13]]

    Changed

    • Query (and QueryAs; returned from query(), query_as(), query!(), and query_as!()) now will accept both &mut Connection or &Pool where as in 0.2.x they required &mut &Pool.

    • Executor now takes any value that implements Execute as a query. Execute is implemented for Query and QueryAs to mean exactly what they've meant so far, a prepared SQL query. However, Execute is also implemented for just &str which now performs a raw or unprepared SQL query. You can further use this to fetch Rows from the database though it is not as efficient as the prepared API (notably Postgres and MySQL send data back in TEXT mode as opposed to in BINARY mode).

      use sqlx::Executor;
      
      // Set the time zone parameter
      conn.execute("SET TIME ZONE LOCAL;").await
      
      // Demonstrate two queries at once with the raw API
      let mut cursor = conn.fetch("SELECT 1; SELECT 2");
      let row = cursor.next().await?.unwrap();
      let value: i32 = row.get(0); // 1
      let row = cursor.next().await?.unwrap();
      let value: i32 = row.get(0); // 2
      

    Removed

    • Query (returned from query()) no longer has fetch_one, fetch_optional, or fetch_all. You must map the row using map() and then you will have a query::Map value that has the former methods available.

      let values: Vec<i32> = sqlx::query("SELECT 1")
          .map(|row: PgRow| row.get(0))
          .fetch_all(&mut conn).await?;
      

    Fixed

    • [#62] [#130] [#135] Remove explicit set of IntervalStyle. Allow usage of SQLx for CockroachDB and potentially PgBouncer. [[@bmisiak]]

    • [#108] Allow nullable and borrowed values to be used as arguments in query! and query_as!. For example, where the column would resolve to String in Rust (TEXT, VARCHAR, etc.), you may now use Option<String>, Option<&str>, or &str instead. [[@abonander]]

    • [#108] Make unknown type errors far more informative. As an example, trying to SELECT a DATE column will now try and tell you about the chrono feature. [[@abonander]]

      optional feature `chrono` required for type DATE of column #1 ("now")
      
    Open source →
  18. 0.2.0 12 Nov 2020
    Release notes

    Fixed

    • https://github.com/launchbadge/sqlx/issues/47

    Added

    • Support Tokio through an optional runtime-tokio feature.

    • Support SQL transactions. You may now use the begin() function on Pool or Connection to start a new SQL transaction. This returns sqlx::Transaction which will ROLLBACK on Drop or can be explicitly COMMIT using commit().

    • Support TLS connections.

    Open source →
  19. 0.1.1 27 Jul 2020

    Nothing published for this version

  20. 0.1.0 27 Jul 2020

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive