|Keep It Simple, Stupid|
One way to reduce the number of SQL functions is to model the database schema in the database.
This approach uses tables to model the database table names, column names, datatypes, relationships, and the ordinality of the relationships.
This approach allows many queries to be automatically generated. Instead of using a lot of little wrapper functions, AUTOLOAD a function that performs a query on the schema, generates SQL code, and runs the query.
I haven't tried DbFramework but it looks like it does at least some of this and possibly much more.
There is an article about this approach, although it describes a Java implementation of the idea.
I used this approach on a database that has about 500 fully normalized tables. I use a GUI that is generated on the fly from the database metadata. There is also a database schema browser that is driven from the metadata. I would use this approach in the design of databases that have more than about 50 or 100 tables.
It should work perfectly the first time! - toma