command($sql, array(json_encode($periods)));