phpCAS version 1.3.6

Functions | Variables
InternalCAS_PGTStorageDb

## Functions
| CAS_PGTStorage_Db::_getPdo ()
| CAS_PGTStorage_Db::_getTable ()
| CAS_PGTStorage_Db::getStorageType ()
| CAS_PGTStorage_Db::getStorageInfo ()
| CAS_PGTStorage_Db::__construct ( $cas_parent, $dsn_or_pdo, $username='', $password='', $table='', $driver_options=null)
| CAS_PGTStorage_Db::init ()
| CAS_PGTStorage_Db::_setErrorMode ()
| CAS_PGTStorage_Db::_resetErrorMode ()
| CAS_PGTStorage_Db::createTableSql ()
| CAS_PGTStorage_Db::storePgtSql ()
| CAS_PGTStorage_Db::retrievePgtSql ()
| CAS_PGTStorage_Db::deletePgtSql ()
| CAS_PGTStorage_Db::createTable ()
| CAS_PGTStorage_Db::write ($pgt, $pgt_iou)
| CAS_PGTStorage_Db::read ($pgt_iou)

## Variables
| CAS_PGTStorage_Db::$_pdo
| CAS_PGTStorage_Db::$_dsn
| CAS_PGTStorage_Db::$_username
| CAS_PGTStorage_Db::$_password
| CAS_PGTStorage_Db::$_table_options
| CAS_PGTStorage_Db::$_table
| CAS_PGTStorage_Db::$_errMode

## Detailed Description

## Function Documentation

## ◆ __construct()

CAS_PGTStorage_Db::__construct | ( |  | $cas_parent,
|  |  | $dsn_or_pdo,
|  |  | $username = `''`,
|  |  | $password = `''`,
|  |  | $table = `''`,
|  |  | $driver_options = `null`
| ) |  |

The class constructor.

Parameters

  CAS_Client | $cas_parent | the CAS_Client instance that creates the object.
  string | $dsn_or_pdo | a dsn string to use for creating a PDO object or a PDO object
  string | $username | the username to use when connecting to the database
  string | $password | the password to use when connecting to the database
  string | $table | the table to use for storing and retrieving PGT's
  string | $driver_options | any driver options to use when connecting to the database

Definition at line 138 of file Db.php.

References $driver_options, CAS_PGT_STORAGE_DB_DEFAULT_TABLE, phpCAS\traceBegin(), and phpCAS\traceEnd().

## ◆ _getPdo()

CAS_PGTStorage_Db::_getPdo | ( |  | ) |
| private

This method returns the PDO object to use for database interactions.

Returns
  the PDO object

Definition at line 63 of file Db.php.

References CAS_PGTStorage_Db\$_pdo.

Referenced by CAS_PGTStorage_Db\_resetErrorMode(), CAS_PGTStorage_Db\_setErrorMode(), CAS_PGTStorage_Db\createTable(), CAS_PGTStorage_Db\read(), and CAS_PGTStorage_Db\write().

## ◆ _getTable()

CAS_PGTStorage_Db::_getTable | ( |  | ) |
| private

This method returns the table to use when storing/retrieving PGT's

Returns
  the name of the pgt storage table.

Definition at line 86 of file Db.php.

References CAS_PGTStorage_Db\$_table.

Referenced by CAS_PGTStorage_Db\createTableSql(), CAS_PGTStorage_Db\deletePgtSql(), CAS_PGTStorage_Db\retrievePgtSql(), and CAS_PGTStorage_Db\storePgtSql().

## ◆ _resetErrorMode()

CAS_PGTStorage_Db::_resetErrorMode | ( |  | ) |
| private

this method will reset the error mode on the PDO object

Returns
  void

Definition at line 234 of file Db.php.

References CAS_PGTStorage_Db\_getPdo().

Referenced by CAS_PGTStorage_Db\createTable(), CAS_PGTStorage_Db\read(), and CAS_PGTStorage_Db\write().

## ◆ _setErrorMode()

CAS_PGTStorage_Db::_setErrorMode | ( |  | ) |
| private

This method will enable the Exception error mode on the PDO object

Returns
  void

Definition at line 221 of file Db.php.

References CAS_PGTStorage_Db\_getPdo().

Referenced by CAS_PGTStorage_Db\createTable(), CAS_PGTStorage_Db\read(), and CAS_PGTStorage_Db\write().

## ◆ createTable()

CAS_PGTStorage_Db::createTable | ( |  | ) |

This method creates the database table used to store pgt's and pgtiou's

Returns
  void

Definition at line 303 of file Db.php.

References CAS_PGTStorage_Db\_getPdo(), CAS_PGTStorage_Db\_resetErrorMode(), CAS_PGTStorage_Db\_setErrorMode(), phpCAS\error(), CAS_PGTStorage_Db\init(), CAS_PGTStorage_AbstractStorage\isInitialized(), phpCAS\traceBegin(), and phpCAS\traceEnd().

