There is not a right answer for this really. Adobe ColdFusion does not have a datatype of null. The only other CF server that I know of that offers the null datatype is New Atlanta's BlueDragon version 7, which I do not believe is out yet. If there are other ways to pass null from CF to an RDBMS, someone please correct me.
With that said, you know the primary key of the field and the column you want to set as null. I myself would create a custom record that executes a stored procedure to update this column. You have a customizable record CFC in your project. Create a function that either executes an ad hoc query or a stored procedure call. Pass in the primary key of the record to update.
Now I said a custom record function with a query call in it. I recommend this as it only modifies one record at a time. If the query updates more than one record, you will want to put this in your gateway CFC. This is a style, but it is a style that keeps your reactor objects structure friendly and easy to maintain.
You can find an example in the live at http://livedocs.reactorframework.com/
Below is some psuedo code:
<cffunction name="updateNull" ... >
<cfargument name="somenumber" required="yes" ... >
<cfquery name="queryname" datasource="#_getConfig().getDsn()#">
...
</cfquery>
</cffunction>
This function would be in the record CFC associated to the table you are trying to update.
Hope this helps.
Teddy
Hi Folks,
My apologies for posting this again, but I'm really stuck.
Reactor has been really great for my current project and saved me loads of time, but until I figure out a way of doing this, I can't launch the site.
Basically what I want to do is:
myRecord = reactor.createRecord("MyTable");
myRecord.setMyPK(1);
myRecord.load();
myRecord.setMyCol(null); // where my 'myCol' is an integer database table that can be null
myRecord.save();
The problem is setting the column to null. Not passing an argument throws an error, likewise does passing an empty string.
I'd really appreciate if someone could show me how to do this with reactor, or at least point me in the right direction. I'd imagine this is a fairly common database task, so someone must have tried this before.
Thanks,
Gareth
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Gareth Cole
Sent: 13 July 2006 18:04
To: [email protected]
Subject: [Reactor for CF] updating a column to NULL
Hi,
one of my tables has an integer column 'myCol' that can be NULL.
I can set this to an integer, but I'm having trouble setting it to NULL:
setMyCol() throws an error because there's no argument passed
setMyCol("") throws an error because the argument isn't numeric
How can I do this using reactor?
Thanks
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
<cf_payne />
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

