mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
style: rustfmt
This commit is contained in:
parent
3840d031c6
commit
b61c0821ab
12 changed files with 232 additions and 61 deletions
|
@ -8,10 +8,10 @@ use crate::postgres::{PgColumn, PgRow, PgStatement};
|
|||
use crate::mysql::{MySqlColumn, MySqlRow, MySqlStatement};
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
use crate::sqlite::{SqliteColumn, SqliteStatement, SqliteRow};
|
||||
use crate::sqlite::{SqliteColumn, SqliteRow, SqliteStatement};
|
||||
|
||||
#[cfg(feature = "mssql")]
|
||||
use crate::mssql::{MssqlColumn, MssqlStatement, MssqlRow};
|
||||
use crate::mssql::{MssqlColumn, MssqlRow, MssqlStatement};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AnyColumn {
|
||||
|
@ -76,7 +76,6 @@ impl Column for AnyColumn {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// FIXME: Find a nice way to auto-generate the below or petition Rust to add support for #[cfg]
|
||||
// to trait bounds
|
||||
|
||||
|
@ -89,7 +88,14 @@ impl Column for AnyColumn {
|
|||
feature = "sqlite"
|
||||
))]
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -100,7 +106,14 @@ pub trait AnyColumnIndex:
|
|||
feature = "sqlite"
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
I: ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -111,7 +124,12 @@ impl<I: ?Sized> AnyColumnIndex for I where
|
|||
all(feature = "postgres", feature = "mysql", feature = "sqlite")
|
||||
))]
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -120,7 +138,12 @@ pub trait AnyColumnIndex:
|
|||
all(feature = "postgres", feature = "mysql", feature = "sqlite")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
I: ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -129,7 +152,12 @@ impl<I: ?Sized> AnyColumnIndex for I where
|
|||
all(feature = "postgres", feature = "mssql", feature = "sqlite")
|
||||
))]
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -138,7 +166,12 @@ pub trait AnyColumnIndex:
|
|||
all(feature = "postgres", feature = "mssql", feature = "sqlite")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
I: ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -147,7 +180,12 @@ impl<I: ?Sized> AnyColumnIndex for I where
|
|||
all(feature = "postgres", feature = "mysql", feature = "mssql")
|
||||
))]
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -156,7 +194,12 @@ pub trait AnyColumnIndex:
|
|||
all(feature = "postgres", feature = "mysql", feature = "mssql")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
I: ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -165,7 +208,12 @@ impl<I: ?Sized> AnyColumnIndex for I where
|
|||
all(feature = "sqlite", feature = "mysql", feature = "mssql")
|
||||
))]
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -174,7 +222,12 @@ pub trait AnyColumnIndex:
|
|||
all(feature = "sqlite", feature = "mysql", feature = "mssql")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
I: ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -184,73 +237,145 @@ impl<I: ?Sized> AnyColumnIndex for I where
|
|||
not(any(feature = "mssql", feature = "sqlite")),
|
||||
all(feature = "postgres", feature = "mysql")
|
||||
))]
|
||||
pub trait AnyColumnIndex: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> {}
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mssql", feature = "sqlite")),
|
||||
all(feature = "postgres", feature = "mysql")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mysql", feature = "sqlite")),
|
||||
all(feature = "postgres", feature = "mssql")
|
||||
))]
|
||||
pub trait AnyColumnIndex: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> {}
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mysql", feature = "sqlite")),
|
||||
all(feature = "postgres", feature = "mssql")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mysql", feature = "mssql")),
|
||||
all(feature = "postgres", feature = "sqlite")
|
||||
))]
|
||||
pub trait AnyColumnIndex: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mysql", feature = "mssql")),
|
||||
all(feature = "postgres", feature = "sqlite")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow>
|
||||
+ for<'q> ColumnIndex<PgStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "postgres", feature = "sqlite")),
|
||||
all(feature = "mssql", feature = "mysql")
|
||||
))]
|
||||
pub trait AnyColumnIndex: ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> {}
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "postgres", feature = "sqlite")),
|
||||
all(feature = "mssql", feature = "mysql")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "postgres", feature = "mysql")),
|
||||
all(feature = "mssql", feature = "sqlite")
|
||||
))]
|
||||
pub trait AnyColumnIndex: ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "postgres", feature = "mysql")),
|
||||
all(feature = "mssql", feature = "sqlite")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<MssqlRow>
|
||||
+ for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "postgres", feature = "mssql")),
|
||||
all(feature = "mysql", feature = "sqlite")
|
||||
))]
|
||||
pub trait AnyColumnIndex: ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "postgres", feature = "mssql")),
|
||||
all(feature = "mysql", feature = "sqlite")
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> + ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<MySqlRow>
|
||||
+ for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
+ ColumnIndex<SqliteRow>
|
||||
+ for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
// only 1 (4)
|
||||
|
||||
|
@ -264,7 +389,10 @@ pub trait AnyColumnIndex: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'
|
|||
not(any(feature = "mysql", feature = "mssql", feature = "sqlite")),
|
||||
feature = "postgres"
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<PgRow> + for<'q> ColumnIndex<PgStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "postgres", feature = "mssql", feature = "sqlite")),
|
||||
|
@ -276,7 +404,10 @@ pub trait AnyColumnIndex: ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlState
|
|||
not(any(feature = "postgres", feature = "mssql", feature = "sqlite")),
|
||||
feature = "mysql"
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<MySqlRow> + for<'q> ColumnIndex<MySqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mysql", feature = "postgres", feature = "sqlite")),
|
||||
|
@ -288,16 +419,25 @@ pub trait AnyColumnIndex: ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlState
|
|||
not(any(feature = "mysql", feature = "postgres", feature = "sqlite")),
|
||||
feature = "mssql"
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<MssqlRow> + for<'q> ColumnIndex<MssqlStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mysql", feature = "mssql", feature = "postgres")),
|
||||
feature = "sqlite"
|
||||
))]
|
||||
pub trait AnyColumnIndex: ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
pub trait AnyColumnIndex:
|
||||
ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(any(feature = "mysql", feature = "mssql", feature = "postgres")),
|
||||
feature = "sqlite"
|
||||
))]
|
||||
impl<I: ?Sized> AnyColumnIndex for I where I: ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>> {}
|
||||
impl<I: ?Sized> AnyColumnIndex for I where
|
||||
I: ColumnIndex<SqliteRow> + for<'q> ColumnIndex<SqliteStatement<'q>>
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use either::Either;
|
||||
use futures_core::future::BoxFuture;
|
||||
use futures_core::stream::BoxStream;
|
||||
use futures_util::{StreamExt, TryStreamExt};
|
||||
use crate::any::connection::AnyConnectionKind;
|
||||
use crate::any::{Any, AnyStatement, AnyColumn, AnyConnection, AnyDone, AnyRow, AnyTypeInfo};
|
||||
use crate::any::{Any, AnyColumn, AnyConnection, AnyDone, AnyRow, AnyStatement, AnyTypeInfo};
|
||||
use crate::database::Database;
|
||||
use crate::describe::Describe;
|
||||
use crate::error::Error;
|
||||
use crate::executor::{Execute, Executor};
|
||||
use either::Either;
|
||||
use futures_core::future::BoxFuture;
|
||||
use futures_core::stream::BoxStream;
|
||||
use futures_util::{StreamExt, TryStreamExt};
|
||||
|
||||
impl<'c> Executor<'c> for &'c mut AnyConnection {
|
||||
type Database = Any;
|
||||
|
@ -126,9 +126,7 @@ impl<'c> Executor<'c> for &'c mut AnyConnection {
|
|||
Box::pin(async move {
|
||||
Ok(match &mut self.0 {
|
||||
#[cfg(feature = "postgres")]
|
||||
AnyConnectionKind::Postgres(conn) => {
|
||||
conn.describe(sql).await.map(map_describe)?
|
||||
}
|
||||
AnyConnectionKind::Postgres(conn) => conn.describe(sql).await.map(map_describe)?,
|
||||
|
||||
#[cfg(feature = "mysql")]
|
||||
AnyConnectionKind::MySql(conn) => conn.describe(sql).await.map(map_describe)?,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use crate::any::{
|
||||
AnyArgumentBuffer, AnyArguments, AnyColumn, AnyConnection, AnyDone, AnyRow,
|
||||
AnyArgumentBuffer, AnyArguments, AnyColumn, AnyConnection, AnyDone, AnyRow, AnyStatement,
|
||||
AnyTransactionManager, AnyTypeInfo, AnyValue, AnyValueRef,
|
||||
AnyStatement,
|
||||
};
|
||||
use crate::database::{Database, HasArguments, HasStatement, HasStatementCache, HasValueRef};
|
||||
|
||||
|
|
|
@ -17,17 +17,16 @@ mod done;
|
|||
mod kind;
|
||||
mod options;
|
||||
pub(crate) mod row;
|
||||
mod statement;
|
||||
mod transaction;
|
||||
pub(crate) mod type_info;
|
||||
pub mod types;
|
||||
mod statement;
|
||||
pub(crate) mod value;
|
||||
|
||||
#[cfg(feature = "migrate")]
|
||||
mod migrate;
|
||||
|
||||
pub use arguments::{AnyArgumentBuffer, AnyArguments};
|
||||
pub use statement::AnyStatement;
|
||||
pub use column::{AnyColumn, AnyColumnIndex};
|
||||
pub use connection::AnyConnection;
|
||||
pub use database::Any;
|
||||
|
@ -38,6 +37,7 @@ pub use kind::AnyKind;
|
|||
pub use options::AnyConnectOptions;
|
||||
pub use r#type::AnyType;
|
||||
pub use row::AnyRow;
|
||||
pub use statement::AnyStatement;
|
||||
pub use transaction::AnyTransactionManager;
|
||||
pub use type_info::AnyTypeInfo;
|
||||
pub use value::{AnyValue, AnyValueRef};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::any::{Any, AnyColumnIndex, AnyColumn};
|
||||
use crate::any::{Any, AnyColumn, AnyColumnIndex};
|
||||
use crate::column::ColumnIndex;
|
||||
use crate::database::HasValueRef;
|
||||
use crate::error::Error;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use crate::any::{Any, AnyTypeInfo, AnyColumn, AnyArguments, AnyColumnIndex};
|
||||
use crate::statement::Statement;
|
||||
use crate::any::{Any, AnyArguments, AnyColumn, AnyColumnIndex, AnyTypeInfo};
|
||||
use crate::column::ColumnIndex;
|
||||
use either::Either;
|
||||
use std::sync::Arc;
|
||||
use hashbrown::HashMap;
|
||||
use crate::ext::ustr::UStr;
|
||||
use std::borrow::Cow;
|
||||
use crate::error::Error;
|
||||
use crate::ext::ustr::UStr;
|
||||
use crate::statement::Statement;
|
||||
use either::Either;
|
||||
use hashbrown::HashMap;
|
||||
use std::borrow::Cow;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct AnyStatement<'q> {
|
||||
pub(crate) sql: Cow<'q, str>,
|
||||
|
@ -35,7 +35,7 @@ impl<'q> Statement<'q> for AnyStatement<'q> {
|
|||
match &self.parameters {
|
||||
Some(Either::Left(types)) => Some(Either::Left(&types)),
|
||||
Some(Either::Right(count)) => Some(Either::Right(*count)),
|
||||
None => None
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::any::{Any, AnyTypeInfo};
|
||||
use crate::database::HasValueRef;
|
||||
use std::borrow::Cow;
|
||||
use crate::value::{Value, ValueRef};
|
||||
use std::borrow::Cow;
|
||||
|
||||
#[cfg(feature = "postgres")]
|
||||
use crate::postgres::{PgValue, PgValueRef};
|
||||
|
|
|
@ -61,7 +61,12 @@ impl<'q> From<MssqlStatement<'q>> for crate::any::AnyStatement<'q> {
|
|||
#[inline]
|
||||
fn from(statement: MssqlStatement<'q>) -> Self {
|
||||
crate::any::AnyStatement::<'q> {
|
||||
columns: statement.metadata.columns.iter().map(|col| col.clone().into()).collect(),
|
||||
columns: statement
|
||||
.metadata
|
||||
.columns
|
||||
.iter()
|
||||
.map(|col| col.clone().into())
|
||||
.collect(),
|
||||
column_names: std::sync::Arc::new(statement.metadata.column_names.clone()),
|
||||
parameters: None,
|
||||
sql: statement.sql,
|
||||
|
|
|
@ -63,7 +63,12 @@ impl<'q> From<MySqlStatement<'q>> for crate::any::AnyStatement<'q> {
|
|||
#[inline]
|
||||
fn from(statement: MySqlStatement<'q>) -> Self {
|
||||
crate::any::AnyStatement::<'q> {
|
||||
columns: statement.metadata.columns.iter().map(|col| col.clone().into()).collect(),
|
||||
columns: statement
|
||||
.metadata
|
||||
.columns
|
||||
.iter()
|
||||
.map(|col| col.clone().into())
|
||||
.collect(),
|
||||
column_names: statement.metadata.column_names,
|
||||
parameters: Some(Either::Right(statement.metadata.parameters)),
|
||||
sql: statement.sql,
|
||||
|
|
|
@ -63,9 +63,21 @@ impl<'q> From<PgStatement<'q>> for crate::any::AnyStatement<'q> {
|
|||
#[inline]
|
||||
fn from(statement: PgStatement<'q>) -> Self {
|
||||
crate::any::AnyStatement::<'q> {
|
||||
columns: statement.metadata.columns.iter().map(|col| col.clone().into()).collect(),
|
||||
columns: statement
|
||||
.metadata
|
||||
.columns
|
||||
.iter()
|
||||
.map(|col| col.clone().into())
|
||||
.collect(),
|
||||
column_names: std::sync::Arc::new(statement.metadata.column_names.clone()),
|
||||
parameters: Some(Either::Left(statement.metadata.parameters.iter().map(|ty| ty.clone().into()).collect())),
|
||||
parameters: Some(Either::Left(
|
||||
statement
|
||||
.metadata
|
||||
.parameters
|
||||
.iter()
|
||||
.map(|ty| ty.clone().into())
|
||||
.collect(),
|
||||
)),
|
||||
sql: statement.sql,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,11 @@ impl<'q> From<SqliteStatement<'q>> for crate::any::AnyStatement<'q> {
|
|||
#[inline]
|
||||
fn from(statement: SqliteStatement<'q>) -> Self {
|
||||
crate::any::AnyStatement::<'q> {
|
||||
columns: statement.columns.iter().map(|col| col.clone().into()).collect(),
|
||||
columns: statement
|
||||
.columns
|
||||
.iter()
|
||||
.map(|col| col.clone().into())
|
||||
.collect(),
|
||||
column_names: statement.column_names,
|
||||
parameters: Some(Either::Right(statement.parameters)),
|
||||
sql: statement.sql,
|
||||
|
|
|
@ -276,16 +276,24 @@ async fn it_can_bind_only_null_issue_540() -> anyhow::Result<()> {
|
|||
async fn it_can_bind_and_return_years() -> anyhow::Result<()> {
|
||||
let mut conn = new::<MySql>().await?;
|
||||
|
||||
conn.execute(r#"
|
||||
conn.execute(
|
||||
r#"
|
||||
CREATE TEMPORARY TABLE too_many_years (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
the YEAR NOT NULL
|
||||
);
|
||||
"#).await?;
|
||||
"#,
|
||||
)
|
||||
.await?;
|
||||
|
||||
sqlx::query(r#"
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO too_many_years ( the ) VALUES ( ? );
|
||||
"#).bind(2142).execute(&mut conn).await?;
|
||||
"#,
|
||||
)
|
||||
.bind(2142)
|
||||
.execute(&mut conn)
|
||||
.await?;
|
||||
|
||||
let the: u16 = sqlx::query_scalar("SELECT the FROM too_many_years")
|
||||
.fetch_one(&mut conn)
|
||||
|
|
Loading…
Reference in a new issue