## ◆ createTableSql()

CAS_PGTStorage_Db::createTableSql | ( |  | ) |
| protected

This method returns the query used to create a pgt storage table

Returns
  the create table SQL, no bind params in query

Definition at line 253 of file Db.php.

References CAS_PGTStorage_Db\_getTable().

## ◆ deletePgtSql()

CAS_PGTStorage_Db::deletePgtSql | ( |  | ) |
| protected

This method returns the query used to delete a pgt.

Returns
  the delete PGT SQL, :pgt_iou is the only bind param contained in the query

Definition at line 289 of file Db.php.

References CAS_PGTStorage_Db\_getTable().

Referenced by CAS_PGTStorage_Db\read().

## ◆ getStorageInfo()

CAS_PGTStorage_Db::getStorageInfo | ( |  | ) |

This method returns an informational string giving informations on the parameters of the storage.(used for debugging purposes).

Returns
  an informational string.

Definition at line 113 of file Db.php.

## ◆ getStorageType()

CAS_PGTStorage_Db::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 101 of file Db.php.

## ◆ init()

CAS_PGTStorage_Db::init | ( |  | ) |

This method is used to initialize the storage. Halts on error.

Returns
  void

Definition at line 179 of file Db.php.

References phpCAS\error(), CAS_PGTStorage_AbstractStorage\isInitialized(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_PGTStorage_Db\createTable().

## ◆ read()

CAS_PGTStorage_Db::read | ( |  | $pgt_iou | ) |

This method reads a PGT corresponding to a PGT Iou and deletes the corresponding db entry.

Parameters

  string | $pgt_iou | the PGT iou

Returns
  the corresponding PGT, or FALSE on error

Definition at line 392 of file Db.php.

References CAS_PGTStorage_Db\_getPdo(), CAS_PGTStorage_Db\_resetErrorMode(), CAS_PGTStorage_Db\_setErrorMode(), CAS_PGTStorage_Db\deletePgtSql(), CAS_PGTStorage_Db\retrievePgtSql(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

## ◆ retrievePgtSql()

CAS_PGTStorage_Db::retrievePgtSql | ( |  | ) |
| protected

This method returns the query used to retrieve a pgt. the first column of the first row should contain the pgt

Returns
  the retrieve PGT SQL, :pgt_iou is the only bind param contained in the query

Definition at line 278 of file Db.php.

References CAS_PGTStorage_Db\_getTable().

Referenced by CAS_PGTStorage_Db\read().

## ◆ storePgtSql()

CAS_PGTStorage_Db::storePgtSql | ( |  | ) |
| protected

This method returns the query used to store a pgt

Returns
  the store PGT SQL, :pgt and :pgt_iou are the bind params contained in the query

Definition at line 265 of file Db.php.

References CAS_PGTStorage_Db\_getTable().

Referenced by CAS_PGTStorage_Db\write().

## ◆ write()

CAS_PGTStorage_Db::write | ( |  | $pgt,
|  |  | $pgt_iou
| ) |  |

This method stores a PGT and its corresponding PGT Iou in the database. Echoes a warning on error.

Parameters

  string | $pgt | the PGT
  string | $pgt_iou | the PGT iou

Returns
  void

Definition at line 349 of file Db.php.

References CAS_PGTStorage_Db\_getPdo(), CAS_PGTStorage_Db\_resetErrorMode(), CAS_PGTStorage_Db\_setErrorMode(), phpCAS\error(), CAS_PGTStorage_Db\storePgtSql(), phpCAS\traceBegin(), and phpCAS\traceEnd().

## Variable Documentation

## ◆ $_dsn

CAS_PGTStorage_Db::$_dsn
| private

database connection options to use when creating a new PDO object

Definition at line 71 of file Db.php.

## ◆ $_errMode

CAS_PGTStorage_Db::$_errMode
| private

attribute that stores the previous error mode for the PDO handle while processing a transaction

Definition at line 214 of file Db.php.

## ◆ $_password

CAS_PGTStorage_Db::$_password
| private

Definition at line 73 of file Db.php.

## ◆ $_pdo

CAS_PGTStorage_Db::$_pdo
| private

the PDO object to use for database interactions

Definition at line 56 of file Db.php.

Referenced by CAS_PGTStorage_Db\_getPdo().

## ◆ $_table

CAS_PGTStorage_Db::$_table
| private

the table to use for storing/retrieving pgt's

Definition at line 79 of file Db.php.

Referenced by CAS_PGTStorage_Db\_getTable().

## ◆ $_table_options

CAS_PGTStorage_Db::$_table_options
| private

Definition at line 74 of file Db.php.

## ◆ $_username

CAS_PGTStorage_Db::$_username
| private

Definition at line 72 of file Db.php.