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

About use query! and query_as! #2861

Closed
moom-en opened this issue Nov 7, 2023 · 2 comments
Closed

About use query! and query_as! #2861

moom-en opened this issue Nov 7, 2023 · 2 comments
Labels

Comments

@moom-en
Copy link

moom-en commented Nov 7, 2023

Bug Description

let mut sql = String::from("select * from user");
// append sql content
...
let arr = sqlx::query!(sql.as_str()).fetch_all(pool).await?;(error: expected string literal)
but:
let arr = sqlx::query!("select * from user").fetch_all(pool).await?;(it's ok)

Minimal Reproduction

A small code snippet or a link to a Github repo or Gist, with instructions on reproducing the bug.

Info

  • SQLx version: 0.7.2
  • SQLx features enabled: runtime-tokio、mysql
  • Database server and version: MySQL
  • Operating system: windows 10
  • rustc --version: 1.73.0
@moom-en moom-en added the bug label Nov 7, 2023
@moom-en
Copy link
Author

moom-en commented Nov 7, 2023

I want dynamics append sql content, rather than fixed content

@abonander
Copy link
Collaborator

Duplicate of #1488

@abonander abonander marked this as a duplicate of #1488 Nov 7, 2023
@abonander abonander closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants