2013-07-24 05:35:32 +00:00
|
|
|
|
using Marr.Data.QGen.Dialects;
|
|
|
|
|
|
|
|
|
|
namespace Marr.Data.QGen
|
2013-03-30 21:56:34 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This class creates a SQL delete query.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DeleteQuery : IQuery
|
|
|
|
|
{
|
|
|
|
|
protected Table TargetTable { get; set; }
|
|
|
|
|
protected string WhereClause { get; set; }
|
2013-07-24 05:35:32 +00:00
|
|
|
|
protected Dialect Dialect { get; set; }
|
2013-03-30 21:56:34 +00:00
|
|
|
|
|
2013-07-24 05:35:32 +00:00
|
|
|
|
public DeleteQuery(Dialect dialect, Table targetTable, string whereClause)
|
2013-03-30 21:56:34 +00:00
|
|
|
|
{
|
|
|
|
|
Dialect = dialect;
|
|
|
|
|
TargetTable = targetTable;
|
|
|
|
|
WhereClause = whereClause;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Generate()
|
|
|
|
|
{
|
|
|
|
|
return string.Format("DELETE FROM {0} {1} ",
|
|
|
|
|
Dialect.CreateToken(TargetTable.Name),
|
|
|
|
|
WhereClause);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|