Subject: | transform_sql does only single replacements |
The sub transform_sql() does only replace the first occurrence of the pattern, and not all occurrences :
__PACKAGE__->table('Actors');
__PACKAGE__->set_sql( actors_in_strip =>
'SELECT __TABLE__.id FROM __TABLE__, panels_and_actors, Panels
WHERE id = Panels_and_Actors.actor
and Panels_and_Actors.panel = panels.id
and panels.strip = ?');
results in :
SELECT Actors.id FROM __TABLE__, panels_and_actors, Panels
WHERE id = Panels_and_Actors.actor
and Panels_and_Actors.panel = panels.id
and panels.strip = ?
instead of :
SELECT Actors.id FROM Actors, panels_and_actors, Panels
WHERE id = Panels_and_Actors.actor
and Panels_and_Actors.panel = panels.id
and panels.strip = ?
Adding a /g modifier resolves this problem.