The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stored Procedures / Routines + general US startup questions
#7
(01-24-2019, 04:48 PM)mudmin Wrote: Can you not just return all the results and do a foreach through them?

Apologies, I'm not sure where you are referring to returning all results? Did you mean from the database or in the result set with php?

I did forget to mention a few details about my use case. In my SP, I'm adding SQL generated data to two tables. x amount of rows for table A and 1 row for table B based on table C data. These are then retrieved, with two separate "SELECT"S, and returned to php for the web apps JS. A join on this result set wouldn't work as the table columns aren't similar.

I can't run pdo's nextRowset() on $result->_query as it's private so had to add the above code as a workaround. If I var_dump the $result it only shows the first result set, although it does show that there are 2 results with `private '_queryCount' => int 2`.

The only thing I can think of, to avoid breaking any upgrades to US, is to add the above function in an extension class of DB and only include/call it if I need to access a secondary+ result set, prior to calling the SP.

This is my caller FN:

Code:
private function my_fn($amount){
  global $user, $db;

  $result = $db->query("CALL MY_PROC(?,?,?)",array($user->data()->id,$amount,NULL));
  var_dump($result);

  $result_A = $result->results();
  $result_B = $result->nextRowset();

  var_dump($result_A, $result_B);

  exit();
}
  Reply


Messages In This Thread
RE: Stored Procedures / Routines + general US startup questions - by Developer_J - 01-24-2019, 06:57 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)