You are here

public function OAuthStoreOracle::countConsumerAccessTokens in Lingotek Translation 7.4

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

* Count the consumer access tokens for the given consumer. * *

Parameters

string consumer_key: * @return int

Overrides OAuthStoreAbstract::countConsumerAccessTokens

File

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

Class

OAuthStoreOracle

Code

public function countConsumerAccessTokens($consumer_key) {

  /*$count = $this->query_one('
  					SELECT COUNT(ost_id)
  					FROM oauth_server_token
  							JOIN oauth_server_registry
  							ON ost_osr_id_ref = osr_id
  					WHERE ost_token_type   = \'access\'
  					  AND osr_consumer_key = \'%s\'
  					  AND ost_token_ttl    >= NOW()
  					', $consumer_key);
  		*/
  $sql = "BEGIN SP_COUNT_CONSUMER_ACCESS_TOKEN(:P_CONSUMER_KEY, :P_COUNT, :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_CONSUMER_KEY', $consumer_key, 255);
  oci_bind_by_name($stmt, ':P_COUNT', $count, 20);
  oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

  //Execute the statement
  oci_execute($stmt);
  return $count;
}