Hi Daniel,

> I've gotten quite good at breaking out the SELECT pieces via
getMyRecordset type functions

Sorry not 100% clear.
You mean like getMyRecordsetXXX() type methods, where XXX is the operation, eg
getMyRecordsetAllCurrentStaff() 
?

> My biggest question is how to get all
of the FORM data into the CFC without relying on FORM.whatever

Ok i'm being a dumbo. Further explain please if you could.


The way I handle form updates for simple tables (Ie the form is only updating a 
single table) is to use an updates(form) method. I have a CFC instance for each 
table and it is initialized with the datasource, table name, primary key, etc 
(ie queries the table and populates a struct with the column names and data 
types). So in my form I have a hidden variable which is the primary key. Now 
when I call my update(form) method it looks for the primary key field and 
generates the SQL code necessary for the update based on the datatypes (ie if 
string datatype wrap quotes around it, etc).

Its not perfect, ie it updates all fields in the record but it saves getting my 
hands dirty writing trivial SQL for basic display/update record stuff.

TiM



-----Original Message-----
From: Daniel Short [mailto:[EMAIL PROTECTED]
Sent: Thursday, 18 November 2004 10:01 a.m.
To: [EMAIL PROTECTED]
Subject: [CFCDev] Process for Updating Database Records


Hi everyone,

I'm working on making my database layers a bit more abstract, and I'm just
curious how you all handle inserting and updating to tables through your
CFCs. I've gotten quite good at breaking out the SELECT pieces via
getMyRecordset type functions, but can't quite figure out the best way to
abstract INSERT and UPDATE statements. My biggest question is how to get all
of the FORM data into the CFC without relying on FORM.whatever. The only
thing I can think of at the moment is to actually pass each form variable in
as an argument, but I can imagine how that could quickly get out of hand
with some of the rather large tables I need to maintain (I don't really want
to define 30 or more arguments in my CFCs).

Any ideas would be greatly appreciated.


Regards,

Daniel Short
Lead Developer
Cartweaver Development Team
Application Dynamics, Inc.


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