Yes. Think about code execution. Just because code execution goes in and out of functions doesn't mean that the DB class isn't going to handle what it's told to do. Functions/methods do limit variable scope, help organize your code, and have other benefits. Functions/methods aren't going to interfere with your transactions.