Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

INFO: IRowsetResynch is Superceded by IRowsetRefresh


View products that this article applies to.

This article was previously published under Q192014

↑ Back to the top


Summary

The following information is from the Data Access Software Development Kit (SDK) version 2.0 OLREADME file:

IRowsetResynch is an interface defined in OLE DB 1.x that allows consumers to retrieve the current values for rows that may have been changed in the data store since retrieved. In OLE DB 2.0, IRowsetResynch is superceded by IRowsetRefresh, which provides better control over when data values are updated from the data store.

In future releases of OLE DB, a common service component will expose IRowsetRefresh over providers that currently expose only IRowsetResynch. In the interim, consumers can work with legacy providers that support only IRowsetResynch by directly calling that interface. This interface is documented here for those customers.

↑ Back to the top


More information

The following information is from the Readme.txt file:

IRowsetResynch::GetVisibleData

Gets the data in the data source that is visible to the transaction for the specified row.
HRESULT GetVisibleData (
HROW hRow,
HACCESSOR hAccessor,
void * pData);

Parameters

hRow [in]
The handle of the row for which to get the visible data.
This can be the handle of a row with a pending delete.
hAccessor [in]
The handle of the accessor to use. If hAccessor is the handle of a null accessor (cBindings in IAccessor::CreateAccessor was zero), then GetVisibleData does not get any data values.
pData [out]
A pointer to a buffer in which to return the data. The consumer allocates memory for this buffer.
Return Code

S_OK
The method succeeded. The status of all columns bound by the accessor is set to DBSTATUS_S_OK, DBSTATUS_S_ISNULL, or DBSTATUS_S_TRUNCATED.
DB_S_ERRORSOCCURRED
An error occurred while returning data for one or more columns, but data was successfully returned for at least one column.
E_FAIL
A provider-specific error occurred.
E_INVALIDARG
pData was a null pointer and hAccessor was not a null accessor.
E_UNEXPECTED
ITransaction::Commit or ITransaction::Abort was called and the object is in a zombie state.
DB_E_BADACCESSORHANDLE
hAccessor was invalid. It is possible for a reference accessor or an accessor that has a binding that uses provider-owned memory to be invalid for use with this method, even if the accessor is valid for use with IRowset::GetData or IRowsetChange::SetData.
DB_E_BADACCESSORTYPE
The specified accessor was not a row accessor.
DB_E_BADROWHANDLE
hRow was invalid.
DB_E_DELETEDROW
hRow referred to a row for which a deletion had been transmitted to the data source.
DB_E_ERRORSOCCURRED
Errors occurred while returning data for all columns. To determine what errors occurred, the consumer checks the status values.
DB_E_ABORTLIMITREACHED
The provider was unable to retrieve the visible data due to reaching a limit on the server, such as a query execution timing out.
DB_E_NEWLYINSERTED
DBPROP_STRONGIDENTITY was VARIANT_FALSE and hRow referred to a row for which an insertion had been transmitted to the data source.
DB_E_NOTREENTRANT
The provider called a method from IRowsetNotify in the consumer and the method has not yet returned.
DB_E_PENDINGINSERT
The rowset was in delayed update mode and hRow referred to a pending insert row.
If this method performs deferred accessor validation and that validation takes place before any data is transferred, it can also return any of the following return codes for the applicable reasons listed in the corresponding DBBINDSTATUS values in IAccessor::CreateAccessor:
E_NOINTERFACE
DB_E_BADBINDINFO
DB_E_BADORDINAL
DB_E_BADSTORAGEFLAGS
DB_E_UNSUPPORTEDCONVERSION

Comments

This method makes no logical change to the state of the object. A consumer calls GetVisibleData to retrieve the data in the data source that is visible to the transaction for the specified row. However, GetVisibleData does not affect the values in the rowset's copy of the row.

If GetVisibleData fails, the memory to which pData points is not freed but its contents are undefined. If, before GetVisibleData failed, the provider allocated any memory for return to the consumer, the provider frees this memory and does not return it to the consumer.

IRowsetResynch::ResynchRows

Gets the data in the data source that is visible to the transaction for the specified rows and updates the rowset's copies of those rows.
   HRESULT ResynchRows (
      ULONG            cRows, <BR/>
      const HROW       rghRows[],<BR/>
      ULONG*           pcRowsResynched, <BR/>
      HROW**           prghRowsResynched, <BR/>
      DBROWSTATUS**    prgRowStatus);
				
Parameters

