mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 07:21:08 +00:00
feat(mssql): add macro support
This commit is contained in:
parent
a0ccc135aa
commit
6497d67b6a
119
Cargo.lock
generated
119
Cargo.lock
generated
@ -81,9 +81,9 @@ checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62"
|
||||
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
@ -173,9 +173,9 @@ checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.31"
|
||||
version = "0.1.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26c4f3195085c36ea8d24d32b2f828d23296a9370a28aa39d111f6f16bef9f3b"
|
||||
checksum = "8f1c13101a3224fb178860ae372a031ce350bbd92d39968518f016744dde0bf7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -299,9 +299,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.3.0"
|
||||
version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6"
|
||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
||||
|
||||
[[package]]
|
||||
name = "byte-tools"
|
||||
@ -439,9 +439,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "copyless"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127"
|
||||
checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
@ -459,20 +459,6 @@ version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils 0.7.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.4.2"
|
||||
@ -1033,9 +1019,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.3.2"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
|
||||
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
@ -1297,19 +1283,6 @@ dependencies = [
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.2.6"
|
||||
@ -1390,9 +1363,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.57"
|
||||
version = "0.9.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7410fef80af8ac071d4f63755c0ab89ac3df0fd1ea91f1d1f37cf5cec4395990"
|
||||
checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cc",
|
||||
@ -1453,9 +1426,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "0.1.15"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d53181dcd37421c08d3b69f887784956674d09c3f9a47a04fece2b130a5b346b"
|
||||
checksum = "d508492eeb1e5c38ee696371bf7b9fc33c83d46a7d451606b96458fbbbdc2dec"
|
||||
dependencies = [
|
||||
"paste-impl",
|
||||
"proc-macro-hack",
|
||||
@ -1463,9 +1436,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "paste-impl"
|
||||
version = "0.1.15"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05ca490fa1c034a71412b4d1edcb904ec5a0981a4426c9eb2128c0fda7a68d17"
|
||||
checksum = "84f328a6a63192b333fce5fbb4be79db6758a4d518dfac6d54412f1492f72d32"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
@ -1558,18 +1531,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "0.4.17"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791"
|
||||
checksum = "e75373ff9037d112bb19bc61333a06a159eaeb217660dcfbea7d88e1db823919"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "0.4.17"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40"
|
||||
checksum = "10b4b44893d3c370407a1d6a5cfde7c41ae0478e31c516c85f67eb3adc51be6d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1578,9 +1551,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.1.5"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f"
|
||||
checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
@ -1590,9 +1563,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "piper"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b0deb65f46e873ba8aa7c6a8dbe3f23cb1bf59c339a81a1d56361dde4d66ac8"
|
||||
checksum = "01608bfa680dafb103f9207fa944facf572e4e3e708d10de19a0d0c3d36e5f18"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.7.2",
|
||||
"futures-io",
|
||||
@ -1652,9 +1625,9 @@ checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101"
|
||||
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
@ -1807,9 +1780,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.4"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
@ -1991,15 +1964,17 @@ checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
|
||||
|
||||
[[package]]
|
||||
name = "smol"
|
||||
version = "0.1.10"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "686c634ad1873fffef6aed20f180eede424fbf3bb31802394c90fd7335a661b7"
|
||||
checksum = "845f5e7db6b614a8f4f59e565c3035f0fab2f71c9537ff0119eddb60d866cae3"
|
||||
dependencies = [
|
||||
"async-task",
|
||||
"crossbeam",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"nix",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"piper",
|
||||
"scoped-tls-hkt",
|
||||
@ -2127,7 +2102,6 @@ dependencies = [
|
||||
"sqlx-rt",
|
||||
"stringprep",
|
||||
"thiserror",
|
||||
"threadpool",
|
||||
"time 0.2.16",
|
||||
"url 2.1.1",
|
||||
"uuid",
|
||||
@ -2254,9 +2228,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "standback"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47e4b8c631c998468961a9ea159f064c5c8499b95b5e4a34b77849d45949d540"
|
||||
checksum = "b0437cfb83762844799a60e1e3b489d5ceb6a650fbacb86437badc1b6d87b246"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stdweb"
|
||||
@ -2364,9 +2341,9 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.29"
|
||||
version = "1.0.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb37da98a55b1d08529362d9cbb863be17556873df2585904ab9d2bc951291d0"
|
||||
checksum = "93a56fabc59dce20fe48b6c832cc249c713e7ed88fa28b0ee0a3bfcaae5fe4e2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2736,9 +2713,9 @@ checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
|
||||
|
||||
[[package]]
|
||||
name = "trybuild"
|
||||
version = "1.0.27"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "744665442556a91933cee5e75b0371376eb03498c4d0bfbcebd2a9882b4fb5ef"
|
||||
checksum = "39e3183158b2c8170db33b8b3a90ddc7b5f380d15b50794d22c1fa9c61b47249"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"lazy_static",
|
||||
@ -2826,9 +2803,9 @@ checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
|
||||
checksum = "55d1e41d56121e07f1e223db0a4def204e45c85425f6a16d462fd07c8d10d74c"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
@ -2842,12 +2819,6 @@ version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
|
||||
[[package]]
|
||||
name = "want"
|
||||
version = "0.2.0"
|
||||
|
23
Cargo.toml
23
Cargo.toml
@ -60,7 +60,7 @@ runtime-tokio = [ "sqlx-core/runtime-tokio", "sqlx-macros/runtime-tokio" ]
|
||||
postgres = [ "sqlx-core/postgres", "sqlx-macros/postgres" ]
|
||||
mysql = [ "sqlx-core/mysql", "sqlx-macros/mysql" ]
|
||||
sqlite = [ "sqlx-core/sqlite", "sqlx-macros/sqlite" ]
|
||||
mssql = [ "sqlx-core/mssql" ]
|
||||
mssql = [ "sqlx-core/mssql", "sqlx-macros/mssql" ]
|
||||
|
||||
# types
|
||||
bigdecimal = ["sqlx-core/bigdecimal", "sqlx-macros/bigdecimal"]
|
||||
@ -75,19 +75,19 @@ sqlx-core = { version = "0.4.0-pre", path = "sqlx-core", default-features = fals
|
||||
sqlx-macros = { version = "0.4.0-pre", path = "sqlx-macros", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0.26"
|
||||
time_ = { version = "0.2.9", package = "time" }
|
||||
futures = "0.3.4"
|
||||
anyhow = "1.0.31"
|
||||
time_ = { version = "0.2.16", package = "time" }
|
||||
futures = "0.3.5"
|
||||
env_logger = "0.7.1"
|
||||
async-std = { version = "1.5.0", features = [ "attributes" ] }
|
||||
tokio = { version = "0.2.13", features = [ "full" ] }
|
||||
async-std = { version = "1.6.0", features = [ "attributes" ] }
|
||||
tokio = { version = "0.2.21", features = [ "full" ] }
|
||||
dotenv = "0.15.0"
|
||||
trybuild = "1.0.24"
|
||||
sqlx-rt = { path = "./sqlx-rt" }
|
||||
sqlx-test = { path = "./sqlx-test" }
|
||||
paste = "0.1.7"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
serde_json = "1.0.48"
|
||||
paste = "0.1.16"
|
||||
serde = { version = "1.0.111", features = [ "derive" ] }
|
||||
serde_json = "1.0.53"
|
||||
|
||||
#
|
||||
# SQLite
|
||||
@ -179,3 +179,8 @@ required-features = [ "mssql" ]
|
||||
name = "mssql-describe"
|
||||
path = "tests/mssql/describe.rs"
|
||||
required-features = [ "mssql" ]
|
||||
|
||||
[[test]]
|
||||
name = "mssql-macros"
|
||||
path = "tests/mssql/macros.rs"
|
||||
required-features = [ "mssql", "macros" ]
|
||||
|
@ -30,6 +30,7 @@ offline = ["sqlx-core/offline", "serde", "serde_json", "hex", "sha2"]
|
||||
mysql = [ "sqlx-core/mysql" ]
|
||||
postgres = [ "sqlx-core/postgres" ]
|
||||
sqlite = [ "sqlx-core/sqlite" ]
|
||||
mssql = [ "sqlx-core/mssql" ]
|
||||
|
||||
# type
|
||||
bigdecimal = [ "sqlx-core/bigdecimal" ]
|
||||
@ -40,18 +41,18 @@ uuid = [ "sqlx-core/uuid" ]
|
||||
json = [ "sqlx-core/json", "serde_json" ]
|
||||
|
||||
[dependencies]
|
||||
async-std = { version = "1.5.0", default-features = false, optional = true }
|
||||
tokio = { version = "0.2.13", default-features = false, features = [ "rt-threaded" ], optional = true }
|
||||
async-std = { version = "1.6.0", default-features = false, optional = true }
|
||||
tokio = { version = "0.2.21", default-features = false, features = [ "rt-threaded" ], optional = true }
|
||||
dotenv = { version = "0.15.0", default-features = false }
|
||||
futures = { version = "0.3.4", default-features = false, features = [ "executor" ] }
|
||||
hex = { version = "0.4.2", optional = true }
|
||||
heck = "0.3"
|
||||
heck = "0.3.1"
|
||||
proc-macro2 = { version = "1.0.9", default-features = false }
|
||||
sqlx-core = { version = "0.4.0-pre", default-features = false, path = "../sqlx-core" }
|
||||
serde = { version = "1.0", optional = true }
|
||||
serde_json = { version = "1.0", features = [ "preserve_order" ], optional = true }
|
||||
sha2 = { version = "0.8.1", optional = true }
|
||||
syn = { version = "1.0.16", default-features = false, features = [ "full" ] }
|
||||
quote = { version = "1.0.2", default-features = false }
|
||||
serde = { version = "1.0.111", optional = true }
|
||||
serde_json = { version = "1.0.30", features = [ "preserve_order" ], optional = true }
|
||||
sha2 = { version = "0.8.2", optional = true }
|
||||
syn = { version = "1.0.30", default-features = false, features = [ "full" ] }
|
||||
quote = { version = "1.0.6", default-features = false }
|
||||
url = { version = "2.1.1", default-features = false }
|
||||
once_cell = { version = "1.3", features = ["std"], optional = true }
|
||||
|
@ -97,3 +97,6 @@ mod mysql;
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
mod sqlite;
|
||||
|
||||
#[cfg(feature = "mssql")]
|
||||
mod mssql;
|
||||
|
17
sqlx-macros/src/database/mssql.rs
Normal file
17
sqlx-macros/src/database/mssql.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use sqlx_core as sqlx;
|
||||
|
||||
impl_database_ext! {
|
||||
sqlx::mssql::Mssql {
|
||||
i8,
|
||||
i16,
|
||||
i32,
|
||||
i64,
|
||||
f32,
|
||||
f64,
|
||||
String,
|
||||
},
|
||||
ParamChecking::Weak,
|
||||
feature-types: _info => None,
|
||||
row = sqlx::mssql::MssqlRow,
|
||||
name = "MSSQL"
|
||||
}
|
@ -16,13 +16,10 @@ use crate::query::data::QueryData;
|
||||
use crate::query::input::RecordType;
|
||||
use crate::runtime::block_on;
|
||||
|
||||
// pub use query::expand_query;
|
||||
|
||||
mod args;
|
||||
mod data;
|
||||
mod input;
|
||||
mod output;
|
||||
// mod query;
|
||||
|
||||
pub fn expand_input(input: QueryMacroInput) -> crate::Result<TokenStream> {
|
||||
let manifest_dir =
|
||||
@ -76,8 +73,23 @@ fn expand_from_db(input: QueryMacroInput, db_url: &str) -> crate::Result<TokenSt
|
||||
|
||||
expand_with_data(input, data)
|
||||
},
|
||||
|
||||
#[cfg(not(feature = "postgres"))]
|
||||
"postgres" | "postgresql" => Err(format!("database URL has the scheme of a PostgreSQL database but the `postgres` feature is not enabled").into()),
|
||||
|
||||
#[cfg(feature = "mssql")]
|
||||
"mssql" | "sqlserver" => {
|
||||
let data = block_on(async {
|
||||
let mut conn = sqlx_core::mssql::MssqlConnection::connect(db_url.as_str()).await?;
|
||||
QueryData::from_db(&mut conn, &input.src).await
|
||||
})?;
|
||||
|
||||
expand_with_data(input, data)
|
||||
},
|
||||
|
||||
#[cfg(not(feature = "mssql"))]
|
||||
"mssql" | "sqlserver" => Err(format!("database URL has the scheme of a MSSQL database but the `mssql` feature is not enabled").into()),
|
||||
|
||||
#[cfg(feature = "mysql")]
|
||||
"mysql" | "mariadb" => {
|
||||
let data = block_on(async {
|
||||
@ -87,8 +99,10 @@ fn expand_from_db(input: QueryMacroInput, db_url: &str) -> crate::Result<TokenSt
|
||||
|
||||
expand_with_data(input, data)
|
||||
},
|
||||
|
||||
#[cfg(not(feature = "mysql"))]
|
||||
"mysql" | "mariadb" => Err(format!("database URL has the scheme of a MySQL/MariaDB database but the `mysql` feature is not enabled").into()),
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
"sqlite" => {
|
||||
let data = block_on(async {
|
||||
@ -98,8 +112,10 @@ fn expand_from_db(input: QueryMacroInput, db_url: &str) -> crate::Result<TokenSt
|
||||
|
||||
expand_with_data(input, data)
|
||||
},
|
||||
|
||||
#[cfg(not(feature = "sqlite"))]
|
||||
"sqlite" => Err(format!("database URL has the scheme of a SQLite database but the `sqlite` feature is not enabled").into()),
|
||||
|
||||
scheme => Err(format!("unknown database URL scheme {:?}", scheme).into())
|
||||
}
|
||||
}
|
||||
|
18
tests/mssql/macros.rs
Normal file
18
tests/mssql/macros.rs
Normal file
@ -0,0 +1,18 @@
|
||||
use sqlx::Mssql;
|
||||
use sqlx_test::new;
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn test_query_simple() -> anyhow::Result<()> {
|
||||
let mut conn = new::<Mssql>().await?;
|
||||
|
||||
let account =
|
||||
sqlx::query!("select * from (select (1) as id, 'Herp Derpinson' as name, cast(null as char) email) accounts")
|
||||
.fetch_one(&mut conn)
|
||||
.await?;
|
||||
|
||||
assert_eq!(account.id, 1);
|
||||
assert_eq!(account.name, "Herp Derpinson");
|
||||
assert_eq!(account.email, None);
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user