error-handling - Codeigniter 3 Postgresql驱动程序错误代码

标签 error-handling postgresql-9.3 codeigniter-3

我是否有解决方法来获取错误代码。
驱动程序为$ 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/

相关文章:

php - CodeIgniter : 3. 0 通过composer迁移数据库

c# - 本地蓝屏vs远程处理错误

ajax - paypal_lib 表单在 codeigniter 中不起作用

javascript - 延迟加载的javascript上的运行时错误处理?

postgresql - pg_basebackup 完成后 Postgresql 9.3 复制未启动

postgresql - pg_xlog 文件不在从机上回收

postgresql - Postgres 多数据库连接

php - 子查询返回多行

optimization - 在 forall 循环中使用用户定义的函数

c# - C#Errorprovider.ContainerControl.Controls仅包含TabControl