Hi, grocery-crud-database in intended to work with CodeIgniter 3.0.0. However the latest CodeIgniter 3.0.0 has some new rules (which I think a bit ridiculous). According to this https://github.com/EllisLab/CodeIgniter/commit/20292311636837e120d205e470e41826820feb46, in the latest 3.0.0, the file name should be ucfirst. So renaming "example.php" into "Example.php", "grocery_crud_generic_model.php" into "Grocery_crud_generic_model.php", etc should fix it. I'll also check it by myself.
GroceryCRUD with Various Database Support.
Posted 03 November 2013 - 22:44 PM
Posted 22 November 2013 - 16:48 PM
Hi, thanks for this nice extension. I use it with CI3 and PostgreSQL 9.2 and it works fine, but paging and searching doesn't work. Ajax request to 'ajax_list_info' ends with this error:
ERROR: column "settings.group" must appear in the GROUP BY clause or be used in an aggregate function LINE 7: HAVING "group" = '2'
Query:
SELECT COUNT(*) AS "numrows" FROM "settings" WHERE "group" = '2' AND "type" = 'list' OR "name" LIKE '%test%' ESCAPE '!' OR "key" LIKE '%test%' ESCAPE '!' HAVING "group" = '2' AND "type" = 'list'
$crud = $this->new_crud(); $crud->set_theme('twitter-bootstrap'); $crud->set_table('settings'); $crud->set_subject('List'); $crud->set_primary_key('id', 'settings'); $crud->columns('name', 'key'); $crud->where('group', '2'); $crud->where('type', 'list'); $crud->fields('name', 'key', 'group', 'module', 'type'); $crud->field_type('group', 'hidden', '2'); $crud->field_type('module', 'hidden', '1'); $crud->field_type('type', 'hidden', 'list'); $crud->add_action('Values',null,'grocery/list_values'); $crud->set_crud_url_path(site_url(strtolower(__CLASS__."/".__FUNCTION__)),site_url(strtolower(__CLASS__."/list"))); $output = $crud->render();
Posted 22 November 2013 - 22:33 PM
Latest CodeIgniter 3.0 has new ucfirst filename rule. Which I believe you've try apply some workaround like this one:
$crud->set_crud_url_path(site_url(strtolower(__CLASS__."/".__FUNCTION__)),site_url(strtolower(__CLASS__."/list")))
However, are you sure that you have post the correct corresponding code? I can't see any "having" or "test" string in your code which is appear in error message.
Posted 23 November 2013 - 19:04 PM
I don't have any problems with filename rules. This row is surplus in this case. I use it for multitable views and it can be removed for a single table view. As I wrote paging and searching doesn't work. Ajax request to 'ajax_list_info' that is made, when search is used, returns this error. I don't know why it adds HAVING to the query. 'test' is a search string.
I found this code in Grocery_CRUD.php, but I don't understand why is it there. After commenting it out paging is working, but search doesn't. It always returns all records.
if(!empty($this->where)) foreach($this->where as $where) $this->basic_model->having($where[0],$where[1],$where[2]);
UPD:
Now I know why does search always returns all records. Codeigniter doesn't put parentheses around LIKE operators. It should be:
SELECT COUNT(*) AS "numrows" FROM "settings" WHERE "group" = '2' AND "type" = 'list' AND ( "name" LIKE '%test%' ESCAPE '!' OR "key" LIKE '%test%' ESCAPE '!' )
Posted 24 November 2013 - 00:48 AM
Great finding. I've just try it and find that sometime it return error since postgresql has "strict" datatype.
So if, I have integer field in LIKE clause, it will produce an error. There should be manually casted into "char varying".
Give me some time to fix this.
Posted 06 August 2015 - 12:59 PM
Hello, i'm trying to use GC 1.5.1 (on CI 3.0.0) with your databases extension (PDO), but it seems that i bump into an incompatibility :
ERROR: syntax error near « FROM » LINE 1: SHOW COLUMNS FROM `articles` ^
Is this databases project up to date with GC ? Thanks !
Posted 10 April 2017 - 14:57 PM
Hello, i'm trying to use GC 1.5.1 (on CI 3.0.0) with your databases extension (PDO), but it seems that i bump into an incompatibility :
Is this databases project up to date with GC ? Thanks !
Did you solve this?