• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
postgresql error code

#1
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
Reply

#2
@makif,

These links might help you.
https://forum.codeigniter.com/thread-68046.html
https://stackoverflow.com/questions/1248...o-database
Reply

#3
(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/1248...o-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
Reply

#4
@makif,

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

#5
(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
Reply

#6
@makif

According to the documentation ( https://codeigniter.com/user_guide/datab...-of-values ) your setting for db_debug should be TRUE.
Reply

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

According to the documentation ( https://codeigniter.com/user_guide/datab...-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
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.