You are here

public function OAuthStoreOracle::listLog in Lingotek Translation 7.5

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

* Get a page of entries from the log. Returns the last 100 records * matching the options given. * *

Parameters

array options: * @param int user_id current user * @return array log records

Overrides OAuthStoreAbstract::listLog

File

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

Class

OAuthStoreOracle

Code

public function listLog($options, $user_id) {
  if (empty($options)) {
    $optionsFlag = NULL;
  }
  else {
    $optionsFlag = 1;
  }
  $sql = "BEGIN SP_LIST_LOG(:P_OPTION_FLAG, :P_USA_ID, :P_OSR_CONSUMER_KEY, :P_OCR_CONSUMER_KEY, :P_OST_TOKEN, :P_OCT_TOKEN, :P_ROWS, :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_OPTION_FLAG', $optionsFlag, 255);
  oci_bind_by_name($stmt, ':P_USA_ID', $user_id, 40);
  oci_bind_by_name($stmt, ':P_OSR_CONSUMER_KEY', $options['osr_consumer_key'], 255);
  oci_bind_by_name($stmt, ':P_OCR_CONSUMER_KEY', $options['ocr_consumer_key'], 255);
  oci_bind_by_name($stmt, ':P_OST_TOKEN', $options['ost_token'], 255);
  oci_bind_by_name($stmt, ':P_OCT_TOKEN', $options['oct_token'], 255);
  oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

  //Bind the ref cursor
  $p_row = oci_new_cursor($this->conn);
  oci_bind_by_name($stmt, ':P_ROWS', $p_row, -1, OCI_B_CURSOR);

  //Execute the statement
  oci_execute($stmt);

  // treat the ref cursor as a statement resource
  oci_execute($p_row, OCI_DEFAULT);
  oci_fetch_all($p_row, $rs, null, null, OCI_FETCHSTATEMENT_BY_ROW);
  return $rs;
}