Aliaspooryorik
ColdFusion ORM Book

DataMgr Overview

Steve Bryant was kind enough to present DataMgr to Devon CFUG this week. It was a great presentation which generated a lot of interest from the group. So, first and foremost - Thanks Steve!

The presentation is available online for anyone who wants to watch it at: http://admin.adobe.acrobat.com/_a200985228/p15495358/

I thought I'd try and do Steve's presentation justice by giving a quick overview of what was covered and the areas/features that got the most attention. This is not meant to be an exhaustive feature list of what DataMgr can do it is just the features that appealed most to our group. So, here it is (in no particular order).

What Is DataMgr?

DataMgr is a free Database Abstraction Tool (which means it writes the SQL for you). It acts as a Data Access Layer (DAL) between your business logic and the database. As you would expect from a DAL it handles CRUD methods (Create, Read, Updated and Delete) but has a few other tricks up it's sleeve which I've mention later. As it isn't an ORM, it will probably suit Procedural Programmers as it returns ColdFusion queries and doesn't require you to pass objects to update/insert and delete. DataMgr accepts data as ColdFusion Structs which is really flexible. It can also handle Null values and updating individual columns in your database table without having to pass all the values (you may only need to update one field in your record).

Databases Support

MSSQL, MySQL, Postgress, Access and 2.2 Beta adds support for Oracle and Derby. DataMgr also has the ability to simulate a database and it's data, if you've heard of QuerySim then this is a similar concept.

Primary Key

A neat feature of DataMgr is that it returns the Primary Key when you Create (Insert) a new record into your database.

Truncation

Throws a 'nice' error which you can handle if you try to pass a string that would be truncated. A nice feature is that it tells you which field will be truncated as opposed to the rather unhelpful generic error messages that the database server can throw!

Parsing Word Documents

When you (or more importantly - your client) copy and pastes from Word into your website admin, then it will paste in non ASCII characters such as quotes etc. DataMgr automatically converts those "Word" characters for the HTML equivalent, so you don't have to do any string parsing. Very nice!

ActiveSchema

DataMgr can introspect any of these databases to auto-magically work out your database schema. Alternatively you can define your table structure using XML and ActiveSchema. You can also pre-populate database tables, which is dead handy if you know that certain values must exist in your application when you deploy it (for example you might want to set up an administrator account so that you can login into the admin). Of course you could have DataMgr introspect you database, get it to create the XML ActiveSchema file and then update the XML file to handle future updates to you database tables once it has real data in it. Add to that the fact that DataMgr can even create the database tables, columns, default values etc from your XML file and you have to admit that it's pretty impressive!

Prototyping with QuerySim and ActiveSchema

I'm a firm believer in the FLiP process that Hal Helms and Sean Corfield promote. The basic idea is that you build a wireframe, which contains each page in your application which a client can then click through. Once this is agreed you move on to prototyping and this is where DataMgr can play a part.

Prototyping is when you start to "flesh out the bones" of your application and introduce styling, forms, lists etc so that the wireframe looks like the finished application.

DataMgr has the ability to create dummy data without the need for a database. You can define the database schema as an XML file using the Active Schema feature of DataMgr, so you can actually use queries using dummy data which won't need to be changed when you set up your real database. This makes making changes to the database schema much easier as you're only updating a XML file and data a physical database.

SaveRelationList Method

The SaveRelationList Method can be a real time saver when working with Many to Many relationships. If you have a link table (also know as a pivot table) in your database which stores the relationships between two tables, DataMgr will handle which records need to be deleted or inserted into the link table based on a list you supply. This means that you aren't deleting records from your database only to then insert the same relationship again.

Aggregates

As well as the standard CRUD methods, DataMgr also supports Aggregate functions, such as Sum and Count. This can all defined in the ActiveSchema XML file or be used with database introspection by using a setColumn method.

Cascading Deletes

If you have set up relationships in the database, then DataMgr has the ability to handle cascading deletes. You can specify if DataMgr throws an error if there are any related records or to just go ahead and delete them.

As I stated at the top of this post, this is by no means an exhaustive list of what DataMgr can do, but I hope it has given a good overview of some of the capabilities. You can download DataMgr from http://datamgr.riaforge.org and read more about it on Steve's blog at http://www.bryantwebconsulting.com/blog/index.cfm/DataMgr


No comments

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.

Please subscribe me to any further comments
 

Search

Wish List

Found something helpful & want to say ’thanks‘? Then visit my Amazon Wish List :)

Categories

Recent Posts