f66cd4a4d9dcac058fa0002ed8a616fe6f6660ee
[ccsdk/features.git] /
1 /*\r
2  * Copyright © 2017-2018 AT&T Intellectual Property.\r
3  * \r
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
5  * in compliance with the License. You may obtain a copy of the License at\r
6  * \r
7  * http://www.apache.org/licenses/LICENSE-2.0\r
8  * \r
9  * Unless required by applicable law or agreed to in writing, software distributed under the License\r
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
11  * or implied. See the License for the specific language governing permissions and limitations under\r
12  * the License.\r
13  */\r
14 \r
15 package org.onap.ccsdk.config.data.adaptor.dao;\r
16 \r
17 import java.util.List;\r
18 import java.util.Map;\r
19 import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
20 \r
21 public interface QueryExecutorDao {\r
22     \r
23     /**\r
24      * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the\r
25      * query, expecting a result list.\r
26      * <p>\r
27      * The results will be mapped to a List (one entry for each row) of Maps (one entry for each column,\r
28      * using the column name as the key). Each element in the list will be of the form returned by this\r
29      * interface's queryForMap() methods.\r
30      *\r
31      * @param sql SQL query to execute\r
32      * @param data arguments to bind to the query (leaving it to the PreparedStatement to guess the\r
33      *        corresponding SQL type)\r
34      * @return a List that contains a Map per row\r
35      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
36      */\r
37     public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException;\r
38     \r
39     /**\r
40      * Issue a single SQL update operation (such as an insert, update or delete statement) via a\r
41      * prepared statement, binding the given arguments.\r
42      *\r
43      * @param sql SQL containing bind parameters\r
44      * @param data arguments to bind to the query (leaving it to the PreparedStatement to guess the\r
45      *        corresponding SQL type)\r
46      * @return the number of rows affected\r
47      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update\r
48      */\r
49     public int update(String sql, Object[] data) throws SvcLogicException;\r
50     \r
51 }\r