1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DISTRIBUTED_RDB_RDB_RESULT_SET_STUB_H 17 #define DISTRIBUTED_RDB_RDB_RESULT_SET_STUB_H 18 19 #include <iremote_stub.h> 20 #include "irdb_result_set.h" 21 22 namespace OHOS::DistributedRdb { 23 class RdbResultSetStub : public IRemoteStub<IRdbResultSet> { 24 public: 25 int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 26 27 private: 28 int32_t OnGetAllColumnNames(MessageParcel &data, MessageParcel &reply); 29 int32_t OnGetColumnCount(MessageParcel &data, MessageParcel &reply); 30 int32_t OnGetColumnType(MessageParcel &data, MessageParcel &reply); 31 int32_t OnGetColumnIndex(MessageParcel &data, MessageParcel &reply); 32 int32_t OnGetColumnName(MessageParcel &data, MessageParcel &reply); 33 int32_t OnGetRowCount(MessageParcel &data, MessageParcel &reply); 34 int32_t OnGetRowIndex(MessageParcel &data, MessageParcel &reply); 35 int32_t OnGoTo(MessageParcel &data, MessageParcel &reply); 36 int32_t OnGoToRow(MessageParcel &data, MessageParcel &reply); 37 int32_t OnGoToFirstRow(MessageParcel &data, MessageParcel &reply); 38 int32_t OnGoToLastRow(MessageParcel &data, MessageParcel &reply); 39 int32_t OnGoToNextRow(MessageParcel &data, MessageParcel &reply); 40 int32_t OnGoToPreviousRow(MessageParcel &data, MessageParcel &reply); 41 int32_t OnIsEnded(MessageParcel &data, MessageParcel &reply); 42 int32_t OnIsStarted(MessageParcel &data, MessageParcel &reply); 43 int32_t OnIsAtFirstRow(MessageParcel &data, MessageParcel &reply); 44 int32_t OnIsAtLastRow(MessageParcel &data, MessageParcel &reply); 45 int32_t OnGetBlob(MessageParcel &data, MessageParcel &reply); 46 int32_t OnGetString(MessageParcel &data, MessageParcel &reply); 47 int32_t OnGetInt(MessageParcel &data, MessageParcel &reply); 48 int32_t OnGetLong(MessageParcel &data, MessageParcel &reply); 49 int32_t OnGetDouble(MessageParcel &data, MessageParcel &reply); 50 int32_t OnIsColumnNull(MessageParcel &data, MessageParcel &reply); 51 int32_t OnIsClosed(MessageParcel &data, MessageParcel &reply); 52 int32_t OnClose(MessageParcel &data, MessageParcel &reply); 53 54 static bool CheckInterfaceToken(MessageParcel &data); 55 using RequestHandle = int (RdbResultSetStub::*)(MessageParcel &, MessageParcel &); 56 static constexpr RequestHandle HANDLERS[CMD_MAX] = { 57 [CMD_GET_ALL_COLUMN_NAMES] = &RdbResultSetStub::OnGetAllColumnNames, 58 [CMD_GET_COLUMN_COUNT] = &RdbResultSetStub::OnGetColumnCount, 59 [CMD_GET_COLUMN_TYPE] = &RdbResultSetStub::OnGetColumnType, 60 [CMD_GET_COLUMN_INDEX] = &RdbResultSetStub::OnGetColumnIndex, 61 [CMD_GET_COLUMN_NAME] = &RdbResultSetStub::OnGetColumnName, 62 [CMD_GET_ROW_COUNT] = &RdbResultSetStub::OnGetRowCount, 63 [CMD_GET_ROW_INDEX] = &RdbResultSetStub::OnGetRowIndex, 64 [CMD_GO_TO] = &RdbResultSetStub::OnGoTo, 65 [CMD_GO_TO_ROW] = &RdbResultSetStub::OnGoToRow, 66 [CMD_GO_TO_FIRST_ROW] = &RdbResultSetStub::OnGoToFirstRow, 67 [CMD_GO_TO_LAST_ROW] = &RdbResultSetStub::OnGoToLastRow, 68 [CMD_GO_TO_NEXT_ROW] = &RdbResultSetStub::OnGoToNextRow, 69 [CMD_GO_TO_PREV_ROW] = &RdbResultSetStub::OnGoToPreviousRow, 70 [CMD_IS_ENDED_ROW] = &RdbResultSetStub::OnIsEnded, 71 [CMD_IS_STARTED_ROW] = &RdbResultSetStub::OnIsStarted, 72 [CMD_IS_AT_FIRST_ROW] = &RdbResultSetStub::OnIsAtFirstRow, 73 [CMD_IS_AT_LAST_ROW] = &RdbResultSetStub::OnIsAtLastRow, 74 [CMD_GET_BLOB] = &RdbResultSetStub::OnGetBlob, 75 [CMD_GET_STRING] = &RdbResultSetStub::OnGetString, 76 [CMD_GET_INT] = &RdbResultSetStub::OnGetInt, 77 [CMD_GET_LONG] = &RdbResultSetStub::OnGetLong, 78 [CMD_GET_DOUBLE] = &RdbResultSetStub::OnGetDouble, 79 [CMD_IS_COLUMN_NULL] = &RdbResultSetStub::OnIsColumnNull, 80 [CMD_IS_CLOSED] = &RdbResultSetStub::OnIsClosed, 81 [CMD_CLOSE] = &RdbResultSetStub::OnClose 82 }; 83 }; 84 } // namespace OHOS::DistributedRdb 85 #endif // DISTRIBUTED_RDB_RDB_RESULT_SET_STUB_H 86