1

I'm setting up a project in which I want to utilize CakePHP's Translate Behavior.

Everything seemed to work fine until I reached 10 fields that I wanted it to translate. The Translate Behavior creates an INNER JOIN for each field it's trying to retrieve - which I believe is what's causing this error (only happens with 10+):

SQLSTATE[42000]: Syntax error or access violation: 1104 The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay

Two questions:

1) I tried fixing it by running the two listed SQL commands, but still no luck - how can I get it to work?

2) Is it ideal/ok/acceptable to have 10-20+ translated fields if it's going to create an INNER JOIN for each one? Should I re-think using this behavior and maybe create something on my own?

Dave
  • 28,833
  • 23
  • 113
  • 183

2 Answers2

1

Did You try SET OPTION SQL_BIG_SELECTS = 1 more on https://stackoverflow.com/a/950576/182823

Community
  • 1
  • 1
kicaj
  • 2,881
  • 5
  • 42
  • 68
1

1: Its a mysql security option, what you can override. Use this code in before filter in your app controller to avoid this error.

function beforeFilter() {  
$this->{$this->modelClass}->query('SET SQL_BIG_SELECTS=1'); 
...
}

2: It's ok to join table multipled, but some advice:

lamasgergo
  • 88
  • 8