• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 DATASHARE_OPERATION_STATEMENT_H
17 #define DATASHARE_OPERATION_STATEMENT_H
18 
19 #include "datashare_predicates.h"
20 #include "datashare_values_bucket.h"
21 
22 namespace OHOS {
23 namespace DataShare {
24 enum class Operation : int32_t {
25     INSERT = 0,
26     UPDATE,
27     DELETE,
28 };
29 
30 struct OperationStatement {
31     Operation operationType;
32     std::string uri;
33     DataSharePredicates predicates;
34     DataShareValuesBucket valuesBucket;
35 };
36 
37 enum ExecErrorCode : int32_t {
38     EXEC_SUCCESS = 0,
39     EXEC_FAILED,
40     EXEC_PARTIAL_SUCCESS,
41 };
42 
43 struct ExecResult {
44     Operation operationType;
45     int code;
46     std::string message;
47 };
48 
49 struct ExecResultSet {
50     ExecErrorCode errorCode;
51     std::vector<ExecResult> results;
52 };
53 }
54 }
55 #endif // DATASHARE_OPERATION_STATEMENT_H
56