>> GreenByte.info By Nick Tong (quiksilv) | Supported by: TalkWebSolutions.co.uk

Quick update to the TQL fusebox lexicon

Anyone using the TQL lexicon which a wrote about a while back should update it to use the following code:

<cfscript>
   // usage inside other verbs:    //      <transfer:parameter
   //            name="paramName"
   //            value="someVal"
   //            dataType="date" />

   if (fb_.verbInfo.executionMode is "start") {
      // validate attributes       // <parameter> must have a parent verb this lexicon:       if (structKeyExists(fb_.verbInfo,"parent") and
            fb_.verbInfo.parent.lexicon is fb_.verbInfo.lexicon and
            listFind("delete,read,save,tql",fb_.verbInfo.parent.lexiconVerb) neq 0) {

         // name - string - required          if (not structKeyExists(fb_.verbInfo.attributes,"name")) {
            fb_throw("fusebox.badGrammar.requiredAttributeMissing",
                     "Required attribute is missing",
                     "The attribute 'name' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
         }
         // value - string - required          if (not structKeyExists(fb_.verbInfo.attributes,"value")) {
            fb_throw("fusebox.badGrammar.requiredAttributeMissing",
                     "Required attribute is missing",
                     "The attribute 'value' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
         }
         // check to see if we're passing in a datatype          if (structKeyExists(fb_.verbInfo.attributes,"dataType")) {
               thisValue = '#fb_.verbInfo.attributes.value#,"#fb_.verbInfo.attributes.dataType#"';
         }
         else{
            thisValue = fb_.verbInfo.attributes.value;
         }
         // add this parameter to the parent data:          fb_.verbInfo.parent.parameters[fb_.verbInfo.attributes.name]   = thisValue;
         

      } else {

         fb_throw("fusebox.badGrammar.parameterInvalidParent",
                  "Verb 'parameter' has invalid parent verb",
                  "Found 'parameter' verb with no valid parent verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");

      }

   }
</cfscript>

[More]


Learn Transfer ORM - this Thursday!

If you don't already know the Transfer ORM framework

automate[s] the repetitive tasks of creating the SQL and custom CFCs that are often required when developing a ColdFusion application.

If you want to learn more about this framework be sure to check out Mark Mandels workshop on Thursday


TQL Transfer lexicon for fusebox

Transfer is getting better all the time, with some recent speed improvements it keeps growing. If you've not used Transfer in fusebox yet check out this post.

Since March Transfer has supported TQL, which is transfers own scripting language:

There is also a scripting language that allows you to perform database queries based on the information and naming scheme that you set up in your transfer configuration file called Transfer Query Language (TQL). TQL is very similar to SQL, however since Transfer already knows about the relationships in your system, you don't have to write as much code to perform complicated queries against your database.

This is a fantastic addition as it allows you to quickly manipulate your data. One thing that I thought could make easy to use via fusebox was to create a lexicon, which I have done here:

[More]


Framework code generation

Over at cfFrameworks.com we are continuing our workshops with Brian Rinaldi. Brian will be giving a workshop on his Illudium PU-36 Code Generator. If you're a Coldspring or Transfer fan then this is a must see workshop.

[More]

Transfer list lexicon update for fusebox

I've just made a quick change to the Transfer ORM list lexicon so it takes the argument 'orderProperty'. This will allow you to order your query.

From fusebox call the lexicon like

[More]

Transfer ORM error... what did I do wrong?

I have been playing around with Mark Mandels Transfer ORM a bit more recently and tonight I got a strange error:

Element ID is undefined in XOBJECT.

What does this mean..

well after searching sadly i didn't find that much info, so I did the following things:

1. Validated my transfer.xml - nope
2. Made sure I had a primary key.. err, okay stupidly I didn't, after fixing this the error was still persistent
3. Define the id in transfer.xml (this tells transfer what the primary key is) - bingo!

What i had before was:

<property name="contactID"       type="numeric" />

and what i needed was

<id       name="contactID"       type="numeric" />

D'oh.

Setting up and using Transfer within fusebox via the Transfer lexicons

Setting up Transfer within fusebox via the Transfer lexicons

After my previous post where I cover Setting up Coldspring within fusebox via the CS lexicons I've now just got Transfer working with the Transfer lexicons.

To get Transfer setup you need to initilise the Transfer factory, you do this using the initialize verb. The best place to do this is in the appinit section of fusebox.xml.cfm as this is called when you start your app (it's like the onApplicationStart function in application.cfm). Within this function I call a fuseaction in my model circuit:

<appinit>
<fuseaction action="m.transferSetup" /> </appinit>
Then inside my model circuit I have this fuseaction
...
<circuit access="public" xmlns:tr="transfer/">
<fuseaction name="transferSetup">
<tr:init
            datasource="/config/datasource.xml.cfm"
            configuration="/config/transfer.xml.cfm"
            definitions="/model/transferData" />

</fuseaction>

So what's heppening here:

[More]

A quick review on Brian Rinaldis code generator

So after my previous post about not being able to get flex running on my local dev machine I decided to give Brian Rinaldis CFC Object Generator (CFCOG, or as Brian likes to call it: Illudium PU-36 Code Generator) a test from another machine, and boy does it deliver.

First of though what is it:

This project generates ColdFusion components (i.e. bean, DAO, gateway, service), ColdSpring XML, Transfer XML, and ActionScript Value-Objects using the admin api and database introspection. The front-end is built in Flex 2. The code outputted for easily pasting or saving into a project to allow you to get a head-start on some of the grunt work of doing OO in CF. It uses XSL to generate the components and is designed to allow you to easily add to or modify the generated code. You can even create new templates that can be swapped out at run-time.

If you have the system requirements, you install the application and are presented with an intuitive interface:
screen shot 1

To get the app to generate code for you, you simply:

  • select the database you want
  • select the database table
  • select the template type (default, prototype or transfer)
  • select your CFC path
  • and select a path for your code output (used for saving generated code)
  • click generate

You will then get an output in the main area of the screen with your generated code. In my example I'm wishing to generate code for Mark Mandels Transfer frameworks and depending on which template type you are using you will get different tab outputs on the following screen. For transfer you get four tabs:

[More]

ORM - what the heck!

Mark Mandel has been interviewed over on cfFrameworks.com about his Object Relationship Model Transfer framework, covering where it sits within the application layer and he talks about some of the functions such as decorators.

If you're tired of creating all the SQL for you data abstraction then you need to check out Transfer. Pop over to the site to check the interview podcast out.

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