>> 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>

What this update does is allow you to pass in the SQL type to the fusebox verb. Before you had to hack the code a little when passing in data type for example like this:

<tr:parameter name="dateEntered" value="now(), 'date'" />

Now you can pass the data type in as it's own argument:

<tr:parameter name="dateEntered" value="now()" dataType="date" />

The types you can pass in are:

The type of the mapped value: string, date, boolean, numeric, GUID, UUID

I hope thats useful - I'm also surprised no one has picked this up :s.


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