我是否有解决方法来获取错误代码。
驱动程序为$ this-> db-> error()“code”索引返回空字符串,
并且它还使用pg_query()执行,这就是为什么它实际上不会返回错误代码的原因。
最佳答案
首先,您必须安装以下包:php5-pgsql
sudo apt-get install php5-pgsql
然后重新启动Apache:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
现在,您设置codeigniter 3的文件database.php
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'tu_usuario',
'password' => 'tu_clave',
'database' => 'tu_base_de_datos',
'dbdriver' => 'postgre',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE,
'port' => 5432,
);
推特:@ luiscordero29
关于error-handling - Codeigniter 3 Postgresql驱动程序错误代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32373533/