ali
April 20, 2017, 4:49am
1
public class QueryOA_BZKS : QueryDb<OA_BZKS>
{
}
I used the autoquery viewer , If the table OA_BZKS in Sqlserver, It works fine,
and I get the sql code is
2017-04-20 12:52:11.4731 【DEBUG】 【OrmLiteReadCommandExtensions】 SQL: SELECT COUNT(*) "COUNT(*)"
FROM "OA_BZKS"
If I changed the code to below, the ehos is oracle connection
[ConnectionInfo(NamedConnection = "ehos")]
public class QueryOA_BZKS : QueryDb<OA_BZKS>
{
}
In the autoquery viewer it will get error
And In the log file I found it has two COUNT(*) , compare to sqlserver It has lose “” , how to fix it?
2017-04-20 12:53:04.2791 【DEBUG】 【OrmLiteReadCommandExtensions】 SQL: SELECT COUNT(*) COUNT(*)
FROM OA_BZKS
2017-04-20 12:53:04.2791 【ERROR】 【AppHost】 系统级错误NLog DEMO ORA-00923: 未找到要求的 FROM 关键字
mythz
April 20, 2017, 8:32am
2
Unfortunately that’s a limitation of Oracle which we don’t support.
ali
April 20, 2017, 10:22am
3
why sqlserver can generate the right sql code , can change the oracle code to run?
mythz
April 20, 2017, 11:09am
4
We don’t develop, maintain or support the Oracle Provider. We don’t have an Oracle instance available or anyway to test what impact any changes have so we can’t debug or make any changes to it. The Oracle provider has historically been maintained by the community that still need to use Oracle.
ali
April 20, 2017, 1:45pm
5
I know, can you tell me what the source code in sqlserver genenrate the right sql code
2017-04-20 12:52:11.4731 【DEBUG】 【OrmLiteReadCommandExtensions】 SQL: SELECT COUNT() "COUNT( )"
FROM “OA_BZKS”
I want to change the oracle code by myself
mythz
April 20, 2017, 2:30pm
6
The ResponseFilter and IncludeAggregates is used to construct the aggregate query that contains Count(*)
.
ali
April 23, 2017, 12:40am
7
Thanks, I have found the problem,
GetQuotedName
the OracleOrmLiteDialectProvider not Quote the name
private bool WillQuote(string name)
{
return QuoteNames || ReservedNames.Contains(name.ToUpper())
|| name.Contains(" ");
}
private string Quote(string name)
{
return WillQuote(name) ? string.Format("\"{0}\"", name) : name;
}
public override string GetQuotedName(string fieldName)
{
return Quote(fieldName);
}
I have change the WillQuote to the below, It works!
private bool WillQuote(string name)
{
if (name == "COUNT(*)")
return true;
return QuoteNames || ReservedNames.Contains(name.ToUpper())
|| name.Contains(" ");
}