-
Notifications
You must be signed in to change notification settings - Fork 857
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
[FreeSql.Provider.ClickHouse] Select.WithSql() => Syntax error: ('@') #1904
Comments
ToLower |
ah, no. My parameter name is written with a lowercase letter, everywhere it appears in the code. The thing is that the github editor read @Prop1 as a nickname, and that's why my error message showed the name 'prop1' with an uppercase letter. |
{ |
My clickhouse server is not available here, but I tested the code using SQL Server and it worked fine. var result1 = fsql.Select<object>().WithSql("select @Prop1 as1", new { Prop1 = 1 }).ToList();
var result2 = fsql.Select<object>().WithSql("select @Prop1 as1", new Dictionary<string, object> { { "Prop1", 1 } }).ToList(); |
debug screenshot with an exception FreeSql config: builder.Services.AddSingleton((provider) =>
{
var connectionString = GetConnectionString(provider);
return new FreeSqlBuilder()
.UseConnectionString(DataType.ClickHouse, connectionString)
.Build();
}) ; An exception was also thrown here: var result3 = await _freeSql.Ado.QueryAsync<object>("select @Prop1 as1, @prop2 as2", new { Prop1 = 1, prop2 = 2 }); But with such a select, everything was successful: ClickHouseDbParameter[] dbParams = [
DbParameter("Prop1", 1),
DbParameter("prop2", 2)
];
var result4 = await _freeSql.Ado.QueryAsync<object>(System.Data.CommandType.Text, "select @Prop1 as1, @prop2 as2", dbParams); @2881099, doesn't that seem strange to you? |
the issue arises precisely when executing a select with parameters via the clickhouse client |
问题描述及重现代码:
数据库版本
ClickHouse: 23.3.2.37
安装的Nuget包
"FreeSql.Provider.ClickHouse" Version="3.2.833"
.net framework/. net core? 及具体版本
net8.0
Error message:
To fix the bug, need to remove the "@" symbol from the parameter name:
FreeSql/Providers/FreeSql.Provider.ClickHouse/ClickHouseUtils.cs
Line 66 in a7ddaff
The text was updated successfully, but these errors were encountered: