You are here

public function OAuthStoreOracle::listServers in Lingotek Translation 7.3

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

* Get a list of all consumers from the consumer registry. * The consumer keys belong to the user or are public (user id is null) * *

Parameters

string q query term: * @param int user_id * @return array

Overrides OAuthStoreAbstract::listServers

File

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

Class

OAuthStoreOracle

Code

public function listServers($q = '', $user_id) {
  $q = trim(str_replace('%', '', $q));
  $args = array();

  //
  $sql = "BEGIN SP_LIST_SERVERS(:P_Q, :P_USER_ID, :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_Q', $q, 255);
  oci_bind_by_name($stmt, ':P_USER_ID', $user_id, 40);
  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, $listServersList, null, null, OCI_FETCHSTATEMENT_BY_ROW);
  $servers = $listServersList;

  //
  return $servers;
}