/// <summary> /// Append all the columns we've added to the original query to the schema /// </summary> /// <param name="tbl"></param> internal void AppendSchemaTable(DataTable tbl) { KeyQuery last = null; for (int n = 0; n < _keyInfo.Length; n++) { if (_keyInfo[n].query == null || _keyInfo[n].query != last) { last = _keyInfo[n].query; if (last == null) // ROWID aliases are treated special { DataRow row = tbl.NewRow(); row[SchemaTableColumn.ColumnName] = _keyInfo[n].columnName; row[SchemaTableColumn.ColumnOrdinal] = tbl.Rows.Count; row[SchemaTableColumn.ColumnSize] = 8; row[SchemaTableColumn.NumericPrecision] = 255; row[SchemaTableColumn.NumericScale] = 255; row[SchemaTableColumn.ProviderType] = DbType.Int64; row[SchemaTableColumn.IsLong] = false; row[SchemaTableColumn.AllowDBNull] = false; row[SchemaTableOptionalColumn.IsReadOnly] = false; row[SchemaTableOptionalColumn.IsRowVersion] = false; row[SchemaTableColumn.IsUnique] = false; row[SchemaTableColumn.IsKey] = true; row[SchemaTableColumn.DataType] = typeof(Int64); row[SchemaTableOptionalColumn.IsHidden] = true; row[SchemaTableColumn.BaseColumnName] = _keyInfo[n].columnName; row[SchemaTableColumn.IsExpression] = false; row[SchemaTableColumn.IsAliased] = false; row[SchemaTableColumn.BaseTableName] = _keyInfo[n].tableName; row[SchemaTableOptionalColumn.BaseCatalogName] = _keyInfo[n].databaseName; row[SchemaTableOptionalColumn.IsAutoIncrement] = true; row["DataTypeName"] = "integer"; tbl.Rows.Add(row); } else { last.Sync(0); using (DataTable tblSub = last._reader.GetSchemaTable()) { foreach (DataRow row in tblSub.Rows) { object[] o = row.ItemArray; DataRow newrow = tbl.Rows.Add(o); newrow[SchemaTableOptionalColumn.IsHidden] = true; newrow[SchemaTableColumn.ColumnOrdinal] = tbl.Rows.Count - 1; } } } } } }
internal void AppendSchemaTable(DataTable tbl) { KeyQuery query = null; for (int i = 0; i < this._keyInfo.Length; i++) { if ((this._keyInfo[i].query == null) || (this._keyInfo[i].query != query)) { query = this._keyInfo[i].query; if (query == null) { DataRow row = tbl.NewRow(); row[SchemaTableColumn.ColumnName] = this._keyInfo[i].columnName; row[SchemaTableColumn.ColumnOrdinal] = tbl.Rows.Count; row[SchemaTableColumn.ColumnSize] = 8; row[SchemaTableColumn.NumericPrecision] = 0xff; row[SchemaTableColumn.NumericScale] = 0xff; row[SchemaTableColumn.ProviderType] = DbType.Int64; row[SchemaTableColumn.IsLong] = false; row[SchemaTableColumn.AllowDBNull] = false; row[SchemaTableOptionalColumn.IsReadOnly] = false; row[SchemaTableOptionalColumn.IsRowVersion] = false; row[SchemaTableColumn.IsUnique] = false; row[SchemaTableColumn.IsKey] = true; row[SchemaTableColumn.DataType] = typeof(long); row[SchemaTableOptionalColumn.IsHidden] = true; row[SchemaTableColumn.BaseColumnName] = this._keyInfo[i].columnName; row[SchemaTableColumn.IsExpression] = false; row[SchemaTableColumn.IsAliased] = false; row[SchemaTableColumn.BaseTableName] = this._keyInfo[i].tableName; row[SchemaTableOptionalColumn.BaseCatalogName] = this._keyInfo[i].databaseName; row[SchemaTableOptionalColumn.IsAutoIncrement] = true; row["DataTypeName"] = "integer"; tbl.Rows.Add(row); } else { query.Sync(0L); using (DataTable table = query._reader.GetSchemaTable()) { foreach (DataRow row2 in table.Rows) { object[] itemArray = row2.ItemArray; DataRow row3 = tbl.Rows.Add(itemArray); row3[SchemaTableOptionalColumn.IsHidden] = true; row3[SchemaTableColumn.ColumnOrdinal] = tbl.Rows.Count - 1; } } } } } }
internal void Sync() { if (!this._isValid) { KeyQuery query = null; for (int i = 0; i < this._keyInfo.Length; i++) { if ((this._keyInfo[i].query == null) || (this._keyInfo[i].query != query)) { query = this._keyInfo[i].query; if (query != null) { query.Sync(this._stmt._sql.GetRowIdForCursor(this._stmt, this._keyInfo[i].cursor)); } } } this._isValid = true; } }
/// <summary> /// Make sure all the subqueries are open and ready and sync'd with the current rowid /// of the table they're supporting /// </summary> internal void Sync() { if (_isValid == true) { return; } KeyQuery last = null; for (int n = 0; n < _keyInfo.Length; n++) { if (_keyInfo[n].query == null || _keyInfo[n].query != last) { last = _keyInfo[n].query; if (last != null) { last.Sync(_stmt._sql.GetRowIdForCursor(_stmt, _keyInfo[n].cursor)); } } } _isValid = true; }