Hi Folks,

Just curious if any other folks are using a table DAO like component. 
Now to explain...

A TableDAO component (for lack of better word) handles all of your (trivial) 
SQL code. Methods such as..

init(datasource,table,pk)
getRecord(id) - gets single record
getColumnValue(id,field)
setColumnValue(id,field,value)
select(codition) - condition is where clause
count(condition (optional))
insertEmpty() - eg insert new record, return primary key
update(struct) - eg update record from form struct
delete(id) - delete record

Well thats most of it. Works great for querying and updating simple tables. eg 
need to show a record in a form and have the user update it, etc. Takes only a 
couple lines of code and some error handling code... If you need to handle a 
table in a different way then just subclass it and overide or add new methods. 
I've done this to handle package/project/task style apps for example ;)

I'm sure this probably isn't that great best practice stuff but has saved me 
copious amounts of time writing trivial SQL. I've seen similar API's available 
for Java that do this sort of thing (but more complex, eg record(s) returned as 
objects not datasets, persistance, etc) but haven't heard much about coldfusion 
developers doing this.. (probably because cfquery is so damn convenient ;)

Another use of this I've found is for managing multi-user access. On each 
read/write method the affected PID's and query names are stored in a server 
scoped struct and hence you can track what users are using ur apps and inform 
them of other users with write access to the same data or after an update 
informing the user the data has been updated since their read, etc. Not exactly 
efficient but then again how else can you handle multi-user access except at 
the database level?

hmm that reminds me of another component I am using, basically a session object 
to store a form struct in case a form fails to update and the user needs to go 
back and edit it (using javascript back doesn't cut it and I use redirects..). 
I know blackstone has form persistance but having tried it out still not sure 
if it will suit my needs... anyway ;)

so yeah, just wondering how much u guys are having to roll your own sort of 
solutions to some of this stuff or what?? I've been using coldfusion for about 
a year, slowly starting to get into using java a bit more which is great, had 
high hopes for blackstone but not so sure now. Hardest thing for me is 
(efficient) UI work. I have looked at flex but of course u can't use it at that 
price, currently looking at lazslo but like flex its going to alter my app 
models a fair bit, ie much more service oriented, which probably ain't a bad 
thing but all takes time to figure this stuff out.

Sorry for the rant. haha

TiM



##
##
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at 
[EMAIL PROTECTED]

Reply via email to