I'm attempting to do a batch replace on a database to translate british to american words. I've got a large array of words to replace, and also an array of various different tables to run through. I've come across the following thread that appears to provide exactly what I need, however I'm getting errors when trying it.
This is the error I'm encountering.
Exception caught: exception 'PDOException' with message
'SQLSTATE[HY000]: General error: 1436 Thread stack overrun:
10816 bytes used of a 131072 byte stack, and 128000 bytes needed.
Use 'mysqld -O thread_stack=#' to specify a bigger stack.' in /var/.../....php:303
Stack trace: #0 /var/.../....php(303): PDOStatement->execute(Array) #1 {main}
I'm using the custom defined MySQL function in this answer and generating a query that looks like this;
UPDATE field_data_body SET body_value = case_insensitive_replace(body_value, :british, :american)
I'm using the following to handle the PDO;
$query = $db->prepare($sql);
try {
$query->execute($sql_fields_array);
} catch (PDOException $e) {
echo "Exception caught: $e";
}
The $sql_fields_array
array looks like this;
Array ( [british] => acclimatise [american] => acclimate )
I've tested changing the name of the custom function to make sure I created it correctly, and I did get an error saying the function name did not exist. So at least that part of what I've tried is correct.
Originally I was using the replace(lower(body_value), :british, :american)
to do the search and replace, however this then changed everything to lowercase which is not what I want.
Any ideas with this error? Or if there's actually a better way I can automate this batch search and replace.