Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezdb.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezdb.php 8707 2001-12-10 06:48:59Z jhe $
5 //
6 // Definition of eZDB class
7 //
8 // Created on: <14-Jul-2000 13:01:15 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
110 // include_once( "kernel/classes/ezlog.php" );
111 // include_once( "kernel/classes/INIFile.php" );
112
113 class eZDB
114 {
123 function __construct( $iniFile, $category )
124 {
125 print( "This object should not be created use eZDB::globalDatabase();" );
126 }
127
128
134 static public function &globalDatabase()
135 {
136 $impl =& $GLOBALS["eZDB"];
137
138 if( !$impl === null )
139 {
140 $class = strtolower( get_class( $impl ) );
141 }
142 else
143 {
144 $class = false;
145 }
146
147 if ( $impl == null || !preg_match( "/ez.+?db/", $class ) )
148 {
149 $ini =& eZINI::instance( 'site.ini' );
150
151 $server =& $ini->variable( "site", "Server" );
152 $db =& $ini->variable( "site", "Database" );
153 $user =& $ini->variable( "site", "User" );
154 $password =& $ini->variable( "site", "Password" );
155 $databaseImplementation =& $ini->variable( "site", "DatabaseImplementation" );
156
157 switch ( $databaseImplementation )
158 {
159 case "mysql" :
160 {
161 // include_once( "kernel/classes/ezmysqldb.php" );
162 $impl = new eZMySQLDB( $server, $db, $user, $password );
163 }
164 break;
165
166 case "sqlite" :
167 {
168 // include_once( "kernel/classes/ezsqlitedb.php" );
169 $fileName = $ini->variable( "site", "DatabaseSQLiteFile" );
170 $impl = new eZSQLite3DB( $fileName );
171 }
172 break;
173
174 case "postgresql" :
175 {
176 // include_once( "kernel/classes/ezpostgresqldb.php" );
177
178 $impl = new eZPostgreSQLDB( $server, $db, $user, $password );
179 }
180 break;
181
182 case "informix" :
183 {
184 // include_once( "kernel/classes/ezinformixdb.php" );
185 $impl = new eZInformixDB( $server, $db, $user, $password );
186 }
187 break;
188
189 default :
190 {
191 print( "Database error: have no support for $databaseImplementation" );
192 }
193 break;
194 }
195 }
196
197 return $impl;
198 }
199
204 static public function finish( &$resultArray, &$db )
205 {
206 $db->unlock();
207
208 if ( !is_array( $resultArray ) )
209 $resultArray = array( $resultArray );
210
211 if ( in_array( false, $resultArray ) )
212 $db->rollback();
213 else
214 $db->commit();
215 }
216
218 var $Server;
220 var $DB;
222 var $User;
224 var $Password;
225
226 // the last error message
227 var $Error;
228 }
229
230 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
eZDB
Definition: ezdb.php:114
eZDB\$Server
$Server
the server to connect to
Definition: ezdb.php:218
eZDB\__construct
__construct( $iniFile, $category)
Definition: ezdb.php:123
eZDB\$DB
$DB
the database to use
Definition: ezdb.php:220
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\$Error
$Error
Definition: ezdb.php:227
eZDB\$Password
$Password
the password to use
Definition: ezdb.php:224
eZDB\$User
$User
the username to use
Definition: ezdb.php:222
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZInformixDB
Definition: ezinformixdb.php:38
eZMySQLDB
Definition: ezmysqldb.php:37
eZPostgreSQLDB
Definition: ezpostgresqldb.php:36
eZSQLite3DB
Definition: ezsqlite3db.php:37
$ini
$ini
Definition: classes/admin/linklist.php:64
$db
$db
Definition: ezarticle/user/authorlist.php:53
$server
$server
Definition: ezarticle/xmlrpc/xmlrpcserver.php:63
$fileName
if(eZObjectPermission::hasPermission( $file->id(), "filemanager_file", "r", $user)==false) $fileName
Definition: ezfilemanager/user/filedownload.php:43
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.