cRows [in]
The count of rows to resynchronize. If cRows is zero, ResynchRows ignores rghRows and reads the current value of all active rows.
rghRows [in]
An array of cRows row handles to be resynchronized. If cRows is zero, this argument is ignored.
pcRowsResynched [out]
A pointer to memory in which to return the number of rows the method attempted to resynchronize. The caller may supply a null pointer if no list is desired. If the method fails, the provider sets *pcRowsResynched to zero.
prghRowsResynched [out]
A pointer to memory in which to return the array of row handles the method attempted to resynchronize. If cRows is not zero, then the elements of this array are in one-to-one correspondence with those of rghRows. If cRows is zero, the elements of this array are the handles of all active rows in the rowset. When cRows is zero, ResynchRows will add to the reference count of the rows whose handles are returned in prghRowsResynched.
The rowset allocates memory for the handles and the client should release this memory with IMalloc::Free when no longer needed. This argument is ignored if pcRowsResynched is a null pointer and must not be a null pointer otherwise. If *pcRowsResynched is 0 on output or the method fails, the provider does not allocate any memory and ensures that *prghRowsResynched is a null pointer on output.
prgRowStatus [out]
A pointer to memory in which to return an array of row status values. The elements of this array correspond one-to-one with the elements of *prghRowsResynched. If no errors occur while resynchronizing a row, the corresponding element of *prgRowStatus is set to DBROWSTATUS_S_OK. If the method fails while resynchronizing a row, the corresponding element is set as specified in DB_S_ERRORSOCCURRED. If prgRowStatus is a null pointer, no row status values are returned.

The rowset allocates memory for the row status values and returns the address to this memory; the client releases this memory with IMalloc::Free when it is no longer needed. This argument is ignored if pcRowsResynched is a null pointer. If *pcRowsResynched is zero on output or the method fails, the provider does not allocate any memory and ensures that *prgRowStatus is a null pointer on output.
Return Code

S_OK
The method succeeded. All rows were successfully resynchronized. The following value can be returned in *prgRowSTATUS
======
* The row was successfully resynchronized. The corresponding element of *prgRowStatus contains DBROWSTATUS_S_OK.
DB_S_ERRORSOCCURRED
An error occurred while resynchronizing a row, but at least one row was successfully resynchronized. Successes can occur for the reason listed under S_OK. The following errors can occur:
* An element of rghRows was invalid or referred to a row that this thread does not have access to. The corresponding element of *prgRowStatus contains DBROWSTATUS_E_INVALID.

* Resynchronizing a row was canceled during notification. The row was not resynchronized and the corresponding element of *prgRowStatus contains DBROWSTATUS_E_CANCELED.

* An element of rghRows referred to a row for which a deletion had been transmitted to the data source. The corresponding element of *prgRowStatus contains DBROWSTATUS_E_DELETED.

* The row was not resynchronized due to reaching a limit on the server, such as a query execution timing out. The error in the corresponding element of *prgRowStatus contains DBROWSTATUS_E_LIMITREACHED.

* An element of rghRows referred to a row on which a storage object was open. The corresponding element of *prgRowStatus contains DBROWSTATUS_E_OBJECTOPEN.

* An element of rghRows referred to a pending insert row. The corresponding element of *prgRowStatus contains DBROWSTATUS_E_PENDINGINSERT.

* DBPROP_STRONGIDENTITY was VARIANT_FALSE and an element of rghRows referred to a row for which an insertion had been transmitted to the data source. The row was not resynchronized and the corresponding element of *prgRowStatus contains DBROWSTATUS_E_NEWLYINSERTED.
E_FAIL
A provider-specific error occurred.
E_INVALIDARG
cRows was not zero and rghRows was a null pointer. pcRowsResynched was not a null pointer and prghRowsResynched was a null pointer.
E_UNEXPECTED
ITransaction::Commit or ITransaction::Abort was called and the object is in a zombie state.
DB_E_ERRORSOCCURRED
Errors occurred while resynchronizing all of the rows. Errors can occur for the reasons listed under DB_S_ERRORSOCCURRED.
DB_E_NOTREENTRANT
The provider called a method from IRowsetNotify in the consumer and the method has not yet returned.
DB_SEC_E_PERMISSIONDENIED
The consumer did not have sufficient permission to resynchronize the rows.

Comments

ResynchRows refreshes the values in the rowset's copy of each of the specified rows with the currently visible contents of the underlying row. Changes made to the row by the current transaction are always visible to ResynchRows, including changes made by other rowsets in the same transaction. Whether changes made by other transactions are visible to ResynchRows depends on the isolation level of the current transaction.

If a specified row has been deleted from the data source and this deletion is visible, ResynchRows returns DBROWSTATUS_E_DELETED in the error status array for the row and the row is treated as a deleted row.

Any changes transmitted to the data source are not lost; they will be committed or aborted when the transaction is committed or aborted. All pending changes are lost because they exist only in the rowset's copy of the row and ResynchRows overwrites the contents of this copy. The pending change status is removed from the row.

↑ Back to the top


Keywords: KB192014, kbinfo

↑ Back to the top

Article Info
Article ID : 192014
Revision : 4
Created on : 3/2/2005
Published on : 3/2/2005
Exists online : False
Views : 448