ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
+ Collaboration diagram for PGT storage in a database:

Data Structures

class  PGTStorageDB
 The PGTStorageDB class is a class for PGT database storage. More...
 

Functions

 PGTStorageDB::getURL ()
 This method returns the PEAR DB URL to use to connect to the database. More...
 
 PGTStorageDB::getLink ()
 This method returns the handle of the connection to the database where PGT's are stored. More...
 
 PGTStorageDB::getTable ()
 This method returns the name of the table where PGT's are stored. More...
 
 PGTStorageDB::getStorageType ()
 This method returns an informational string giving the type of storage used by the object (used for debugging purposes). More...
 
 PGTStorageDB::getStorageInfo ()
 This method returns an informational string giving informations on the parameters of the storage. More...
 
 PGTStorageDB::PGTStorageDB ($cas_parent, $user, $password, $database_type, $hostname, $port, $database, $table)
 The class constructor, called by CASClient::SetPGTStorageDB(). More...
 
 PGTStorageDB::init ()
 This method is used to initialize the storage. More...
 

Variables

 PGTStorageDB::$_url
 a string representing a PEAR DB URL to connect to the database. More...
 
 PGTStorageDB::$_link
 The handle of the connection to the database where PGT's are stored. More...
 
 PGTStorageDB::$_table
 The name of the table where PGT's are stored. More...
 

Detailed Description

Function Documentation

◆ getLink()

PGTStorageDB::getLink ( )
private

This method returns the handle of the connection to the database where PGT's are stored.

Returns
a handle of connection.

Definition at line 91 of file pgt-db.php.

92 {
93 return $this->_link;
94 }
$_link
The handle of the connection to the database where PGT's are stored.
Definition: pgt-db.php:81

References PGTStorageDB\$_link.

◆ getStorageInfo()

PGTStorageDB::getStorageInfo ( )

This method returns an informational string giving informations on the parameters of the storage.

(used for debugging purposes).

Reimplemented from PGTStorage.

Definition at line 139 of file pgt-db.php.

140 {
141 return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
142 }

◆ getStorageType()

PGTStorageDB::getStorageType ( )

This method returns an informational string giving the type of storage used by the object (used for debugging purposes).

Returns
an informational string.

Reimplemented from PGTStorage.

Definition at line 128 of file pgt-db.php.

129 {
130 return "database";
131 }

◆ getTable()

PGTStorageDB::getTable ( )
private

This method returns the name of the table where PGT's are stored.

Returns
the name of a table.

Definition at line 112 of file pgt-db.php.

113 {
114 return $this->_table;
115 }
$_table
The name of the table where PGT's are stored.
Definition: pgt-db.php:103

References PGTStorageDB\$_table.

◆ getURL()

PGTStorageDB::getURL ( )
private

This method returns the PEAR DB URL to use to connect to the database.

Returns
a PEAR DB URL

Definition at line 69 of file pgt-db.php.

70 {
71 return $this->_url;
72 }
$_url
a string representing a PEAR DB URL to connect to the database.
Definition: pgt-db.php:60

References PGTStorageDB\$_url.

Referenced by PGTStorageDB\init().

+ Here is the caller graph for this function:

◆ init()

PGTStorageDB::init ( )

This method is used to initialize the storage.

Halts on error.

Reimplemented from PGTStorage.

Definition at line 191 of file pgt-db.php.

192 {
194 // if the storage has already been initialized, return immediatly
195 if ( $this->isInitialized() )
196 return;
197 // call the ancestor's method (mark as initialized)
198 parent::init();
199
200 //include phpDB library (the test was introduced in release 0.4.8 for
201 //the integration into Tikiwiki).
202 if (!class_exists('DB')) {
203 include_once('DB.php');
204 }
205
206 // try to connect to the database
207 $this->_link = DB::connect($this->getURL());
208 if ( DB::isError($this->_link) ) {
209 phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
210 }
211 var_dump($this->_link);
212 phpCAS::traceBEnd();
213 }
error($msg)
This method is used by interface methods to print an error and where the function was originally call...
Definition: CAS.php:544
traceBegin()
This method is used to indicate the start of the execution of a function in debug mode.
Definition: CAS.php:577
getURL()
This method returns the PEAR DB URL to use to connect to the database.
Definition: pgt-db.php:69
isInitialized()
This method tells if the storage has already been intialized.
Definition: pgt-main.php:160

References phpCAS\error(), PGTStorageDB\getURL(), PGTStorage\isInitialized(), and phpCAS\traceBegin().

+ Here is the call graph for this function:

◆ PGTStorageDB()

PGTStorageDB::PGTStorageDB (   $cas_parent,
  $user,
  $password,
  $database_type,
  $hostname,
  $port,
  $database,
  $table 
)

The class constructor, called by CASClient::SetPGTStorageDB().

Parameters
$cas_parentthe CASClient instance that creates the object.
$userthe user to access the data with
$passwordthe user's password
$database_typethe type of the database hosting the data
$hostnamethe server hosting the database
$portthe port the server is listening on
$databasethe name of the database
$tablethe name of the table storing the data

Definition at line 162 of file pgt-db.php.

163 {
165
166 // call the ancestor's constructor
167 $this->PGTStorage($cas_parent);
168
169 if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
170 if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
171 if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
172 if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
173 if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
174
175 // build and store the PEAR DB URL
176 $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
177
178 // XXX should use setURL and setTable
180 }
traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:604
PGTStorage($cas_parent)
The constructor of the class, should be called only by inherited classes.
Definition: pgt-main.php:63
const CAS_PGT_STORAGE_DB_DEFAULT_TABLE
default table when storing PGT's to database
Definition: CAS.php:184
const CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE
default database type when storing PGT's to database
Definition: CAS.php:168
const CAS_PGT_STORAGE_DB_DEFAULT_DATABASE
default database when storing PGT's to database
Definition: CAS.php:180
const CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME
default host when storing PGT's to database
Definition: CAS.php:172
const CAS_PGT_STORAGE_DB_DEFAULT_PORT
default port when storing PGT's to database
Definition: CAS.php:176

References CAS_PGT_STORAGE_DB_DEFAULT_DATABASE, CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE, CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME, CAS_PGT_STORAGE_DB_DEFAULT_PORT, CAS_PGT_STORAGE_DB_DEFAULT_TABLE, PGTStorage\PGTStorage(), phpCAS\traceBegin(), and phpCAS\traceEnd().

+ Here is the call graph for this function:

Variable Documentation

◆ $_link

PGTStorageDB::$_link
private

The handle of the connection to the database where PGT's are stored.

Written by PGTStorageDB::init(), read by getLink().

Definition at line 81 of file pgt-db.php.

Referenced by PGTStorageDB\getLink().

◆ $_table

PGTStorageDB::$_table
private

The name of the table where PGT's are stored.

Written by PGTStorageDB::PGTStorageDB(), read by getTable().

Definition at line 103 of file pgt-db.php.

Referenced by PGTStorageDB\getTable().

◆ $_url

PGTStorageDB::$_url
private

a string representing a PEAR DB URL to connect to the database.

Written by PGTStorageDB::PGTStorageDB(), read by getURL().

Definition at line 60 of file pgt-db.php.

Referenced by PGTStorageDB\getURL().