It's not a Smarty trick, but I think it's still worth sharing.
When you work with database, the performance increase from using prepared statements could be from mere 2% to 25% and more. But you often run into an issue of using statement call inside a function, making reuse of a prepared statement something of a problem.
Well, I've solved it the most straightforward way:

All prepared statememnts are stored in global scope, each associated with it's function name.
Functions, that use multiple statements (while they are few and far between, sometimes you need a few additional pieces from database before you can save a new row, or you need to alter 2 or more tables for one function call (a very bad practice - it makes tracking changes harder, but still happens sometimes)), save them with some __tail, clarifying the statement meaning.

If you use $dbh = new PDO('pgsql:host=localhost;dbname=test_basic01', $user, $pass); and you get the following error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432?'
then as pointed out under pg_connect at: http://www.php.net/manual/en/function.pg-connect.php#38291
******
you should try to leave the host= and port= parts out of the connection string. This sounds strange, but this is an "option" of Postgre. If you have not activated the TCP/IP port in postgresql.conf then postgresql doesn't accept any incoming requests from an TCP/IP port. If you use host= in your connection string you are going to connect to Postgre via TCP/IP, so that's not going to work. If you leave the host= part out of your connection string you connect to Postgre via the Unix domain sockets, which is faster and more secure, but you can't connect with the database via any other PC as the localhost.
******