You are here

public function OAuthStoreOracle::getConsumerStatic in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getConsumerStatic()
  2. 7.2 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getConsumerStatic()
  3. 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getConsumerStatic()
  4. 7.4 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getConsumerStatic()
  5. 7.6 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::getConsumerStatic()

* Fetch the static consumer key for this provider. The user for the static consumer * key is NULL (no user, shared key). If the key did not exist then the key is created. * *

Return value

string

Overrides OAuthStoreAbstract::getConsumerStatic

File

lib/oauth-php/library/store/OAuthStoreOracle.php, line 927

Class

OAuthStoreOracle

Code

public function getConsumerStatic() {

  //
  $sql = "BEGIN SP_GET_CONSUMER_STATIC_SELECT(:P_OSR_CONSUMER_KEY, :P_RESULT); END;";

  // parse sql
  $stmt = oci_parse($this->conn, $sql) or die('Can not parse query');

  // Bind In and Out Variables
  oci_bind_by_name($stmt, ':P_OSR_CONSUMER_KEY', $consumer, 255);
  oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

  //Execute the statement
  oci_execute($stmt);
  if (empty($consumer)) {
    $consumer_key = 'sc-' . $this
      ->generateKey(true);
    $sql = "BEGIN SP_CONSUMER_STATIC_SAVE(:P_OSR_CONSUMER_KEY, :P_RESULT); END;";

    // parse sql
    $stmt = oci_parse($this->conn, $sql) or die('Can not parse query');

    // Bind In and Out Variables
    oci_bind_by_name($stmt, ':P_OSR_CONSUMER_KEY', $consumer_key, 255);
    oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

    //Execute the statement
    oci_execute($stmt);

    // Just make sure that if the consumer key is truncated that we get the truncated string
    $consumer = $consumer_key;
  }
  return $consumer;
}