Welcome Guest, Not a member yet? Register   Sign In
Postgresql error in try block
#1

Hello,
In codeigniter 3.1 / postgresql 9.4 application in development mode
running code like :

PHP Code:
try { 
$updated_result$this->msettings->updateSettings$updateDataArray ) ;
echo 
'<pre>++ $updated_result::'.print_r($updated_result,true).'</pre>'
} catch (
Exception $e) { 
echo 
'Caught exception: '$e->getMessage(), "\n";
echo 
'<pre>INSIDE</pre>'


If inside of updateSettings there is calling of nonexisting postgresql function like :

Code:
select * from pd_update_settings_no_exists( 'price_list_items_per_page', '200' )

pg_query raise error on screen:

Code:
Message: pg_query(): Query failed: ERROR: function pd_update_settings_no_exists(unknown, unknown) does not exist
That is ok, but I would like to catch this error and as example to show it as some error page, but not system error.
From my code at top
Code:
$updated_result::

line is on screen, but not code inside of
Code:
} catch (Exception $e) {

but I would like this code to be run for some my rendering...
Which is the right way here?
Thanks!
Reply
#2

... that's not an exception.
Reply
#3

Sorry, if my way was wrong, what is the right way?
I hope I explained what I want clear?
Reply
#4

(02-21-2017, 10:30 AM)mstdmstd Wrote: Sorry, if my way was wrong, what is the right way?
I hope I explained what I want clear?

Code:
       $func_name = 'pd_update_settings_no_exists';
       $query = $this->db->query("select exists(select * from pg_proc where proname = '".$func_name."')");
       if(!$query->row()->exists){
           echo "Func not found!";
       }
Reply




Theme © iAndrew 2016 - Forum software by © MyBB