Here is the updated question:
the current query is doing something like:
$sql1 = \"TRUNCATE TABLE fubar\"; $sql2 = \"CREATE TEMP
You could do the truncate after the 'create if not exists'. That way it will always exist... and always be empty at that point.
CREATE TABLE fubar IF NOT EXISTS TRUNCATE TABLE fubar