本文整理汇总了C#中System.IO.StringWriter.AppendQuoteName方法的典型用法代码示例。如果您正苦于以下问题:C# StringWriter.AppendQuoteName方法的具体用法?C# StringWriter.AppendQuoteName怎么用?C# StringWriter.AppendQuoteName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.StringWriter
的用法示例。
在下文中一共展示了StringWriter.AppendQuoteName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateUpdateSQL
private string GenerateUpdateSQL(IList<RdbColumn> lobColumns)
{
var sql = new StringWriter();
sql.Write("UPDATE ");
sql.AppendQuoteName(this);
sql.Write(" SET ");
bool comma = false;
var paramIndex = 0;
//先更新所有非 lob 字段。
for (int i = 0, c = _columns.Count; i < c; i++)
{
var column = _columns[i];
if (!column.Info.IsPrimaryKey && !column.IsLOB)
{
if (comma) { sql.Write(','); }
else { comma = true; }
sql.AppendQuote(this, column.Name).Write(" = {");
sql.Write(paramIndex++);
sql.Write('}');
}
}
//再更新所有 lob 字段。
if (lobColumns != null)
{
for (int i = 0, c = lobColumns.Count; i < c; i++)
{
if (comma) { sql.Write(','); }
else { comma = true; }
var column = lobColumns[i];
sql.AppendQuote(this, column.Name);
sql.Write(" = {");
sql.Write(paramIndex++);
sql.Write('}');
}
}
sql.Write(" WHERE ");
sql.AppendQuote(this, _pkColumn.Name);
sql.Write(" = {");
sql.Write(paramIndex);
sql.Write('}');
return sql.ToString();
}
示例2: GenerateDeleteSQL
private string GenerateDeleteSQL()
{
var sql = new StringWriter();
sql.Write("DELETE FROM ");
sql.AppendQuoteName(this);
sql.Write(" WHERE ");
sql.AppendQuote(this, this.PKColumn.Name).Write(" = {0}");
return sql.ToString();
}
示例3: GetQuoteName
internal string GetQuoteName()
{
var sql = new StringWriter();
sql.AppendQuoteName(this);
return sql.ToString();
}
示例4: Delete
internal int Delete(IDbAccesser dba, IConstraint where)
{
if (where == null) throw new ArgumentNullException("where");
EnsureMappingTable();
var sql = new StringWriter();
sql.Write("DELETE FROM ");
sql.AppendQuoteName(this);
sql.Write(" WHERE ");
var generator = this.CreateSqlGenerator();
generator.Generate(where as SqlNode);
var whereSql = generator.Sql;
sql.Write(whereSql.ToString());
return dba.ExecuteText(sql.ToString(), whereSql.Parameters);
}
示例5: GenerateUpdateSQL
/// <summary>
/// 生成 Update 语句。
/// 注意,此方法不会更新 LOB 字段。
/// </summary>
/// <param name="table"></param>
/// <returns></returns>
private string GenerateUpdateSQL(RdbTable table)
{
//代码参考 RdbTable.GenerateUpdateSQL() 方法。
var sql = new StringWriter();
sql.Write("UPDATE ");
sql.AppendQuoteName(table);
sql.Write(" SET ");
var updateLOB = this.UpdateLOB;
bool comma = false;
var columns = table.Columns;
for (int i = 0, c = columns.Count; i < c; i++)
{
var column = columns[i];
if (!column.Info.IsPrimaryKey && (updateLOB || !column.IsLOB))
{
if (comma) { sql.Write(','); }
else { comma = true; }
sql.AppendQuote(table, column.Name).Write(" = @");
sql.Write(column.Name);
}
}
sql.Write(" WHERE ");
sql.AppendQuote(table, table.PKColumn.Name);
sql.Write(" = @");
sql.Write(table.PKColumn.Name);
return sql.ToString();
}
示例6: GetEntityValue
/// <summary>
/// 子类重写此方法,来实现自己的 GetEntityValue 方法的数据层代码。
/// </summary>
/// <param name="entityId"></param>
/// <param name="property"></param>
/// <returns></returns>
public override LiteDataTable GetEntityValue(object entityId, string property)
{
var table = this.DbTable;
var idColumn = table.PKColumn.Name;
var column = table.Translate(property);
var sql = new StringWriter();
sql.Write("SELECT ");
sql.AppendQuote(table, column);
sql.Write(" FROM ");
sql.AppendQuoteName(table);
sql.Write(" WHERE ");
sql.AppendQuote(table, idColumn);
sql.Write(" = {0}");
return this.QueryTable(new TableQueryArgs
{
FormattedSql = sql.ToString(),
Parameters = new object[] { entityId },
});
}