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 ()
 
- 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 3201 of file grima-lib.php.

Member Function Documentation

◆ addToDB()

GrimaInstitution::addToDB ( )

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

References GrimaDB\$db, and GrimaDB\getDb().

3202  {
3203  $db = $this->getDb();
3204  $query = $db->prepare( 'INSERT INTO institutions(institution,apikey,server) VALUES (:institution,:apikey,:server)' );
3205  if (!$query) {
3206  $errorCode = $db->errorCode();
3207  $errorInfo = $db->errorInfo();
3208  throw new Exception(
3209  "Could not even prepare to insert into institution database: [$errorCode] {$errorInfo[0]} {$errorInfo[2]}"
3210  );
3211  }
3212  $success = $query->execute( array(
3213  'institution' => $this['institution'],
3214  'apikey' => $this['apikey'],
3215  'server' => $this['server'],
3216  ) );
3217  if (!$success) {
3218  $errorCode = $query->errorCode();
3219  $errorInfo = $query->errorInfo();
3220  throw new Exception(
3221  "Could not insert into user database: [$errorCode] {$errorInfo[0]} {$errorInfo[2]}"
3222  );
3223  }
3224  }
static getDb()
Definition: grima-lib.php:3158
static $db
Definition: grima-lib.php:3170

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