Handle the case when there is no placeholder

This commit is contained in:
gwenn 2023-12-23 11:42:38 +01:00
parent fea3d1051f
commit 1e73859eb3
2 changed files with 8 additions and 1 deletions

View File

@ -48,7 +48,7 @@ fn try_bind(input: TokenStream) -> Result<TokenStream> {
return Err(err.to_string());
}
if info.count == 0 {
return Ok(input);
return Ok(TokenStream::new());
}
if info.count as usize != info.names.len() {
return Err("Mixing named and numbered parameters is not supported.".to_string());

View File

@ -20,6 +20,13 @@ fn test_literal() -> Result {
Ok(())
}
#[test]
fn test_no_placeholder() -> Result {
let _stmt = Stmt;
__bind!(_stmt "SELECT 1");
Ok(())
}
/* FIXME
#[test]
fn test_raw_string() {