public override string ToSql(ExpressionSqlBuilder builder) { string s = ColumnExpression.ToSql(builder); if (!string.IsNullOrEmpty(InternalDbAlias)) s = s + " AS " + builder.EncodeTable(InternalDbAlias); else if (!string.IsNullOrEmpty(Alias)) s = s + " AS " + builder.EncodeTable(Alias); return s; }
public override string ToSql(ExpressionSqlBuilder builder) { string s = ""; if (!string.IsNullOrEmpty(PhysicalSchema)) { s += builder.EncodeTable(PhysicalSchema) + "."; } s += builder.EncodeTable(PhysicalTableName); return(s); }
public override string ToSql(ExpressionSqlBuilder builder) { StringBuilder sb = new StringBuilder(); sb.Append("update "); if (builder.DbType == DriverType.PostgreSQL) { sb.Append(TableClause.ToSql(builder)); writeSET(sb, builder); } if (builder.DbType == DriverType.SqlServer) { if (string.IsNullOrEmpty(TableClause.Alias)) { sb.Append(TableClause.ToSql(builder)); writeSET(sb, builder); } else { sb.Append(builder.EncodeTable(TableClause.Alias) + " "); writeSET(sb, builder); sb.Append(" from ").Append(TableClause.ToSql(builder)).Append(" "); } } AddReturningToSql1(builder, sb); if (Where != null) { sb.Append(" where ").Append(Where.ToSql(builder)); } AddReturningToSql2(builder, sb); return(sb.ToString()); }
public override string ToSql(ExpressionSqlBuilder builder) { string s = ""; if (Table is ISelect) { s = "(" + Table.ToSql(builder) + ")"; } else { s = Table.ToSql(builder); } if (!string.IsNullOrEmpty(Alias)) { s += " as " + builder.EncodeTable(Alias) + " "; } return(s); }
public override string ToSql(ExpressionSqlBuilder builder) { StringBuilder sb = new StringBuilder(); sb.Append("delete "); if (builder.DbType == DriverType.SqlServer) { if (!string.IsNullOrEmpty(TableClause.Alias)) { sb.Append(builder.EncodeTable(TableClause.Alias)).Append(" "); } } sb.Append("from "); sb.Append(TableClause.ToSql(builder)).Append(" "); AddReturningToSql1(builder, sb); if (Where != null) { sb.Append(" where ").Append(Where.ToSql(builder)); } AddReturningToSql2(builder, sb); return(sb.ToString()); }