DataMgr Is Worth A Look

I have been hearing lots of good things about some of the CRUD options available for use in ColdFusion applications.  With a new side project coming up I decided to give DataMgr by Steve Bryant a try.  I can say right from the top that I was very impressed with this tool.  According to the documentation DataMgr helps you in three ways:

  • CRUD: Database reads/writes including those of the type performed by cfinsert/cfupdate
  • ActiveSchema: The ability for your code to define your database structure. DataMgr can introspect the database structure or it can define it.
  • Prototyping: The ability to use simulated data for prototyping (much like QuerySim, but more powerful and less work).

The only piece I have used this far are the CRUD features.  For the project I was working on CyclingShare.com, I was needing to get the application built as soon as possible.  Everyone knows that you can easily get bogged down into writing general insert, update and delete statements when starting off a project.  It’s also up to the developer to add in query param tags as well to prevent SQL injection attacks, etc…  DataMgr handles those tasks for you, and lets you focus your time on other aspects of your application.  I completed my project in a total of around 6 to 7 hours, and did not write a single insert, update or delete statement.  DataMgr took care of those for me, as well as most of my select statements.  I choose to write some of the more advanced SQL queries myself (although DataMgr will allow custom SQL).  So how easy is DataMgr to use?  Below you will find snippets that display how to use DataMgr for CRUD handling.

<code lang="cfm[lines]"><br></br><cfscript><br></br>
//insert function<br></br> variables.foo = Application.DataMgr.insertRecord("yourtable",form);</cfscript>

//update function
variables.foo = Application.DataMgr.updateRecord("yourtable",form);

//delete function
variables.foo = Application.DataMgr.deleteRecord("yourtable",form);

//select function
filter = {pkid=Session.pkid};
variables.qryUser = Application.DataMgr.getRecords("yourtable", filter);

These are just simple examples to show you the high level functions of DataMgr.  One tip that makes using it even more of a breeze, is to name your form fields the same as your column names from your database tables.  You can then just pass in the entire form structure and it will take care of everything else.

I would highly recommend giving DataMgr a try.  I have already found it to be quite a time saver already.  You can see it in action here: CyclingShare.com

Comments

comments powered by Disqus