Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues-179 Add support for view #293

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
issues-179 applied clippy fixes
  • Loading branch information
Jonas Weigand committed May 3, 2024
commit a29a9949893a1a22955059a324deecb5c0cac55f
5 changes: 4 additions & 1 deletion src/backend/query_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 993,10 @@ pub trait QueryBuilder: QuotedBuilder EscapeBuilder TableRefBuilder {
Value::Bytes(Some(v)) => write!(
s,
"x'{}'",
v.iter().map(|b| format!("{:02X}", b)).collect::<String>()
v.iter().fold(String::new(), |mut output, b| {
let _ = write!(output, "{:02X}", b);
output
})
)
.unwrap(),
#[cfg(feature = "with-json")]
Expand Down
1 change: 0 additions & 1 deletion src/extension/postgres/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 1,5 @@
pub use expr::*;
pub use func::*;
pub use interval::*;
pub use types::*;

use crate::types::BinOper;
Expand Down
2 changes: 1 addition & 1 deletion src/query/returning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 21,7 @@ pub struct Returning;
impl Returning {
/// Constructs a new [`Returning`].
pub fn new() -> Self {
Self::default()
Self
}

/// Constructs a new [`ReturningClause::All`].
Expand Down
5 changes: 2 additions & 3 deletions src/query/with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,6 @@ use crate::SubQueryBuilder;
use crate::SubQueryStatement;
use crate::TableRef;
use crate::{Alias, QueryBuilder};
use std::ops::Deref;

/// A table definition inside a WITH clause ([WithClause]).
///
Expand Down Expand Up @@ -122,8 121,8 @@ impl CommonTableExpression {
pub fn from_select(select: SelectStatement) -> Self {
let mut cte = Self::default();
cte.try_set_cols_from_selects(&select.selects);
if let Some(from) = select.from.get(0) {
match from.deref() {
if let Some(from) = select.from.first() {
match from {
TableRef::Table(iden) => cte.set_table_name_from_select(iden),
TableRef::SchemaTable(_, iden) => cte.set_table_name_from_select(iden),
TableRef::DatabaseSchemaTable(_, _, iden) => cte.set_table_name_from_select(iden),
Expand Down
12 changes: 2 additions & 10 deletions src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 107,7 @@ impl Tokenizer {
self.inc();
}
} else if !first {
if !escape && Self::is_escape_char(c) {
escape = true;
} else {
escape = false;
}
escape = !escape && Self::is_escape_char(c);
write!(string, "{}", c).unwrap();
self.inc();
} else {
Expand Down Expand Up @@ -149,11 145,7 @@ impl Tokenizer {
self.inc();
}
} else if !first {
if !escape && Self::is_escape_char(c) {
escape = true;
} else {
escape = false;
}
escape = !escape && Self::is_escape_char(c);
write!(string, "{}", c).unwrap();
self.inc();
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 401,7 @@ impl Iden for Alias {

impl NullAlias {
pub fn new() -> Self {
Self::default()
Self
}
}

Expand Down