QueryImpl Class

The default implementation of Query.

C#
public sealed class QueryImpl : Query
Inheritance
QueryImpl
Implements

Constructors

QueryImpl(Siphon, MetadataBank)

The default implementation of Query.

Methods

SelectAllFrom<T>(string)

Description copied from interface: Query

Selects all columns of the specified table.

Select<T>(string[])

Description copied from interface: Query

Gets the Query.Select<T>(string[]) object to select the specified columns of the specified table.

DeleteFrom<T>()

Description copied from interface: Query

Gets the Query.DeleteFrom<T>() object to delete the specified rows of the specified table.

NewTables(Type[])

Description copied from interface: Query

Creates new tables.

NewTables(IEnumerable<Type>)

Description copied from interface: Query

Creates new tables.

Insert<T>(T)

Description copied from interface: Query

Inserts a new row into the table.

InsertAndGetRowId<T>(T)

Description copied from interface: Query

Inserts a new row into the table and gets its ID.

SelectUnique<T>(string, object)

Description copied from interface: Query

Gets the single row of the table in which the specified unique field matches the specified value.

SelectAll<T>()

Description copied from interface: Query

Gets all the rows of the specified table.

ColumnName<T>(string)

Description copied from interface: Query

Gets the column name associated with the specified parameter.

Update<T>(string)

Description copied from interface: Query

Gets the Update object to update the specified table.

Equals(object) (Inherited from object)
GetHashCode() (Inherited from object)
GetType() (Inherited from object)
MemberwiseClone() (Inherited from object)
ToString() (Inherited from object)

Constructors Detail

QueryImpl(Siphon, MetadataBank)

The default implementation of Query.

C#
public QueryImpl(Siphon siphon, MetadataBank bank)

Parameters

siphon
Siphon

The abstraction of the database connection.

bank
MetadataBank

The cache for the reflection.

Methods Detail

SelectAllFrom<T>(string)

Description copied from interface: Query

Selects all columns of the specified table.

C#
public SelectFrom<T> SelectAllFrom<T>(string alias)

Type Parameters

T
notnull

Parameters

alias
string

Returns

Description copied from interface: Query

The SelectFrom<T> object.

Implements

Select<T>(string[])

Description copied from interface: Query

Gets the Query.Select<T>(string[]) object to select the specified columns of the specified table.

C#
public Select<T> Select<T>(params string[] columns)

Type Parameters

T
notnull

Parameters

columns
string[]

Returns

Description copied from interface: Query

The Query.Select<T>(string[]) object.

Implements

DeleteFrom<T>()

Description copied from interface: Query

Gets the Query.DeleteFrom<T>() object to delete the specified rows of the specified table.

C#
public DeleteFrom<T> DeleteFrom<T>()

Type Parameters

T
notnull

Returns

Description copied from interface: Query

The Query.DeleteFrom<T>() object.

Implements

NewTables(Type[])

Description copied from interface: Query

Creates new tables.

C#
public void NewTables(params Type[] tables)

Parameters

tables
Type[]

Implements

Remarks

Description copied from interface: Query

This method drops the tables if they exist and then creates them newly.

NewTables(IEnumerable<Type>)

Description copied from interface: Query

Creates new tables.

C#
public void NewTables(IEnumerable<Type> allTables)

Parameters

allTables
IEnumerable<Type>

Implements

Remarks

Description copied from interface: Query

This method drops the tables if they exist and then creates them newly.

Insert<T>(T)

Description copied from interface: Query

Inserts a new row into the table.

C#
public void Insert<T>(T row)

Type Parameters

T
notnull

Parameters

row
T

Implements

InsertAndGetRowId<T>(T)

Description copied from interface: Query

Inserts a new row into the table and gets its ID.

C#
public long InsertAndGetRowId<T>(T row)

Type Parameters

T
notnull

Parameters

row
T

Returns

Description copied from interface: Query

The ID of the row newly inserted.

Implements

SelectUnique<T>(string, object)

Description copied from interface: Query

Gets the single row of the table in which the specified unique field matches the specified value.

C#
public T SelectUnique<T>(string columnName, object value)

Type Parameters

T
class

Parameters

columnName
string
value
object

Returns

T

Description copied from interface: Query

The row in which the field specified with columnName matches the specified value if it exists, null otherwise.

Implements

SelectAll<T>()

Description copied from interface: Query

Gets all the rows of the specified table.

C#
public IEnumerable<T> SelectAll<T>()

Type Parameters

T
notnull

Returns

Description copied from interface: Query

All the rows of the specified table.

Implements

Remarks

Description copied from interface: Query

The IEnumerable<T> object returned by this method is valid as long as the transaction is in progress. If you need access to it after the transaction, you must use something like the Enumerable.ToList<TSource>(IEnumerable<TSource>) method to get the list in the meantime and then use it afterward.

ColumnName<T>(string)

Description copied from interface: Query

Gets the column name associated with the specified parameter.

C#
public string ColumnName<T>(string parameterName)

Type Parameters

T
notnull

Parameters

parameterName
string

Returns

Description copied from interface: Query

The column name.

Implements

Update<T>(string)

Description copied from interface: Query

Gets the Update object to update the specified table.

C#
public Update Update<T>(string alias)

Type Parameters

T
notnull

Parameters

alias
string

Returns

Description copied from interface: Query

The Update object.

Implements

Examples

Description copied from interface: Query

var kit = new TransactionKit(
    "update_example.db", m => Console.WriteLine(m()));
var map = new Dictionary<string, object>()
{
    ["$id"] = 2L,
    ["$newState"] = "Closed",
};
kit.Execute(q =>
{
    q.Update<Issue>("i")
        .Set("state = $newState")
        .Where("i.id = $id")
        .Execute(map);
});