DataMgr Presentation: Converting from SQL for Inserts and Updates

I just uploaded a presentation on how to switch from SQL for inserts and updates to using DataMgr.  I am hoping this will be the first of a series of presentations on using DataMgr. Each will be short (this one is two minutes long) and cover one aspect of DataMgr.

Watch the presentation.

(this supercedes my post on inserting data with DataMgr).

Feel free to download DataMgr and give it a try. It is free and open-source.

I would appreciate any feedback.

DataMgr 1.1 Released

DataMgr 1.1 is out today. It fixes a few small bugs and adds a few enhancements that should make more common database interactions easier.

New methods in 1.1:

  • getMaxRowsPrefix
  • getMaxRowsSuffix
  • getNewSortNum
  • saveSortOrder
The first two methods help limit the rows returned from a query. Basically, getMaxRowsPrefix() returns "TOP X" for all databases except MySQL and getMaxRowsSuffix() returns "LIMIT X" for MySQL (where "X" is the maximum rows to return).

The saveSortOrder() method sets the values of a numeric field representing sort-order to the order you specifiy. Just pass the name of the table that you want to sort, the name of the column used to indicate the sort-order, and a comma delimited list of the primary key values in the desired order.

The getNewSortNum() method returns the value to use for the given numeric sort-order field to put a record after all other records. I use to put a new record after all existing records.

The getRecords method also has a new argument: "maxrows", which you can use to limit the number of results returned in the query (using - you guessed it - the first two methods mentioned earlier).

Additionally, I have added the ability to populate a table with data when using loadXML to ensure the existence of required tables and columns. This helps with easy deployment, but is beyond the scope of this post.

Support for MS Access is still somewhat limited. It can be used on ColdFusion MX 7 and higher as normal. It can only be used on previous version by loading tables via loadXML().

If you have any ideas for making DataMgr more useful, let me know and I would be glad to consider it.

Feel free to download DataMgr and try it out. It is free and open-source. You can also find documentation and links to other blog entries about using DataMgr.

Avoid Select *

A recent discussion on CF-Talk implied cfqueryparam as the culprit in a query problem. It seems, however that the problem only happens when using cfqueryparam in conjuction with "select *".

In the discussion, Ben Nadel pointed out reasons he recommends listing out columns instead of using of "select *". His words:

[More]

Preview of New Code Creator

Recently, a few ColdFusion programmers have written code generators. I was pretty excited about this until I realized that they don't write code the way I write code. I figured I wasn't the only one to want code generation "my way".

So, I started work on a code creator that would write code however you want it. The code creator provides a wizard and tools for creating a code generator. The generator is a cfc that extends a provided Generator.cfc. Each generator would take the information from the wizard and creates code from it.

Keep in mind that this is just a preview at this point. That being said, feel free to take a look and give me any feedback.

http://www.bryantwebconsulting.com/clients/generator/

I know it still needs plenty of work, but I am curious if this is something that others would find useful and what improvements other see that it needs.

Things I know that I need to add:

  • The ability to select the type of form field based on the datatype.
  • Limit the length of the form fields based on the length allowed in a column.
My hope (perhaps idealistic) would be that we could get some generators to create code for the different popular frameworks. This would make it more generally useful and provide another means of learning and comparing frameworks.

Incidentally, I am currently calling this "Configurable Code Creator", though I am not committed to that name, so I am open to suggestions.

This code is built on several other tools on which I have been working. Namely sebtags, DataMgr, and tag.cfc (now in version 0.2). I hope to write more about each of these in the future.

10X4 Meme

It has been really interesting reading a little about my fellow developers. So, I thought that I would share as well.

Four jobs I have had in my life:

  1. bag-boy at a grocery store
  2. painter's assistant
  3. banquet server
  4. bartender
Four movies I watch over and over:
  1. Dune
  2. Heat
  3. Shawshank Redemption
  4. American Beauty
Four places I've lived:
  1. Stillwater, OK
  2. Chapel Hill, NC
  3. Denver, NC
  4. Broken Arrow, OK
Four TV shows I love to watch:
  1. Rome
  2. Lost
  3. Gilmore Girls
  4. Boston Legal
Four place I have been on vacation:
  1. London
  2. Jamaica
  3. Grand Canyon
  4. Hawaii
Four web sites I visit daily:
  1. weblogs.macromedia.com
  2. houseoffusion.com
  3. google.com
  4. ray.camdenfamily.com
Four places I would like to visit:
(nowhere I would rather be)
  1. Tokyo
  2. New York City
  3. Rome
  4. Giza
Four of my favorite foods:
  1. home-cooked macaroni and cheese
  2. fondue
  3. Entenmann's donuts
  4. cheeseburgers
Four foods I dislike:
  1. seafood
  2. cooked carrots
  3. onions
  4. liver
Four friends I'm tagging:
  1. I'm following custom and letting anyone play that wants to do so.

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.