使用Firebird和.Net Firebird提供程序。寻找类似的东西:
using (var cmd = new FbCommand()) {
var parser = new FbParser(someSqlText);
// Add a filter to the where clause. May need code for adding a "where" if there is none or adding an "and" statement, etc.
parser.MainWhereClause += "someTable.someField = @someParam";
// Default some orderby. Add one, etc?
parser.OrderByClause = parser.OrderByClause ?? "customer.name";
parser.SelectFields.Add("customer.phone");
if (parser.GroupByFields.Any()) {
parser.GroupByFields.Add("customer.phone");
}
cmd.CommandText = parser.ToString();
// FbCommand does have a Prepare() method and that does allow that object to know the parameters, but they are private and not accessible.
foreach (var parameterName in parser.Parameters) {
cmd.Parameters.Add(parameterName).Value = GetSomeValue(parameterName);
}
有这样的东西吗?我发现其他SQL风格,但没有理解FB语法,如连接,CTE,派生表等。