CodeIgniter2 + Sparks + Php-ActiveRecord与PostgreSql有关

时间:2011-10-05 12:47:53

标签: php postgresql codeigniter phpactiverecord

我正在使用CodeIgniter2 + Sparks + PhpActiveRecord,我按照本教程安装:http://heybigname.com/2011/07/28/codeigniter-2-sparks-php-activerecord-part-1-installation/

与MySql完美配合,但PostgreSql不起作用。

我收到了下一个错误:

Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message 'ActiveRecord\PostgreAdapter not found!' in C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Connection.php:127 Stack trace: #0 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Connection.php(98): ActiveRecord\Connection::load_adapter_class('postgre') #1 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\ConnectionManager.php(33): ActiveRecord\Connection::instance('postgre://postg...') #2 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Table.php(103): ActiveRecord\ConnectionManager::get_connection(NULL) #3 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Table.php(80): ActiveRecord\Table->reestablish_connection(false) #4 C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Table.php(61): ActiveRecord\Table->__construct('User') #5 C:\xampp\htdocs\part1\sparks\php-activ in C:\xampp\htdocs\part1\sparks\php-activerecord\0.0.1\vendor\php-activerecord\lib\Connection.php on line 127

其中“Postgre”适配器在Php-ActiveRecord文件夹中搜索,但这里称为“Pgsql”,当在CodeIgniter中配置时,必须使用“Postgre”。

如何通过真正的驱动程序,对于Php-Activerecord,有效吗?

素不相识。

2 个答案:

答案 0 :(得分:2)

有一些小错误使codeigniter + PHP-ActiveRecord与PostgreSQL一起使用。我创建了一个帖子(用葡萄牙语)解释我为一切正常工作做了什么。如果这是我不知道的最佳解决方案,但它正在发挥作用。看看我的帖子并发表您的意见

http://www.fernandovalente.com.br/wordpress/2012/10/12/codeigniter2-sparks-php-activerecord-com-postgresql/

答案 1 :(得分:1)

PostgreSQL的适配器尚未完成,因此PHP ActiveRecord可能无法使用它。

http://www.phpactiverecord.org/docs/ActiveRecord/PgsqlAdapter