Grima  2018-08
Whispering into Alma's ear
Public Member Functions | List of all members
GrimaInstitution Class Reference

Interface to the GrimaDB database to retrieve API keys. More...

Inheritance diagram for GrimaInstitution:
GrimaDB

Public Member Functions

  addToDB ()
 
- Public Member Functions inherited from GrimaDB
  offsetExists ($offset)
 
  offsetGet ($offset)
 
  offsetSet ($offset, $value)
 
  offsetUnset ($offset)
 
  getIterator ()
 

Additional Inherited Members

- Static Public Member Functions inherited from GrimaDB
static  init ()
 
static  isEmpty ()
 
static  isStateless ()
 
static  getInstitutions ()
 
- Protected Member Functions inherited from GrimaDB
  getPasswordAlgorithm ()
 
- Static Protected Member Functions inherited from GrimaDB
static  getDb ()
 

Detailed Description

Interface to the GrimaDB database to retrieve API keys.

Definition at line 3988 of file grima-lib.php.

Member Function Documentation

◆ addToDB()

GrimaInstitution::addToDB ( )

Definition at line 3989 of file grima-lib.php.

3989  {
3990  $db = $this->getDb();
3991  $query = $db->prepare( 'INSERT INTO institutions(institution,apikey,server) VALUES (:institution,:apikey,:server)' );
3992  if (!$query) {
3993  $errorCode = $db->errorCode();
3994  $errorInfo = $db->errorInfo();
3995  throw new Exception(
3996  "Could not even prepare to insert into institution database: [$errorCode] {$errorInfo[0]} {$errorInfo[2]}"
3997  );
3998  }
3999  $success = $query->execute( array(
4000  'institution' => $this['institution'],
4001  'apikey' => $this['apikey'],
4002  'server' => $this['server'],
4003  ) );
4004  if (!$success) {
4005  $errorCode = $query->errorCode();
4006  $errorInfo = $query->errorInfo();
4007  throw new Exception(
4008  "Could not insert into user database: [$errorCode] {$errorInfo[0]} {$errorInfo[2]}"
4009  );
4010  }
4011  }
static getDb()
Definition: grima-lib.php:3919
static $db
Definition: grima-lib.php:3898

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