|
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace XPeriment.DataAccessTasks
{
public class QueryTask:FieldSetTask
{
private string condition = "";
private List<JoinData> joins = new List<JoinData>();
public List<JoinData> Joins
{
get
{
return joins;
}
set
{
joins = value;
}
}
public string Condition
{
get
{
return condition;
}
set
{
condition = value;
}
}
public QueryTask(string baseTable)
: base(baseTable)
{
}
public void Select(string fieldName, string fieldAlias)
{
Fields.Add(fieldName, new FieldData(fieldName, fieldAlias));
}
public void Select(params string[] fields)
{
foreach (string s in fields)
Fields.Add(s, new FieldData(s, ""));
}
public void InnerJoin(string tableName, string joinCondition)
{
joins.Add(new JoinData(tableName, joinCondition));
}
public void LeftJoin(string tableName, string joinCondition)
{
joins.Add(new JoinData("LEFT", tableName, joinCondition));
}
public void RightJoin(string tableName, string joinCondition)
{
joins.Add(new JoinData("RIGHT", tableName, joinCondition));
}
public void OutterJoin(string tableName, string joinCondition)
{
joins.Add(new JoinData("OUTTER", tableName, joinCondition));
}
public void CrossJoin(string tableName, string joinCondition)
{
joins.Add(new JoinData("CROSS", tableName, joinCondition));
}
public void Where(string filterCondition)
{
condition = filterCondition;
}
public DataTable Execute()
{
return Performer.Run(this);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.