Interface ISqlBlockAdapter
SQL block adapter
Namespace: XData.Database.SqlBlock
Assembly: XData.docfx.dll
Syntax
public interface ISqlBlockAdapter
Methods
| Improve this Doc View SourceBlock(Expression<Func<ISqlBlockAdapter, ISqlBlock>>[])
Complex SQL block fences BEGIN...END
Declaration
ISqlBlock Block(params Expression<Func<ISqlBlockAdapter, ISqlBlock>>[] blocks)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<ISqlBlockAdapter, ISqlBlock>>[] | blocks | Contained SQL blocks |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
See Also
Block(String)
Custom SQL block
Declaration
ISqlBlock Block(string customSqlBlock)
Parameters
Type | Name | Description |
---|---|---|
String | customSqlBlock | Custom SQL block code |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
See Also
Block<T>(Expression<Func<ISqlBlockAdapter<T>, ISqlBlock>>[])
Complex SQL block fences BEGIN...END
Declaration
ISqlBlock Block<T>(params Expression<Func<ISqlBlockAdapter<T>, ISqlBlock>>[] blocks)
where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<ISqlBlockAdapter<T>, ISqlBlock>>[] | blocks | Contained SQL blocks |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
T | Returned object type |
See Also
Declare(Expression<Func<ISqlVariable, ISqlValue>>[])
Declare variables SQL block
Declaration
ISqlBlock Declare(params Expression<Func<ISqlVariable, ISqlValue>>[] variables)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<ISqlVariable, ISqlValue>>[] | variables | Variable declaration descriptions |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
See Also
Delete(Expression<Func<IBlockQueryStructure, IBlockQueryStructure>>)
DELETE SQL block
Declaration
ISqlBlock Delete(Expression<Func<IBlockQueryStructure, IBlockQueryStructure>> query)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<IBlockQueryStructure, IBlockQueryStructure>> | query | Delete query structure |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
See Also
ForEach<T>(Expression<Func<IBlockQueryStructure, IBlockQueryDescription<T>>>, String, Expression<Func<ISqlBlockAdapter, ISqlBlock>>, Expression<Action<ILoopVariableAdapter<T>>>[])
Cursor iteration SQL block
Declaration
ISqlBlock ForEach<T>(Expression<Func<IBlockQueryStructure, IBlockQueryDescription<T>>> selectQuery, string cursorName, Expression<Func<ISqlBlockAdapter, ISqlBlock>> body, params Expression<Action<ILoopVariableAdapter<T>>>[] mapping)
where T : class
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<IBlockQueryStructure, IBlockQueryDescription<T>>> | selectQuery | Cursor query description |
String | cursorName | Cursor name |
Expression<Func<ISqlBlockAdapter, ISqlBlock>> | body | Loop body SQL block |
Expression<Action<ILoopVariableAdapter<T>>>[] | mapping | Loop variables mapping |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
T | Cursor mapped type |
See Also
If(Expression<Func<IBlockQueryStructure, IBlockQueryStructure>>, FilterOperation, Expression<Func<ISqlBlockAdapter, ISqlBlock>>[])
IF [NOT] EXISTS(...) SQL block
Declaration
ISqlBlock If(Expression<Func<IBlockQueryStructure, IBlockQueryStructure>> existsStructure, FilterOperation operation, params Expression<Func<ISqlBlockAdapter, ISqlBlock>>[] parts)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<IBlockQueryStructure, IBlockQueryStructure>> | existsStructure | Exists select structure |
FilterOperation | operation | |
Expression<Func<ISqlBlockAdapter, ISqlBlock>>[] | parts | True-part SQL block and (optionally) false-part SQL block |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
See Also
If<T>(Expression<Func<ISqlValueAdapter, ISqlValue<T>>>, Expression<Func<ISqlValueAdapter, ISqlValue<T>>>, FilterOperation, Expression<Func<ISqlBlockAdapter, ISqlBlock>>[])
IF SQL block
Declaration
ISqlBlock If<T>(Expression<Func<ISqlValueAdapter, ISqlValue<T>>> check, Expression<Func<ISqlValueAdapter, ISqlValue<T>>> value, FilterOperation oper, params Expression<Func<ISqlBlockAdapter, ISqlBlock>>[] parts)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<ISqlValueAdapter, ISqlValue<T>>> | check | SQL value to check |
Expression<Func<ISqlValueAdapter, ISqlValue<T>>> | value | SQL value to compare with |
FilterOperation | oper | Comparision operation |
Expression<Func<ISqlBlockAdapter, ISqlBlock>>[] | parts | True-part SQL block and (optionally) false-part SQL block |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
T |
See Also
Insert<TResult>(String, DataTable, Expression<Func<ISetBlockAdapter, TResult>>)
INSERT INTO...VALUES(...),VALUES(...)... SQL block
Declaration
ISqlBlock Insert<TResult>(string tableName, DataTable data, Expression<Func<ISetBlockAdapter, TResult>> mapper)
where TResult : class
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Table to insert |
DataTable | data | Data table filled by data
|
Expression<Func<ISetBlockAdapter, TResult>> | mapper | Fields to insert values mapper |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
TResult |
See Also
Insert<T>(String, Expression<Func<IBlockQueryStructure, IBlockQueryDescription<T>>>)
INSERT INTO... SELECT SQL block
Declaration
ISqlBlock Insert<T>(string tableName, Expression<Func<IBlockQueryStructure, IBlockQueryDescription<T>>> selectQuery)
where T : class
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Table to insert |
Expression<Func<IBlockQueryStructure, IBlockQueryDescription<T>>> | selectQuery | Select query description
|
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
T |
See Also
Insert<TResult>(String, Expression<Func<ISetBlockAdapter, TResult>>)
Single INSERT INTO...VALUES SQL block
Declaration
ISqlBlock Insert<TResult>(string tableName, Expression<Func<ISetBlockAdapter, TResult>> mapper)
where TResult : class
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Table to insert |
Expression<Func<ISetBlockAdapter, TResult>> | mapper | Fields to insert values mapper |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
TResult |
See Also
Merge<T>(String, String, String, Expression<Func<IMergeBlockAdapter, T>>)
MERGE SQL block
Declaration
ISqlBlock Merge<T>(string tableName, string targetAlias, string sourceAlias, Expression<Func<IMergeBlockAdapter, T>> mapper)
where T : class
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Table name to merge with |
String | targetAlias | Target table alias |
String | sourceAlias | Data source alias |
Expression<Func<IMergeBlockAdapter, T>> | mapper | Data source mapper
|
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
T |
See Also
Merge<T, TSource>(String, String, Expression<Func<IBlockQueryStructure, IBlockQueryDescription<TSource>>>, String, Expression<Func<IMergeBlockAdapter, T>>)
MERGE SQL block
Declaration
ISqlBlock Merge<T, TSource>(string tableName, string targetAlias, Expression<Func<IBlockQueryStructure, IBlockQueryDescription<TSource>>> sourceQuery, string sourceAlias, Expression<Func<IMergeBlockAdapter, T>> mapper)
where T : class where TSource : class
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Table name to merge with |
String | targetAlias | Target table alias |
Expression<Func<IBlockQueryStructure, IBlockQueryDescription<TSource>>> | sourceQuery | Source subquery description |
String | sourceAlias | Data source alias |
Expression<Func<IMergeBlockAdapter, T>> | mapper | Data source mapper
|
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
T | |
TSource |
See Also
SetVar(Expression<Func<ISetSqlVarAdapter, ISqlValue>>[])
SQL variables initialization SQL block
Declaration
ISqlBlock SetVar(params Expression<Func<ISetSqlVarAdapter, ISqlValue>>[] variables)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<ISetSqlVarAdapter, ISqlValue>>[] | variables | Variable value descriptions |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
See Also
SetVar<TValue>(Expression<Func<IBlockQueryStructure, IBlockQueryDescription<TValue>>>, Expression<Func<ISqlVarAdapter, ISqlValue>>[])
SQL variables initialization using SELECT... INTO statement SQL block
Declaration
ISqlBlock SetVar<TValue>(Expression<Func<IBlockQueryStructure, IBlockQueryDescription<TValue>>> selectQuery, params Expression<Func<ISqlVarAdapter, ISqlValue>>[] variables)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<IBlockQueryStructure, IBlockQueryDescription<TValue>>> | selectQuery | Query description used as data source |
Expression<Func<ISqlVarAdapter, ISqlValue>>[] | variables | Variable value descriptions |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
TValue |
See Also
Update<T>(Expression<Func<IBlockQueryStructure, IBlockQueryStructure>>, Expression<Func<ISetBlockAdapter, T>>)
UPDATE SQL block
Declaration
ISqlBlock Update<T>(Expression<Func<IBlockQueryStructure, IBlockQueryStructure>> query, Expression<Func<ISetBlockAdapter, T>> setExpr)
where T : class
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<IBlockQueryStructure, IBlockQueryStructure>> | query | SQL block query description |
Expression<Func<ISetBlockAdapter, T>> | setExpr | Set expression description |
Returns
Type | Description |
---|---|
ISqlBlock | SQL block description |
Type Parameters
Name | Description |
---|---|
T |