Entries for month: November 2008

Adventures in bad variable names

There are many built-in, always-there variable scopes in CF, including #cgi#, #form#, #url#, etc., and one does well to avoid using these names for anything other than their intended purpose.  However, I was doing a CFHTTP call (in CF8) and set the result attribute to 'http' (the result attribute allows you to specify the return variable name rather than receive the 'cfhttp' default) and immediately had issues. 

I discovered, to my surprise, that 'http' is synonymous with 'cgi' - at least under CF8/IIS6.  I actually would have expected it to be synonymous with 'cfhttp' (I seem to recall that 'http' was the fixed return variable name from cfhttp calls in earlier versions of CF?).

Anyway, if I ever need cgi environment variable values I use, of course, #cgi#.  I don't ever recall using #http# and never suspected it existed.  Begs the question why synonymous scope names even exist.

Anyway, weird.

No Comments

DBX 10.1.8 Released

Minor  update in this version:

  • when launching the SQL*Exec window from the table or view detail page, the populated sql now has the columns [bracketed] (by request)
  • increased the default size of the textarea in the SQLExec window since although its actually sizable by way of resizing the frames, the frames are difficult to see/resize

Also, it seems that RIAForge still suffers from its frequent downtime, so I've added a new alternate download link for DBX on the Projects page.

No Comments

T-SQL function to get word count

Similar in approach to the previous uf_charCount function, the following function returns the number of words in a string, assuming a space token as word separator.

Read more...

2 Comments

T-SQL function to get a char count

I needed an efficient and reusable way to get character counts in strings at the database level and produced the following udf which takes a string and a character and returns the number of occurrences of the character in the string.

Read more...

1 Comment

CF-style List functions in SQL Server

The built-in string handling functions in t-sql are all well and good, but there really aren't any graceful ways of handling lists.  As any CF developer that's been around a while knows, lists are pretty commonplace in practice, and there are times when it makes more sense (or you're required) to do list handling at the db level rather than at the front end.

The following six SQL Server udf's provide equivalent functionality to the ColdFusion list functions listfirst, listgetat, listsetat, listfind, listlast, and listcontains.

UPDATE 2/10/2011: now includes a listfind function as well. 

UPDATE 10/16/2011: now includes a listsetat function courtesy of Bud Schneegan.

UPDATE 5/6/2012: now includes a listcontains function by request.

Read more...

5 Comments