ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages

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

+ Inheritance diagram for PGTStorageDB:
+ Collaboration diagram for PGTStorageDB:

Public Member Functions

 getStorageType ()
 This method returns an informational string giving the type of storage used by the object (used for debugging purposes). More...
 
 getStorageInfo ()
 This method returns an informational string giving informations on the parameters of the storage. More...
 
 PGTStorageDB ($cas_parent, $user, $password, $database_type, $hostname, $port, $database, $table)
 The class constructor, called by CASClient::SetPGTStorageDB(). More...
 
 init ()
 This method is used to initialize the storage. More...
 
 getStorageType ()
 This method returns an informational string giving the type of storage used by the object (used for debugging purposes). More...
 
 getStorageInfo ()
 This method returns an informational string giving informations on the parameters of the storage. More...
 
 PGTStorageDB ($cas_parent, $user, $password, $database_type, $hostname, $port, $database, $table)
 The class constructor, called by CASClient::SetPGTStorageDB(). More...
 
 init ()
 This method is used to initialize the storage. More...
 
- Public Member Functions inherited from PGTStorage
 getStorageType ()
 This virtual method returns an informational string giving the type of storage used by the object (used for debugging purposes). More...
 
 getStorageInfo ()
 This virtual method returns an informational string giving informations on the parameters of the storage. More...
 
 getErrorMessage ()
 This method returns an error message set by PGTStorage::setErrorMessage(). More...
 
 getStorageType ()
 This virtual method returns an informational string giving the type of storage used by the object (used for debugging purposes). More...
 
 getStorageInfo ()
 This virtual method returns an informational string giving informations on the parameters of the storage. More...
 
 getErrorMessage ()
 This method returns an error message set by PGTStorage::setErrorMessage(). More...
 

Private Member Functions

 getURL ()
 This method returns the PEAR DB URL to use to connect to the database. More...
 
 getLink ()
 This method returns the handle of the connection to the database where PGT's are stored. More...
 
 getTable ()
 This method returns the name of the table where PGT's are stored. More...
 
 getURL ()
 This method returns the PEAR DB URL to use to connect to the database. More...
 
 getLink ()
 This method returns the handle of the connection to the database where PGT's are stored. More...
 
 getTable ()
 This method returns the name of the table where PGT's are stored. More...
 

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from PGTStorage
 PGTStorage ($cas_parent)
 The constructor of the class, should be called only by inherited classes. More...
 
 setErrorMessage ($error_message)
 This method sets en error message, which can be read later by PGTStorage::getErrorMessage(). More...
 
 isInitialized ()
 This method tells if the storage has already been intialized. More...
 
 init ()
 This virtual method initializes the object. More...
 
 write ($pgt, $pgt_iou)
 This virtual method stores a PGT and its corresponding PGT Iuo. More...
 
 read ($pgt_iou)
 This virtual method reads a PGT corresponding to a PGT Iou and deletes the corresponding storage entry. More...
 
 PGTStorage ($cas_parent)
 The constructor of the class, should be called only by inherited classes. More...
 
 setErrorMessage ($error_message)
 This method sets en error message, which can be read later by PGTStorage::getErrorMessage(). More...
 
 isInitialized ()
 This method tells if the storage has already been intialized. More...
 
 init ()
 This virtual method initializes the object. More...
 
 write ($pgt, $pgt_iou)
 This virtual method stores a PGT and its corresponding PGT Iuo. More...
 
 read ($pgt_iou)
 This virtual method reads a PGT corresponding to a PGT Iou and deletes the corresponding storage entry. More...
 

Detailed Description

The PGTStorageDB class is a class for PGT database storage.

An instance of this class is returned by CASClient::SetPGTStorageDB().

Author
Pascal Aubry <pascal.aubry at univ-rennes1.fr>

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

Member 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 69 of file pgt-db.php.

References $_link, and $_table.

70  {
71  return $this->_link;
72  }
$_link
The handle of the connection to the database where PGT&#39;s are stored.
Definition: pgt-db.php:81

◆ getStorageInfo()

PGTStorageDB::getStorageInfo ( )

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

(used for debugging purposes).

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

118  {
119  return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
120  }

◆ 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.

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

107  {
108  return "database";
109  }

◆ 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 90 of file pgt-db.php.

References $_table.

91  {
92  return $this->_table;
93  }
$_table
The name of the table where PGT&#39;s are stored.
Definition: pgt-db.php:103

◆ 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 47 of file pgt-db.php.

References $_link, and $_url.

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

◆ init()

PGTStorageDB::init ( )

This method is used to initialize the storage.

Halts on error.

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

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

170  {
172  // if the storage has already been initialized, return immediatly
173  if ( $this->isInitialized() )
174  return;
175  // call the ancestor's method (mark as initialized)
176  parent::init();
177 
178  // try to connect to the database
179  $this->_link = DB::connect($this->getURL());
180  if ( DB::isError($this->_link) ) {
181  phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
182  }
183  var_dump($this->_link);
184  phpCAS::traceBEnd();
185  }
getURL()
This method returns the PEAR DB URL to use to connect to the database.
Definition: pgt-db.php:69
traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:577
error($msg)
This method is used by interface methods to print an error and where the function was originally call...
Definition: CAS.php:544
isInitialized()
This method tells if the storage has already been intialized.
Definition: pgt-main.php:160
+ 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 140 of file pgt-db.php.

References $server, 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().

141  {
143 
144  // call the ancestor's constructor
145  $this->PGTStorage($cas_parent);
146 
147  if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
148  if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
149  if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
150  if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
151  if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
152 
153  // build and store the PEAR DB URL
154  $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$server.':'.$port.'/'.$database;
155 
156  // XXX should use setURL and setTable
158  }
traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:604
const CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME
default host when storing PGT&#39;s to database
Definition: CAS.php:172
const CAS_PGT_STORAGE_DB_DEFAULT_DATABASE
default database when storing PGT&#39;s to database
Definition: CAS.php:180
PGTStorage($cas_parent)
The constructor of the class, should be called only by inherited classes.
Definition: pgt-main.php:63
traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:577
$server
const CAS_PGT_STORAGE_DB_DEFAULT_TABLE
default table when storing PGT&#39;s to database
Definition: CAS.php:184
const CAS_PGT_STORAGE_DB_DEFAULT_PORT
default port when storing PGT&#39;s to database
Definition: CAS.php:176
const CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE
default database type when storing PGT&#39;s to database
Definition: CAS.php:168
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: