ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
PGT storage in a database
+ 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.
 PGTStorageDB::getLink ()
 This method returns the handle of the connection to the database where PGT's are stored.
 PGTStorageDB::getTable ()
 This method returns the name of the table where PGT's are stored.
 PGTStorageDB::getStorageType ()
 This method returns an informational string giving the type of storage used by the object (used for debugging purposes).
 PGTStorageDB::getStorageInfo ()
 This method returns an informational string giving informations on the parameters of the storage.
 PGTStorageDB::PGTStorageDB ($cas_parent, $user, $password, $database_type, $hostname, $port, $database, $table)
 The class constructor, called by CASClient::SetPGTStorageDB().
 PGTStorageDB::init ()
 This method is used to initialize the storage.

Variables

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

Detailed Description

Function Documentation

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.

References PGTStorageDB\$_link.

{
return $this->_link;
}
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.

{
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
}
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.

{
return "database";
}
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.

References PGTStorageDB\$_table.

{
return $this->_table;
}
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.

References PGTStorageDB\$_url.

Referenced by PGTStorageDB\init().

{
return $this->_url;
}

+ Here is the caller graph for this function:

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.

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

Referenced by PGTStorageDB\init().

{
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
//include phpDB library (the test was introduced in release 0.4.8 for
//the integration into Tikiwiki).
if (!class_exists('DB')) {
include_once('DB.php');
}
// try to connect to the database
$this->_link = DB::connect($this->getURL());
if ( DB::isError($this->_link) ) {
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
}
var_dump($this->_link);
phpCAS::traceBEnd();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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().

{
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
// build and store the PEAR DB URL
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
// XXX should use setURL and setTable
}

+ Here is the call graph for this function:

Variable Documentation

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().

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().

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().