MySQL error 1271 illegal mix

Discuss about Group-Office development here

Moderator: Developers

MavisS2
Posts: 11
Joined: Thu Sep 12, 2013 12:17 pm

MySQL error 1271 illegal mix

Postby MavisS2 » Thu May 08, 2014 6:16 pm

Hi,

I created module to GO and I have a problem with search bar. When I try search on polish char (ł,ę,ą), then gets this error "SQLSTATE[HY000]: General error: 1271 Illegal mix of collations for operation 'like'"

My code search tool:

Code: Select all

config.tbar = new Ext.Toolbar({
        items: [
            GO.lang.strSearch + ':',
            new GO.form.SearchField({
                store: config.store,
                width:320
            })
        ]
    })


and my code where i add to criteria my query string with polish char

Code: Select all

$query = $params['query'];
            $storeParamsUsers = new GO_Base_Db_FindParams();
            $storeParamsUsers->getCriteria()->addSearchCondition('first_name', $query, false, false, true);
            $storeParamsUsers->getCriteria()->addSearchCondition('last_name', $query, false, false, true);
            $storeParamsUsers->select("id");
            $storeUsers = GO_Timework_Model_User::model()->find($storeParamsUsers);


Someone can help me? I don't know why this hapend.

@Edited

Ok, I know why this hapend. When I use actionStore from GO_Base_Controller_AbstractModelController my field date (type timestamp) is use to search on query and this call error.

My new question is how excluded my date field from search?

@Edited2

Ok i'm find solution. In override function beforeStoreStatement in Controller i must call

Code: Select all

$storeParams->searchFields(array('title', 'description'));


Then search only in this fields.

I don't delete post, because someone need this :)

Return to “Development Chats”

Who is online

Users browsing this forum: No registered users and 1 guest

cron