本文整理汇总了C#中IDbProvider.EscapeColumnName方法的典型用法代码示例。如果您正苦于以下问题:C# IDbProvider.EscapeColumnName方法的具体用法?C# IDbProvider.EscapeColumnName怎么用?C# IDbProvider.EscapeColumnName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDbProvider
的用法示例。
在下文中一共展示了IDbProvider.EscapeColumnName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateSql
public string GenerateSql(IDbProvider provider, string parameterPrefix, BuilderData data)
{
var setSql = "";
foreach (var column in data.Columns)
{
if (setSql.Length > 0)
setSql += ", ";
setSql += string.Format("{0} = {1}{2}",
provider.EscapeColumnName(column.ColumnName),
parameterPrefix,
column.ParameterName);
}
var whereSql = "";
foreach (var column in data.Where)
{
if (whereSql.Length > 0)
whereSql += " and ";
whereSql += string.Format("{0} = {1}{2}",
provider.EscapeColumnName(column.ColumnName),
parameterPrefix,
column.ParameterName);
}
var sql = string.Format("update {0} set {1} where {2}",
data.ObjectName,
setSql,
whereSql);
return sql;
}
示例2: GenerateSql
public string GenerateSql(IDbProvider provider, string parameterPrefix, BuilderData data)
{
//mod by liuhuisheng start
//var whereSql = "";
var whereSql = data.WhereSql;
//mod by liuhuisheng end
foreach (var column in data.Columns)
{
if (whereSql.Length > 0)
whereSql += " and ";
whereSql += string.Format("{0} = {1}{2}",
provider.EscapeColumnName(column.ColumnName),
parameterPrefix,
column.ParameterName);
}
var sql = string.Format("delete from {0} where {1}", data.ObjectName, whereSql);
return sql;
}
示例3: GenerateSql
public string GenerateSql(IDbProvider provider, string parameterPrefix, BuilderData data)
{
var insertSql = "";
var valuesSql = "";
foreach (var column in data.Columns)
{
if (insertSql.Length > 0)
{
insertSql += ",";
valuesSql += ",";
}
insertSql += provider.EscapeColumnName(column.ColumnName);
valuesSql += parameterPrefix + column.ParameterName;
}
var sql = string.Format("insert into {0}({1}) values({2})",
data.ObjectName,
insertSql,
valuesSql);
return sql;
}