3.1.5.2.7 Receiving a CPMGetRowsIn Request
When the server receives a CPMGetRowsIn message request from a client, the server MUST do the following:
Check whether the client has a query associated with it. If this is not the case, the server MUST report a STATUS_INVALID_PARAMETER (0xC000000D) error.
Check whether the cursor handle passed is in the list of the client's cursor handles. If this is not the case, the server MUST report an E_FAIL (0x80004005) error.
Check whether the client has a current set of bindings. If this is not the case, the server MUST report an E_FAIL (0x80004005) error.
Prepare a CPMGetRowsOut message. The server MUST position the cursor in query results as indicated by the seek description. If this step fails for any reason, the server MUST report that an error was encountered.
Fetch as many rows as will fit in a buffer, the size of which is indicated by _cbReadBuffer, but not more than indicated by _cRowsToTransfer. When fetching rows, the server MUST compare each selected column's property value type to the type that is specified in the client's current set of bindings (see section 3.1.1). If the type in the binding is not VT_VARIANT, the server MUST attempt to convert the column's property value to that type. Otherwise, if the DBPROP_USEEXTENDEDDBTYPES flag is set in the client's DBPROPSET_QUERYEXT property set, or if the column's property value is not a VT_VECTOR type, the property value MUST be returned in its normal type. If none of these are the case (that is, the server has a VT_VECTOR type, and the client does not support VT_VECTOR), the server MUST attempt to convert it to a VT_ARRAY type as follows:
VT_I8, VT_UI8, VT_FILETIME, and VT_CLSID array elements cannot be converted and instead fail.
VT_LPSTR and VT_LPWSTR array elements MUST be converted to VT_BSTR.
Array elements of all other types MUST remain unchanged.
Finally, if row columns contain chapter handles or bookmark handles, the server MUST update the corresponding lists. If this step fails for any reason, the server MUST report that an error was encountered.
Store the actual number of rows fetched in _cRowsReturned.
Store fetched rows in the Rows field (see note on the following status byte and section 2.2.3.16 on the structure of the Rows field).
Respond to the client with the CPMGetRowsOut message.
Note Regarding status byte field: If StatusUsed is set to 0x01 in the CTableColumn structure of the CPMSetBindingsIn message for the column, the server MUST set the status byte according the description specified in section 2.2.1.25.
If the property value is absent for this row, the server MUST set the status byte to StatusNull. If the value is too big to be transferred in the CPMGetRowsOut message (greater than 2048 bytes), the server MUST set the status byte to StatusDeferred. Otherwise, the server MUST set the status byte to StatusOK.