3 * Base class for data access objects
4 * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
6 * This file is a part of Fusionforge.
8 * Fusionforge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Fusionforge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
21 class DataAccessObject {
25 * @param DataAccess $da Instance of the DataAccess class
27 function __construct(&$da) {
28 $this->table_name = 'CLASSNAME_MUST_BE_DEFINE_FOR_EACH_CLASS';
36 * @param string $sql The query string
37 * @param array $params The arguments
38 * @return mixed Either false if error or object DataAccessResult
40 function &retrieve($sql,$params) {
41 $result = new DataAccessResult(db_query_params($sql,$params));
47 * For INSERT, UPDATE and DELETE queries
48 * @param string $sql the query string
49 * @param array $params The arguments
50 * @return bool true if success
52 function update($sql,$params) {
53 $result = db_query_params($sql,$params);