Updated copyright:
[core.git] / inc / classes / interfaces / database / backend / class_DatabaseBackend.php
1 <?php
2 /**
3  * An interface for front-end database classes. The classes should prepare the
4  * objects for saving in the database. So for server-bases database classes SQL
5  * queries shall be generated and send to the backend classes. In case of local
6  * file databases the object shall be serialized and (maybe) transparently
7  * compressed before they got saved to a local file.
8  *
9  * @author              Roland Haeder <webmaster@shipsimu.org>
10  * @version             0.0.0
11  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
12  * @license             GNU GPL 3.0 or any newer version
13  * @link                http://www.shipsimu.org
14  *
15  * This program is free software: you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation, either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program. If not, see <http://www.gnu.org/licenses/>.
27  */
28 interface DatabaseBackend extends FrameworkDatabase {
29         /**
30          * Makes sure that the database connection is up and alive
31          *
32          * @return      void
33          */
34         function connectToDatabase ();
35
36         /**
37          * Starts a SELECT query on the database by given return type, table name
38          * and search criteria
39          *
40          * @param       $tableName              Name of the database table
41          * @param       $criteria               Search criteria class
42          * @return      $resultData             Result data of the query
43          * @throws      UnsupportedCriteriaException    If the criteria is unsupported
44          * @throws      SqlException                                    If an SQL error occurs
45          */
46         function querySelect ($tableName, LocalSearchCriteria $criteriaInstance);
47
48         /**
49          * 'Inserts' a data set instance into a local file database folder
50          *
51          * @param       $dataSetInstance        A storeable data set
52          * @return      void
53          * @throws      SqlException    If an SQL error occurs
54          */
55         function queryInsertDataSet (StoreableCriteria $dataSetInstance);
56
57         /**
58          * 'Updates' a data set instance with a database layer
59          *
60          * @param       $dataSetInstance        A storeable data set
61          * @return      void
62          * @throws      SqlException    If an SQL error occurs
63          */
64         function queryUpdateDataSet (StoreableCriteria $dataSetInstance);
65
66         /**
67          * Removes non-public data from given array.
68          *
69          * @param       $data   An array with possible non-public data that needs to be removed.
70          * @return      $data   A cleaned up array with only public data.
71          */
72         function removeNonPublicDataFromArray (array $data);
73 }
74
75 // [EOF]
76 ?>