A database access should be as simple as telling the system what to do (the action to take or an SQL). All those connecting and disconnecting, opening and closing, initialization, house keeping and cleaning up should really be the job of the platform, not you as an application developer.
What can be simpler than this:
<beedatabase name=pricelist query="select Code, Name, Price from Product"> <table> <beeforeach var=rec source=(db)pricelist> <tr> <td>${rec:Code}</td> <td>${rec:Name}</td> <td>${rec:Price}</td> </tr> </beeforeach> </table> |
The BEE platform already knows which database on which server that you want to access and has all the authentication details to connect to it. Such information is set up when the website is established, and can be changed by the provider in a minute without any modification of your code.
All house keeping work of handling the database server and platform are done implicitly in the beedatabase command, and all clean-up works are done when the page loading is complete. All you do is to write the query, read the result for display or process. Aren't these the only things worth spending your precious time on?
Furthermore, since there is no database related specifications in your code, you can reuse the code in another application without modifications. (The database details of the new application is specified when your provider set up the new website for you.) Next
|