Rowsets

行集(Rowsets)

行集是一個重要的對象,它使OLE DB組件以表格形式導出(expose)及操作數據。行集對象是行的集合,每行由數據列構成。

CoType TRowset {
   [mandatory]   interface IAccessor;
   [mandatory]   interface IColumnsInfo;
   [mandatory]   interface IConvertType;
   [mandatory]   interface IRowset;
   [mandatory]   interface IRowsetInfo;
   [optional]    interface IChapteredRowset;
   [optional]    interface IColumnsInfo2;
   [optional]    interface IColumnsRowset;
   [optional]    interface IConnectionPointContainer;
   [optional]    interface IDBAsynchStatus;
   [optional]    interface IGetRow;
   [optional]    interface IRowsetChange;
   [optional]    interface IRowsetChapterMember;
   [optional]    interface IRowsetCurrentIndex;
   [optional]    interface IRowsetFind;
   [optional]    interface IRowsetIdentity;
   [optional]    interface IRowsetIndex;
   [optional]    interface IRowsetLocate;
   [optional]    interface IRowsetRefresh;
   [optional]    interface IRowsetScroll;
   [optional]    interface IRowsetUpdate;
   [optional]    interface IRowsetView;
   [optional]    interface ISupportErrorInfo;
   [optional]    interface IRowsetBookmark;
}

創建行集
消費者可以使用如下方法之一獲取行集對象:

  • 在當前會晤對象中調用IOpenRowSet::OpenRowset直接創建行集對象。所有提供者都必須支持IOpenRowset接口。
  • 在會晤對象中調用IDBCreateCommand::CreateCommand獲取命令對象。然後在命令對象中調用ICommand::Execute。如果只有一個命令,返回結果行。例如一個SQL SELECT語句,ICommand::Execute返回一個行集,或消費者請求了IMultipleResults將返回多個結果對象。
  • 消費者調用方法返回行集或計劃行集(schema rowset)例如IColumnsRowset::GetColumnsRowset, IDBSchemaRowset::GetRowset, IViewRowset::OpenViewRowset, 或 ISourcesRowset::GetSourcesRowset.
  • 消費者調用其它方法返回與行集類似的表格式的結果(returns tablular results as a rowset)。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章