CodeIgniter Forums
postgresql error code - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forum-11.html)
+--- Thread: postgresql error code (/thread-73595.html)



postgresql error code - makif - 05-13-2019

hey 
i want to see database error code in postgresql when some  database connection values are wrong.
i use  $this->db->error() but postgresql not showing error code.
in postgre_driver.php has that function 
PHP Code:
public function error()
    {
        return array(
'code' => '''message' => pg_last_error($this->conn_id));
    } 
i used pg_result_error function but it didnot show me the error codes. 
how can i see error code or how can i set error code in posgresql ?

thanks for helping


RE: postgresql error code - php_rocs - 05-13-2019

@makif,

These links might help you.
https://forum.codeigniter.com/thread-68046.html
https://stackoverflow.com/questions/12483861/codeigniter-php-check-if-can-connect-to-database


RE: postgresql error code - makif - 05-13-2019

(05-13-2019, 06:27 AM)php_rocs Wrote: @makif,

These links might help you.
https://forum.codeigniter.com/thread-68046.html
https://stackoverflow.com/questions/12483861/codeigniter-php-check-if-can-connect-to-database

@php_rocs thanks for fast reply but it didnot work.
i got error code if i use mysql database but i dont get codes in postgresql


RE: postgresql error code - php_rocs - 05-13-2019

@makif,

What kind of connection are you using to connect to the database? PDO? Can we see your database config settings (minus the password)?


RE: postgresql error code - makif - 05-13-2019

(05-13-2019, 10:19 AM)php_rocs Wrote: @makif,

What kind of connection are you using to connect to the database? PDO? Can we see your database config settings (minus the password)?

PHP Code:
$db['master'] = array(
 
   'dsn'    => '',
 
   'hostname' => $db_info_master["hostname"],
 
   'username' => $db_info_master["username"],
 
   'password' => $db_info_master["password"],
 
   'database' => $db_info_master["database"],
 
   'port'  => $db_info_master["port"],
 
   'dbdriver' => 'postgre',
 
   'dbprefix' => '',
 
   'pconnect' => FALSE,
 
   'db_debug' => FALSE,
 
   'cache_on' => FALSE,
 
   'cachedir' => 'application/cache',
 
   'char_set' => 'utf8',
 
   'dbcollat' => 'utf8_general_ci',
 
   'swap_pre' => '',
 
   'encrypt' => FALSE,
 
   'compress' => FALSE,
 
   'stricton' => FALSE,
 
   'failover' => array(),
 
   'save_queries' => TRUE    
); 
i guess we missunderstanding, i can connect the database, but if i set some value wrong,i want to see error code as mysql in codeigniter. 
for example  2002 hostname error in mysql, 1045 username or password, 1049 database name error, i can see this error code in mysql, but i dont see in postgresql,  if user set wrong value to database, how can i see postgresql's  database error codes


RE: postgresql error code - php_rocs - 05-14-2019

@makif

According to the documentation ( https://codeigniter.com/user_guide/database/configuration.html?highlight=db_debug#explanation-of-values ) your setting for db_debug should be TRUE.


RE: postgresql error code - makif - 05-14-2019

(05-14-2019, 12:52 AM)php_rocs Wrote: @makif

According to the documentation ( https://codeigniter.com/user_guide/database/configuration.html?highlight=db_debug#explanation-of-values ) your setting for db_debug should be TRUE.

thanks for replying
i tried but not working
also i dont think its about de_debug because i set false in mysql and it shows me error code