DataMgr Basics
I saw a comment recently that said of DataMgr "His project does a lot more than what i need, otherwise I would use it myself. ". This was in the context of suggesting someone look at DataMgr, so I certainly don't want to seem ungrateful. Even so, this got me thinking.
I have certainly seen programs that do so much that the extra stuff gets in the way of doing the easy stuff. I don't think that is the case with DataMgr, however.
The download for the current version of DataMgr (2.2.0.2) is a 71KB zipped file (under 400KB unzipped) - hardly massive.
So, how hard is it to use? I have a database on my local computer named "TestSQL" that has a table named "widgets". Fields in this table include "color" and "size".
Here is actual code to save a widget to the widgets table:
<cfset sWidget = {color="tan",size="L"}>
<cfset oDataMgr.saveRecord("widgets",sWidget)>
In practice the sWidget structure could be the Form structure from a form post or the arguments structure inside a method. Either way, this is hardly rocket science.
Of course, in practice I would instantiate DataMgr into Application scope (just for convenience) in Application.cfcm or Application.cfc.
<cfset Application.DataMgr = CreateObject("component","DataMgr").init("TestSQL")>
</cfif>
Then the first example would be:
<cfset Application.DataMgr.saveRecord("widgets",sWidget)>
What about getting records?
Here is the code to get all of the records in the widgets table:
What if I want to get only the widgets that have color="tan"?:
<cfset qWidgets = Application.DataMgr.getRecords("widgets",sWidgets)>
Now, DataMgr can do much more than this, and has online documentation available to detail more functionality, but I just want to point out how easy it is to get started using it.
DataMgr is open source and free for any use.
There are no comments for this entry.
[Add Comment]