3 * Copyright (C) 2010 Roland Mas, Olaf Lenz
4 * Copyright (C) 2011 France Telecom
6 * This file is 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 along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once("$IP/includes/db/DatabasePostgres.php");
24 class DatabaseForge extends DatabasePostgres {
25 function __construct($server=false, $user=false, $password=false,
26 $dbName=false, $failFunction=false, $flags=0) {
29 $wgDBtype = "postgres";
30 return parent::__construct($server, $user,
31 $password, $dbName, $failFunction, $flags);
34 function fieldInfo($table, $field) {
39 return DatabasePostgres::fieldInfo($table, $field);
44 $save_wgDBmwschema = $wgDBmwschema;
45 $wgDBmwschema = 'public';
46 $v = DatabasePostgres::fieldInfo($table, $field);
47 $wgDBmwschema = $save_wgDBmwschema;
51 function open($server, $user, $password, $dbName) {
52 $v = DatabasePostgres::open($server, $user, $password, $dbName);
55 if ($this->schemaExists($wgDBmwschema)) {
56 $safeschema = $this->addIdentifierQuotes($wgDBmwschema);
57 $this->doQuery("SET search_path TO $safeschema,public");
63 function query($sql, $fname='', $tempIgnore=false) {
65 $chk = "ALTER TABLE interwiki ";
67 if (substr($sql, 0, $csz) == $chk) {
68 $sql = "ALTER TABLE public.interwiki " .
71 return DatabasePostgres::query($sql, $fname,$tempIgnore);
74 function tableName($name, $format='quoted') {
81 return DatabasePostgres::tableName($name, $format);
84 if ($wgDBmwschema != 'public') {
93 // c-file-style: "bsd"