Because there are multiple parts of the software that need to be updated when a post is added, there isn't just a simple query that can be run.
But I think the best way to learn what all goes on and what all you need to account for, and how to do it in the first place, would be to look at the actual code in the core. I'd start in functions_post.php. Look for the submit_post() function. You may also need to look at the context surrounding it when it is called in posting.php
Since that function likely requires certain parts of phpBB core to be included, you can't include the functions_post.php file and call that function, but you can likely extract and adapt parts of the function to do what you need.
Don't forget to smile today.
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.