New 1.1 Release Candidate

I just put up a new version of DataFaucet, 1.1 and now a release candidate. This new version has a couple of new features.

1. Integrates with the new CacheBox caching framework that lets you hot-swap the caching engine and gives you a nice management application for all your applications (ColdBox, Wheels, onTap, DataFaucet, FuseBox, etc).

2. A new revision of the Persistence Service that I had started working on last year. This feature was inspired by discussion on two of Joe Rineharts blog entries last year, titled Does ColdFusion Have NO Real ORM Frameworks? and What Makes a Framework an ORM? Out of those discussions I created this new system in DataFaucet that I think will appeal to developers who enjoy Dependency Injection (DI) frameworks like ColdSpring or Lightwire, and would like an ORM that will more or less "stay out of your way". It uses your existing DI Factory as a source for objects and will even generate all the database tables necessary to persist those objects.

Here's the documentation for the new Persistence Service:

http://www.datafaucet.com/persistenceservice.cfm

Enjoy!

DRY and the Deleted Region

Here's a bit of a trick that I don't know if I've described before, so I figured some folks might like to hear about it here... This is yet another great reason to always, always, always use foreign key constraints (except when you shouldn't). ;)

[More]

Fusebox?

Has anybody tried out the Fusebox 5 Lexicon? I'm interested to know if anyone has tried it and what their impressions are.

Thanks

p.s. I may add a df:liquify tag to the lexicon that would actually take in standard sql syntax and convert it. I haven't decided for certain if I want to take the time to do that though - Liquify was never intended to be a bulletproof solution.

Fusebox Update

I've had a little more time to test the fusebox lexicon and in testing the insert and update verbs I realized they were a little less intuitive / more verbose than I prefer. So I've enhanced them a bit... This is the first time I've created a lexicon for Fusebox and although I don't like all of the decisions about how they work, I will say that I really like the fact that the lexicons can be placed in a mapped directory so you don't have to copy them anywhere. This way if you have multiple applications on your server they can all share the same lexicon in the DataFaucet installation if you prefer or you can install the lexicon into a separate directory if you want to tweak it.

I created a singular model circuit and put all my testing code in that circuit. I configured the faucet by calling the circuit's configureFaucet fuseaction in the appinit in fusebox.xml and then placed a call to the openFaucet fuseaction in the controller's prefuseaction so that the faucet is opened at the beginning of each request.

<circuit access="public" xmlns:df="/datafaucet/fusebox/lexicon">
   <fuseaction name="configureFaucet">
      <df:open server="mssql"
         datasource="datafaucet"
         catalog="galleon"
         schema="dbo" />

   </fuseaction>
   
   <fuseaction name="openFaucet">
      <df:open />
   </fuseaction>
   
   <fuseaction name="getMessages">
      <df:select name="qMessage" table="galleon_messages">
         <!-- filter messages by the event's threadid value -->
         <df:filter column="threadid" />
      </df:select>
   </fuseaction>

   <fuseaction name="searchMessages">
      <!-- search messages with and/or keywords -->
      <df:select name="qMessage" table="galleon_messages">
         <df:filter column="title,body"
            content="searchphrase"
            andorkeywords="true" />

      </df:select>
   </fuseaction>

   <fuseaction name="saveMessage">
      <!--- insert or update a message record --->
      <!--- assume event.getAllValues() as the data to save --->
      <df:update table="galleon_messages">
         <!-- update on the id column -->
         <df:filter column="id" />
      </df:update>
   </fuseaction>

   <fuseaction name="deleteMessage">
      <df:delete table="galleon_messages">
         <df:filter column="id" />
      </df:delete>
   </fuseaction>

   <!-- or use ActiveRecord --->
   <fuseaction name="getMessageObject">
      <df:record object="MyMessage"
         class="my.activerecord.class"
         action="read" id="id" />

   </fuseaction>

   <fuseaction name="saveMessageObject">
      <!--- assume event.getAllValues() as the data to save --->
      <df:record object="MyMessage" action="save" />
   </fuseaction>
</circuit>

Also, although these samples show the assumptions, you're not tied in to them - you can specify data="myStruct" for a df:update or a df:record action="save" verb. You can also specify df:data verbs as children of the df:update verb for mor granular control. df:filter can accept a "content" attribute if you want to use something other than an event value matching the column name, or if the situation calls for it, you can nest a df:select inside your df:filter to filter on a subquery, i.e. "delete from myTable where id in (select id from othertable where othercolumn like '%something%')".

Fusebox Lexicon

I just added a first draft of a lexicon for using the DataFaucet SQL library with Fusebox 5. It uspports select, insert, update and delete. I've tested select, filter, filtergroup, collection filter and even using a subquery as a filter. Nothing else is tested yet, and it doesn't include any support yet for using ActiveRecord as the medium for data access.

BlogCFC was created by Raymond Camden. This blog is running version 5.5.006. | Protected by Akismet | Blog with WordPress