Adam - 

I didn't really deeply read question 1, but I have answers for 2 and 3 off
the cuff:

2) To decrypt data from mssql on read I override the getByQuery method an
add user the setFieldExpression method on the Query to replace the column
value with an expression.  See the attached gateway as an example.

3) To encrypt data on write to mssql I override the save method on the
gateway.  Then, I make a duplicate Transfer Object, run a query (that only
manipulates data, it doesn't touch any data in the database) to encrypt the
data and then use that to populate the TO, which I then pass to the standard
save method.  See the attached DAO as an example.

Doug


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Adam Fortuna
Sent: Thursday, October 12, 2006 10:58 AM
To: [email protected]
Subject: [Reactor for CF] Encryption and database function questions

Hey, I'm just getting started with Reactor, but very impressed by what
I've seen so far!  I've run into a few issues and looking for some
best-direction advice on handling a few them.

1) I have a table that has two datetime fields (mssql). One is not
nullable and set for good when a user logs in (login time), another is
set when the user logs off and is null until then. What would be the
best way to handling saving this record? Looks like it'd be overriding
the create/update DAO functions, but wondering if there's a cleaner
way. Can't update this with the cf time either, has to be the
databases time so passing in a date is out. Is there a way to set
fields in an object to a database expression, rather than a value?

2) I have a table that has encrypted data which is decrypted using a
database function.  Whenever i read from this table (through a gateway
or record) i'd want to view the result of that function call instead
of that fields value. I noticed query.setFieldExpression() allows for
pretty much exactly what I want, but still figuring out how to
implement it into a record/gateway (yeah, i'm new; still digging into
how everything works). Suppose I could make a view for this, then
overwrite the DAO too, but wondering if there's another way.

3) The last one I'm pretty sure can't be done without updating the
DAO, but like #2 I need to run an encypt function whenever data is
written to the database. It would pretty much rule out using the
current ones because it can't be cfparamd; so can't imagine it being
that easy but thought i'd ask.


Would it be possible to define "readers" and "writers" to the database
through metadata maybe? And whenever it's overwritten use that
expression rather than the value of that field (without cfparaming).

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

Attachment: ConsumerDao.cfc
Description: application/cfc

Attachment: ConsumerGateway.cfc
Description: application/cfc

Reply via email to