private async Task <DbTable <SequentialKey> > CreateSequentialKeyTempTableAsync(DbSession dbSession, CancellationToken cancellationToken) { var sequentialKey = new SequentialKey(Model); var selectStatement = GetSequentialKeySelectStatement(sequentialKey); return(await selectStatement.ToTempTableAsync(sequentialKey, dbSession, cancellationToken)); }
/// <inheritdoc/> public override DbSelectStatement GetSequentialKeySelectStatement(SequentialKey sequentialKey) { var primaryKey = Model.PrimaryKey; Debug.Assert(primaryKey != null); var selectItems = new ColumnMapping[primaryKey.Count]; for (int i = 0; i < selectItems.Length; i++) { selectItems[i] = new ColumnMapping(Select[primaryKey[i].Column.Ordinal].SourceExpression, sequentialKey.Columns[i]); } return(new DbSelectStatement(sequentialKey, selectItems, From, Where, GroupBy, Having, OrderBy, Offset, Fetch)); }
/// <inheritdoc/> public override DbSelectStatement GetSequentialKeySelectStatement(SequentialKey sequentialKey) { var primaryKey = Model.PrimaryKey; Debug.Assert(primaryKey != null); var select = new ColumnMapping[primaryKey.Count]; for (int i = 0; i < select.Length; i++) { select[i] = new ColumnMapping(primaryKey[i].Column, sequentialKey.Columns[i]); } return(new DbSelectStatement(sequentialKey, select, this, null, null, null, null, -1, -1)); }
/// <summary> /// Gets the SQL SELECT statement of the sequential key table. /// </summary> /// <param name="sequentialKey"></param> /// <returns></returns> public abstract DbSelectStatement GetSequentialKeySelectStatement(SequentialKey sequentialKey);