2

I am working on my new project in CakePHP 3 with PostgreSQL database. I have created a few stored procedures. I am trying to call them in cakePHP 3.0 using below code. But not sure, Is this the right way to do this.

$sql = "SELECT check_pass('test123','123456')";
$connection = ConnectionManager::get('default');
$results = $connection->execute($sql)->fetchAll('assoc');

Please suggest if is any other better way to do this.

DIDoS
  • 812
  • 9
  • 23
Faaiq
  • 51
  • 1
  • Are you facing any problem with this? – Aefits Oct 02 '15 at 11:16
  • no its working but i just want to know is it a correct way of calling stored procedure or not? – Faaiq Oct 02 '15 at 11:19
  • If your function returns a single value the way you've done it is ok. In some cases it's recommended to use `select * from my_function(args)`, see [this post](http://stackoverflow.com/questions/31014219/select-function-in-postgresql-makes-too-much-calls-to-function/31014400#31014400). – klin Oct 02 '15 at 12:05
  • in what class is the code in the question? – AD7six Oct 02 '15 at 12:55
  • its in the controller. – Faaiq Oct 02 '15 at 14:17

0 Answers0