Re: CFC Best Practices

2008-08-25 Thread William Seiter
>I've tried using the result.identitycol trick with CF8 and MSSQL and for 
>me, it doesn't work.  I just get an error.
>

Not that it is the best approach, but the result.identitycol trick is a little 
'tricky'

eg.  

if you cfdump queryname, you will see the identity col, BUT if you try to get 
the identitycol with queryname.identitycol, it doesn't work.

Here is the tricky part:
add a 'result' parameter

eg.  

and then refer to the identitycol through that result.


Hope this helps



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311533
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best Practices

2008-08-25 Thread William Seiter
If you decide to go in this direction, I would suggest not just using the 
'datetime' added column.  create a truly unique identifier such as: "datetime 
(MMDDHHMMSS)+ user ip address (or username if logged in) plus a random 
sequence".  This way you will know you can search on the unique and not get a 
possible duplicate.

However, you can also create a separate set of functions (CFCs) for each 
possible database so that you only hit the database once per call, if you want 
to blend the need for optimized code along with database type independence.

William


>What I'm thinking, from this thread and others I've read in the past,
>is that if keeping your code database-independent is priority.
>inserting some unique identifier and then querying for that in a second query
>...might be the best option.
>
>Or do you folks find that you can't really stay uncoupled from your DB?
>
>
>
>
>> issue, but it is definitely something that must be kept in mind. 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311512
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-25 Thread David G
What I'm thinking, from this thread and others I've read in the past,
is that if keeping your code database-independent is priority.
inserting some unique identifier and then querying for that in a second query
might be the best option.

Or do you folks find that you can't really stay uncoupled from your DB?



On Tue, Aug 19, 2008 at 11:35 AM, Brian Kotek <[EMAIL PROTECTED]> wrote:
> While it probably won't happen often, depending on load, even the Now()
> logic can result in two records with the same value if they come in at the
> same time. And cftransaction will only work if you go all the way to
> "serializable" for isolation level, which essentially single-threads access
> and, again depending on how often the query is run, can be a performance
> issue.
>
> If this query isn't hit a lot by multiple threads none of this may be an
> issue, but it is definitely something that must be kept in mind.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311511
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best Practices

2008-08-19 Thread James Holmes
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_p-q_17.html

"result_name.ROWID; Oracle only. The ID of an inserted row. This is
not the primary key of the row, although you can retrieve rows based
on this ID."

This means we can now insert a row and then query the DB on the ROWID
to get the new PK (useful if the PK came from a trigger that
incremented a sequence). Even works without a transaction.

If you're using stored procs you have the "RETURNING INTO" clause at
your disposal, so it may be less useful for you.

On Wed, Aug 20, 2008 at 10:31 AM, Craigsell  wrote:
> To what CF8 goodies do you refer?  I do everything in ORACLE (mostly using
> stored procs) but I haven't had a chance to do a deep dive into CF8 yet...
>

-- 
mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311298
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best Practices

2008-08-19 Thread Craigsell
To what CF8 goodies do you refer?  I do everything in ORACLE (mostly using 
stored procs) but I haven't had a chance to do a deep dive into CF8 yet...

Thanks!

Warren Koch 


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311291
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-19 Thread Mike Kear
For MSSQL there's a native function to give you the id.   In a CFQuery
tag it works like this:


SET NOCOUNT ON
INSERT into Tablename
( email, firstname, lastname ) VALUES
(
,
,

   )
SELECT Ident_Current('Tablename') as RecordID
SET NOCOUNT OFF


The NOCOUNT thing prevents MSSQL returning messages that might cause
the query to abort.   The Ident_Current('tablename') gives you the
ident of the latest insert in the current tablename.   Because it's
all done in a single CFQUERY, I do believe the table  is automatically
locked

This is only a MSSQL solution but i've never had a problem with
getting the ID this way, even on my highest volume sites.

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month


On Wed, Aug 20, 2008 at 1:26 AM, RobG <[EMAIL PROTECTED]> wrote:

>
> I've tried using the result.identitycol trick with CF8 and MSSQL and for
> me, it doesn't work.  I just get an error.
>
> So what I've stuck to is this...
>
> Before the first insert, I do 
>
> Then in the insert, for my date_added value, I use #now#.
>
> Then after that, when I do my select MAX(id), I also add where
> date_added = '#now#'
>
> AND I also wrap the whole thing in a cftransaction...
>
> Rob
>

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311287
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC Best Practices

2008-08-19 Thread William
;)

William Seiter (mobile)

Have you ever read a book that changed your life?
go to:  http://www.winninginthemargins.com
and use passcode: GoldenGrove

-Original Message-
From: "RobG" <[EMAIL PROTECTED]>
To: "CF-Talk" 
Sent: 8/19/2008 9:55 AM
Subject: Re: CFC Best Practices

William Seiter wrote:
> Try SCOPE_IDENTITY() instead of SCOPY_IDENTITY()

D'OH!

Man and I even went over it to be absolutely certain it wasn't something 
stupid.

Rob



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311284
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-19 Thread RobG
William Seiter wrote:
> Try SCOPE_IDENTITY() instead of SCOPY_IDENTITY()

D'OH!

Man and I even went over it to be absolutely certain it wasn't something 
stupid.

Rob

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311275
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best Practices

2008-08-19 Thread William Seiter
Try SCOPE_IDENTITY() instead of SCOPY_IDENTITY()

>Sandra Clark wrote:
>> Actually if you are using  MSSQL 2000 or 2005 or up, you should be using
>> 
>> VALUES(); 
>>  SELECT  SCOPE_IDENTITY() AS id
>> 
>
>Okay, I just added this to my insert function, and got this:
>
>[Macromedia][SQLServer JDBC Driver][SQLServer]'SCOPY_IDENTITY' is not a 
>recognized built-in function name.
>
>Here's the exact line:
>
>   );
>   select SCOPY_IDENTITY() as newuserid
>   
>
>Rob 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311272
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-19 Thread RobG
Sandra Clark wrote:
> Actually if you are using  MSSQL 2000 or 2005 or up, you should be using
> 
> VALUES(); 
>   SELECT  SCOPE_IDENTITY() AS id
> 

Okay, I just added this to my insert function, and got this:

[Macromedia][SQLServer JDBC Driver][SQLServer]'SCOPY_IDENTITY' is not a 
recognized built-in function name.

Here's the exact line:

);
select SCOPY_IDENTITY() as newuserid


Rob

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311270
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC Best Practices

2008-08-19 Thread Craig Dudley
Interesting, never had a problem with @@IDENTITY though. It seems to me that
unless you're using triggers, it's pretty much impossible for it to return
the wrong value in a query like the example below.

SCOPE_IDENTITY() certainly looks a little safer but I'm not worried about
all my old code.

Craig.

-Original Message-
From: Matt Williams [mailto:[EMAIL PROTECTED] 
Sent: 19 August 2008 16:57
To: CF-Talk
Subject: Re: CFC Best Practices

On Tue, Aug 19, 2008 at 10:44 AM, Craig Dudley <[EMAIL PROTECTED]> wrote:
> Rob, if you are using MSSQL why don't you use @@IDENTITY?

Just to be clear, @@identity returns the most recent inserted id of
all tables. So if you had a trigger that when a table gets an insert,
another table also gets an insert, @@identity would return the
triggered table ID.

For SQL 2000 +, look at SELECT SCOPE_IDENTITY() or SELECT
IDENT_CURRENT('tablename').

http://www.sqlteam.com/article/alternatives-to-identity-in-sql-server-2000

I've seen other good blog entries / articles about this, but couldn't
locate them at the moment.

-- 
Matt Williams
"It's the question that drives us."



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311269
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC Best Practices

2008-08-19 Thread Sandra Clark
Actually if you are using  MSSQL 2000 or 2005 or up, you should be using

VALUES(); 
SELECT  SCOPE_IDENTITY() AS id

-Original Message-
From: Craig Dudley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2008 11:45 AM
To: CF-Talk
Subject: RE: CFC Best Practices

Rob, if you are using MSSQL why don't you use @@IDENTITY?

e.g. this crappy example...


INSERT INTO tblLocations (
address1, address2, address3, town
)
VALUES (
,
,
,
,

)
SELECT @@IDENTITY AS locationID


#insertLocation.locationID# is then your last inserted item. (assuming
tblLocations has an identity column that is)

Cheers,

Craig.


-Original Message-
From: RobG [mailto:[EMAIL PROTECTED] 
Sent: 19 August 2008 16:26
To: CF-Talk
Subject: Re: CFC Best Practices

James Holmes wrote:
> You can generally avoid the problem with a cftransaction tag if you're
> doing the MAX(id) thing, but the other solutions are better
> (especially the new CF8 goodies which, for example, are a life saver
> for Oracle).

I've tried using the result.identitycol trick with CF8 and MSSQL and for 
me, it doesn't work.  I just get an error.

So what I've stuck to is this...

Before the first insert, I do 

Then in the insert, for my date_added value, I use #now#.

Then after that, when I do my select MAX(id), I also add where 
date_added = '#now#'

AND I also wrap the whole thing in a cftransaction...

Rob





~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311268
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best Practices

2008-08-19 Thread Matt Williams
On Tue, Aug 19, 2008 at 10:44 AM, Craig Dudley <[EMAIL PROTECTED]> wrote:
> Rob, if you are using MSSQL why don't you use @@IDENTITY?

Just to be clear, @@identity returns the most recent inserted id of
all tables. So if you had a trigger that when a table gets an insert,
another table also gets an insert, @@identity would return the
triggered table ID.

For SQL 2000 +, look at SELECT SCOPE_IDENTITY() or SELECT
IDENT_CURRENT('tablename').

http://www.sqlteam.com/article/alternatives-to-identity-in-sql-server-2000

I've seen other good blog entries / articles about this, but couldn't
locate them at the moment.

-- 
Matt Williams
"It's the question that drives us."

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311267
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC Best Practices

2008-08-19 Thread Craig Dudley
Rob, if you are using MSSQL why don't you use @@IDENTITY?

e.g. this crappy example...


INSERT INTO tblLocations (
address1, address2, address3, town
)
VALUES (
,
,
,
,

)
SELECT @@IDENTITY AS locationID


#insertLocation.locationID# is then your last inserted item. (assuming
tblLocations has an identity column that is)

Cheers,

Craig.


-Original Message-
From: RobG [mailto:[EMAIL PROTECTED] 
Sent: 19 August 2008 16:26
To: CF-Talk
Subject: Re: CFC Best Practices

James Holmes wrote:
> You can generally avoid the problem with a cftransaction tag if you're
> doing the MAX(id) thing, but the other solutions are better
> (especially the new CF8 goodies which, for example, are a life saver
> for Oracle).

I've tried using the result.identitycol trick with CF8 and MSSQL and for 
me, it doesn't work.  I just get an error.

So what I've stuck to is this...

Before the first insert, I do 

Then in the insert, for my date_added value, I use #now#.

Then after that, when I do my select MAX(id), I also add where 
date_added = '#now#'

AND I also wrap the whole thing in a cftransaction...

Rob



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311264
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-19 Thread Brian Kotek
While it probably won't happen often, depending on load, even the Now()
logic can result in two records with the same value if they come in at the
same time. And cftransaction will only work if you go all the way to
"serializable" for isolation level, which essentially single-threads access
and, again depending on how often the query is run, can be a performance
issue.

If this query isn't hit a lot by multiple threads none of this may be an
issue, but it is definitely something that must be kept in mind.

On Tue, Aug 19, 2008 at 11:26 AM, RobG <[EMAIL PROTECTED]> wrote:

> James Holmes wrote:
> > You can generally avoid the problem with a cftransaction tag if you're
> > doing the MAX(id) thing, but the other solutions are better
> > (especially the new CF8 goodies which, for example, are a life saver
> > for Oracle).
>
> I've tried using the result.identitycol trick with CF8 and MSSQL and for
> me, it doesn't work.  I just get an error.
>
> So what I've stuck to is this...
>
> Before the first insert, I do 
>
> Then in the insert, for my date_added value, I use #now#.
>
> Then after that, when I do my select MAX(id), I also add where
> date_added = '#now#'
>
> AND I also wrap the whole thing in a cftransaction...
>
> Rob
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311263
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-19 Thread RobG
James Holmes wrote:
> You can generally avoid the problem with a cftransaction tag if you're
> doing the MAX(id) thing, but the other solutions are better
> (especially the new CF8 goodies which, for example, are a life saver
> for Oracle).

I've tried using the result.identitycol trick with CF8 and MSSQL and for 
me, it doesn't work.  I just get an error.

So what I've stuck to is this...

Before the first insert, I do 

Then in the insert, for my date_added value, I use #now#.

Then after that, when I do my select MAX(id), I also add where 
date_added = '#now#'

AND I also wrap the whole thing in a cftransaction...

Rob

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311262
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-19 Thread James Holmes
You can generally avoid the problem with a cftransaction tag if you're
doing the MAX(id) thing, but the other solutions are better
(especially the new CF8 goodies which, for example, are a life saver
for Oracle).

On Tue, Aug 19, 2008 at 11:12 PM, Scott Stewart <[EMAIL PROTECTED]> wrote:
> "
>
> Be aware though that inserting a record and then selecting the MAX id can
> result in an incorrect ID if more than one thread runs this code at the same
> time. You'd probably be better off getting the last inserted ID from the
> cfquery itself if you are on CF8, or looking at using a native database
> function like scope_identity() (the actual function varies across
> platforms).
>
> "
>
> Good point to ponder...

-- 
mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311261
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best Practices

2008-08-19 Thread Scott Stewart
"

Be aware though that inserting a record and then selecting the MAX id can
result in an incorrect ID if more than one thread runs this code at the same
time. You'd probably be better off getting the last inserted ID from the
cfquery itself if you are on CF8, or looking at using a native database
function like scope_identity() (the actual function varies across
platforms).

"

Good point to ponder...

Brian Kotek wrote:
> Separate methods might make sense if you need to do this from more than one
> method. If it is specific to that method it might not be worth breaking it
> up.
>
> Be aware though that inserting a record and then selecting the MAX id can
> result in an incorrect ID if more than one thread runs this code at the same
> time. You'd probably be better off getting the last inserted ID from the
> cfquery itself if you are on CF8, or looking at using a native database
> function like scope_identity() (the actual function varies across
> platforms).
>
> A bit more can be found here:
> http://www.forta.com/blog/index.cfm/2007/7/6/ColdFusion-8-Can-Return-Identity-Values
>
> On Tue, Aug 19, 2008 at 10:22 AM, Scott Stewart <[EMAIL PROTECTED]>wrote:
>
>   
>> This is more of a "how would you do it" question.
>>
>> I have a simple set of queries that are currently inside an cfif
>> statement, the "if "block inserts a record, grabs the id of the just
>> inserted record, and there's an optional update that runs if some one
>> else is entering there record.
>> I know I can just dump the queries into a function and it'll work...
>>
>> But would I be better served by creating separate functions and call the
>> last two from inside the insert function?
>>
>> --
>> Scott Stewart
>> ColdFusion Developer
>>
>> Office of Research Information Systems
>> Research & Economic Development
>> University of North Carolina at Chapel Hill
>>
>> Phone:(919)843-2408
>> Fax: (919)962-3600
>> Email: [EMAIL PROTECTED]
>>
>>
>>
>>
>> 
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311260
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best Practices

2008-08-19 Thread Brian Kotek
Separate methods might make sense if you need to do this from more than one
method. If it is specific to that method it might not be worth breaking it
up.

Be aware though that inserting a record and then selecting the MAX id can
result in an incorrect ID if more than one thread runs this code at the same
time. You'd probably be better off getting the last inserted ID from the
cfquery itself if you are on CF8, or looking at using a native database
function like scope_identity() (the actual function varies across
platforms).

A bit more can be found here:
http://www.forta.com/blog/index.cfm/2007/7/6/ColdFusion-8-Can-Return-Identity-Values

On Tue, Aug 19, 2008 at 10:22 AM, Scott Stewart <[EMAIL PROTECTED]>wrote:

> This is more of a "how would you do it" question.
>
> I have a simple set of queries that are currently inside an cfif
> statement, the "if "block inserts a record, grabs the id of the just
> inserted record, and there's an optional update that runs if some one
> else is entering there record.
> I know I can just dump the queries into a function and it'll work...
>
> But would I be better served by creating separate functions and call the
> last two from inside the insert function?
>
> --
> Scott Stewart
> ColdFusion Developer
>
> Office of Research Information Systems
> Research & Economic Development
> University of North Carolina at Chapel Hill
>
> Phone:(919)843-2408
> Fax: (919)962-3600
> Email: [EMAIL PROTECTED]
>
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311259
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best practices question

2008-03-05 Thread Dominic Watson
Lmao, my gf would pretend to listen for a 10 minutes or more as I explained
things to her. At the end of the lecture she'd say "that's nice dear, what's
for tea?" or some such.


On 05/03/2008, Gerald Guido <[EMAIL PROTECTED]> wrote:
>
> >> Lol best bit of being a codee geek init ;)
>
> yep... nothing quite like the high from intellectual discovery. It is hard
> to explain to non-geeks/science nerds.
>
> GF: "Oh, what are you all excited about?"
> Me: "I just figured out dependency injection".
> GF: "Huh?"
> Me: "Nothing."
>
>
> --
> "As an adolescent I aspired to lasting fame, I craved factual certainty,
> and
> I thirsted for a meaningful vision of human life - so I became a
> scientist.
> This is like becoming an archbishop so you can meet girls."
> - M. Cartmill
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300598
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best practices question

2008-03-05 Thread Gerald Guido
>> Lol best bit of being a codee geek init ;)

yep... nothing quite like the high from intellectual discovery. It is hard
to explain to non-geeks/science nerds.

GF: "Oh, what are you all excited about?"
Me: "I just figured out dependency injection".
GF: "Huh?"
Me: "Nothing."


-- 
"As an adolescent I aspired to lasting fame, I craved factual certainty, and
I thirsted for a meaningful vision of human life - so I became a scientist.
This is like becoming an archbishop so you can meet girls."
- M. Cartmill


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300597
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best practices question

2008-03-05 Thread Dominic Watson
>
> Thanx for the insight gentlemen. I am getting all wound up with the light
> bulbs going off at once.


Lol best bit of being a codee geek init ;)

Dominic
-- 
Blog it up: http://fusion.dominicwatson.co.uk


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300595
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best practices question

2008-03-05 Thread Gerald Guido
Thanx for the insight gentlemen. I am getting all wound up with the light
bulbs going off at once.

Prolly wont get much sleep tonight. :)


On Wed, Mar 5, 2008 at 5:42 PM, Dominic Watson <
[EMAIL PROTECTED]> wrote:

> >
> > I think you're starting to see where ColdSpring (or Lightwire) might
> > come in handy :)
>
>
> I second that - spend 30 mins getting a very basic ColdSpring setup
> running;
> you won't look back, it is a beautiful answer to this question.
>
> ColdSpring uses an XML file as a configuration for all your 'beans',
> here's
> a very rough example, reusing a component by passing it as an argument to
> another:
>
>
>  singleton="true">
>  MyDS
> 
>
> 
>  
>   
>  
> 
> Then, with coldspring up and running you might do in your app:
>
> 
>
> Hope that makes you curious. If you are looking for best design practice,
> the answer to your OP is to NEVER reference variables outside the scope of
> your component, pass it in as a variable as your instinct tells you ;)
>
> Dominic
> --
> Blog it up: http://fusion.dominicwatson.co.uk
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300594
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best practices question

2008-03-05 Thread Dominic Watson
>
> I think you're starting to see where ColdSpring (or Lightwire) might
> come in handy :)


I second that - spend 30 mins getting a very basic ColdSpring setup running;
you won't look back, it is a beautiful answer to this question.

ColdSpring uses an XML file as a configuration for all your 'beans', here's
a very rough example, reusing a component by passing it as an argument to
another:



  MyDS



 
   
 

Then, with coldspring up and running you might do in your app:



Hope that makes you curious. If you are looking for best design practice,
the answer to your OP is to NEVER reference variables outside the scope of
your component, pass it in as a variable as your instinct tells you ;)

Dominic
-- 
Blog it up: http://fusion.dominicwatson.co.uk


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300589
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best practices question

2008-03-05 Thread James Holmes
I'll second this. When you use ColdSpring, you end up having it passed
in as an init() parameter and then put it in the VARIABLES scope, so
it's available to all methods inside your object.

On Thu, Mar 6, 2008 at 7:29 AM, Charlie Griefer
<[EMAIL PROTECTED]> wrote:
> I think you're starting to see where ColdSpring (or Lightwire) might
>  come in handy :)
>
>
>
>  On Wed, Mar 5, 2008 at 2:24 PM, Gerald Guido <[EMAIL PROTECTED]> wrote:
>  > I have seen it set in the init and set to the variables scope. and then
>  >  called from individual functions.
>  >
>  >  So if the passed object is local to *only one* function should I pass it 
> to
>  >  just that one function?
>  >
>  >  Or if it used multiple times in the object I should store it as part of 
> the
>  >  object (in the init function) in the variables scope so it can be avalible
>  >  to multiple functions.


-- 
mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300588
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best practices question

2008-03-05 Thread Gerald Guido
Yep... that light bulb just went off. thanx.

On Wed, Mar 5, 2008 at 5:29 PM, Charlie Griefer <[EMAIL PROTECTED]>
wrote:

> I think you're starting to see where ColdSpring (or Lightwire) might
> come in handy :)
>
> On Wed, Mar 5, 2008 at 2:24 PM, Gerald Guido <[EMAIL PROTECTED]>
> wrote:
> > I have seen it set in the init and set to the variables scope. and then
> >  called from individual functions.
> >
> >  So if the passed object is local to *only one* function should I pass
> it to
> >  just that one function?
> >
> >  Or if it used multiple times in the object I should store it as part of
> the
> >  object (in the init function) in the variables scope so it can be
> avalible
> >  to multiple functions.
> >
> >  Does that sound right... make sense?
> >
> >  Thanx
> >  G
> >
> >
> >
> >  On Wed, Mar 5, 2008 at 5:07 PM, Matt Williams <[EMAIL PROTECTED]> wrote:
> >
> >  > On Wed, Mar 5, 2008 at 3:43 PM, Gerald Guido <[EMAIL PROTECTED]>
> >  > wrote:
> >  > > If I have an object loaded in the Application scope and want to use
> it
> >  > in
> >  > >  another object/component ,should I pass it in as a variable or
> should I
> >  > call
> >  > >  it directly from the Application scope. Assume that the object
> will
> >  > always
> >  > >  be loaded in memory.
> >  >
> >  > I vote for passing it in. It makes the component that will use it
> less
> >  > couple to application scope and therefore more reusable.
> >  >
> >  > If several methods within the component are going to need access to
> >  > various methods in the application.myCFC object, then it would make
> >  > more sense to do what Rich says in step 2. Basically when the
> >  > component that is dependent on app.myCFC is instantiated, it should
> >  > get that instance in variables scope
> >  >
> >  > 
> >  >  
> >  > 
> >  >  
> >  >  
> >  >
> >  >
> >  >  
> >  > 
> >  >
> >  >  createObject('component','myDependentCFC').init()
> >  > />
> >  > 
> >  >
> >  > --
> >  > Matt Williams
> >  > "It's the question that drives us."
> >  >
> >  >
> >
> >
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300587
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best practices question

2008-03-05 Thread Charlie Griefer
I think you're starting to see where ColdSpring (or Lightwire) might
come in handy :)

On Wed, Mar 5, 2008 at 2:24 PM, Gerald Guido <[EMAIL PROTECTED]> wrote:
> I have seen it set in the init and set to the variables scope. and then
>  called from individual functions.
>
>  So if the passed object is local to *only one* function should I pass it to
>  just that one function?
>
>  Or if it used multiple times in the object I should store it as part of the
>  object (in the init function) in the variables scope so it can be avalible
>  to multiple functions.
>
>  Does that sound right... make sense?
>
>  Thanx
>  G
>
>
>
>  On Wed, Mar 5, 2008 at 5:07 PM, Matt Williams <[EMAIL PROTECTED]> wrote:
>
>  > On Wed, Mar 5, 2008 at 3:43 PM, Gerald Guido <[EMAIL PROTECTED]>
>  > wrote:
>  > > If I have an object loaded in the Application scope and want to use it
>  > in
>  > >  another object/component ,should I pass it in as a variable or should I
>  > call
>  > >  it directly from the Application scope. Assume that the object will
>  > always
>  > >  be loaded in memory.
>  >
>  > I vote for passing it in. It makes the component that will use it less
>  > couple to application scope and therefore more reusable.
>  >
>  > If several methods within the component are going to need access to
>  > various methods in the application.myCFC object, then it would make
>  > more sense to do what Rich says in step 2. Basically when the
>  > component that is dependent on app.myCFC is instantiated, it should
>  > get that instance in variables scope
>  >
>  > 
>  >  
>  > 
>  >  
>  >  
>  >
>  >
>  >  
>  > 
>  >
>  >   > />
>  > 
>  >
>  > --
>  > Matt Williams
>  > "It's the question that drives us."
>  >
>  >
>
>  

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300586
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Best practices question

2008-03-05 Thread Gerald Guido
I have seen it set in the init and set to the variables scope. and then
called from individual functions.

So if the passed object is local to *only one* function should I pass it to
just that one function?

Or if it used multiple times in the object I should store it as part of the
object (in the init function) in the variables scope so it can be avalible
to multiple functions.

Does that sound right... make sense?

Thanx
G

On Wed, Mar 5, 2008 at 5:07 PM, Matt Williams <[EMAIL PROTECTED]> wrote:

> On Wed, Mar 5, 2008 at 3:43 PM, Gerald Guido <[EMAIL PROTECTED]>
> wrote:
> > If I have an object loaded in the Application scope and want to use it
> in
> >  another object/component ,should I pass it in as a variable or should I
> call
> >  it directly from the Application scope. Assume that the object will
> always
> >  be loaded in memory.
>
> I vote for passing it in. It makes the component that will use it less
> couple to application scope and therefore more reusable.
>
> If several methods within the component are going to need access to
> various methods in the application.myCFC object, then it would make
> more sense to do what Rich says in step 2. Basically when the
> component that is dependent on app.myCFC is instantiated, it should
> get that instance in variables scope
>
> 
>  
> 
>  
>  
>
>
>  
> 
>
>  />
> 
>
> --
> Matt Williams
> "It's the question that drives us."
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300585
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best practices question

2008-03-05 Thread Gerald Guido
>> Also don't forget to var your variables.

Why is it that when you ask a CFC question people assume that you aren't
scoping your variables?


On Wed, Mar 5, 2008 at 5:01 PM, Russ <[EMAIL PROTECTED]> wrote:

> Also don't forget to var your variables.  Bad things happen when you don't
> var variables that are meant to stay private to the function and you cache
> your component.
>
> RUss
>
> > -Original Message-
> > From: Rich [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 05, 2008 4:53 PM
> > To: CF-Talk
> > Subject: RE: CFC Best practices question
> >
> > > If I have an object loaded in the Application scope and want to use it
> > in
> > > another object/component ,should I pass it in as a variable or should
> I
> > > call
> > > it directly from the Application scope. Assume that the object will
> > always
> > > be loaded in memory.
> > >
> > > TIA
> > > G
> >
> > I would advise against accessing the component directly.  As a general
> > rule,
> > you should not have any CFC access a scope outside of itself.  I would
> > suggest one of the following two approaches:
> >
> > 1. Use a façade to the application scope
> > By using a façade, only one component is tied directly to the
> application
> > scope.
> >
> > 2. Injection
> > Using either constructor or setter injection, pass the object in as a
> > variable.
> >
> > HTH,
> > Rich Kroll
> >
> >
> >
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300583
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Best practices question

2008-03-05 Thread Matt Williams
On Wed, Mar 5, 2008 at 3:43 PM, Gerald Guido <[EMAIL PROTECTED]> wrote:
> If I have an object loaded in the Application scope and want to use it in
>  another object/component ,should I pass it in as a variable or should I call
>  it directly from the Application scope. Assume that the object will always
>  be loaded in memory.

I vote for passing it in. It makes the component that will use it less
couple to application scope and therefore more reusable.

If several methods within the component are going to need access to
various methods in the application.myCFC object, then it would make
more sense to do what Rich says in step 2. Basically when the
component that is dependent on app.myCFC is instantiated, it should
get that instance in variables scope


  
 
  
  


  





-- 
Matt Williams
"It's the question that drives us."

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300582
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC Best practices question

2008-03-05 Thread Russ
Also don’t forget to var your variables.  Bad things happen when you don't
var variables that are meant to stay private to the function and you cache
your component. 

RUss

> -Original Message-
> From: Rich [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 05, 2008 4:53 PM
> To: CF-Talk
> Subject: RE: CFC Best practices question
> 
> > If I have an object loaded in the Application scope and want to use it
> in
> > another object/component ,should I pass it in as a variable or should I
> > call
> > it directly from the Application scope. Assume that the object will
> always
> > be loaded in memory.
> >
> > TIA
> > G
> 
> I would advise against accessing the component directly.  As a general
> rule,
> you should not have any CFC access a scope outside of itself.  I would
> suggest one of the following two approaches:
> 
> 1. Use a façade to the application scope
> By using a façade, only one component is tied directly to the application
> scope.
> 
> 2. Injection
> Using either constructor or setter injection, pass the object in as a
> variable.
> 
> HTH,
> Rich Kroll
> 
> 
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300580
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CFC Best practices question

2008-03-05 Thread Rich
> If I have an object loaded in the Application scope and want to use it in
> another object/component ,should I pass it in as a variable or should I
> call
> it directly from the Application scope. Assume that the object will always
> be loaded in memory.
> 
> TIA
> G

I would advise against accessing the component directly.  As a general rule,
you should not have any CFC access a scope outside of itself.  I would
suggest one of the following two approaches: 

1. Use a façade to the application scope
By using a façade, only one component is tied directly to the application
scope.

2. Injection
Using either constructor or setter injection, pass the object in as a
variable.

HTH,
Rich Kroll


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300579
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc best practices

2005-03-08 Thread COLLIE David
> Lets say something gets by all my validation and a bad 
> variable makes it to a query in a CFC method. Now I have an 
> error. So I put a try catch around the query to control the 
> errors in the CFC. Since I need the results from the CFC 
> query, I'll get an error on the page calling it because the 
> page didn't receive a query. I got a thrown error message 
> instead. Now I need to check to see if I'm getting an error 
> or a query and use a few more try catches.

Just an opinion this... But that kind of error I don't want to catch...
I'd rather throw it or rethrow it all the way up to my global  handler and get it to email me the
details rather than display a nice message to the user saying the
database insert failed (obv they would still get a nice display tho). 

Would that not be an application error at that point and not a user
error?  That's the way I am doing it the now. There are exceptions to
this rule I imagine but none that I come across in my code.

I just figure if it got past my (paranoid) validation, then I want to
know about the error cos there is a hole in my code!  Obviously
everything is protected against injection attacks and the likes with
cfqueryparam and variable scrubbing...

Not sure if this is best practise but working for me at the moment.
Always open to suggestions tho :)

Cheers

-- 
dc

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197906
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: cfc best practices

2005-03-08 Thread Phill B
Thats what I'm trying to do but I can't get things to work the way I
want them to.

Lets say something gets by all my validation and a bad variable makes
it to a query in a CFC method. Now I have an error. So I put a try
catch around the query to control the errors in the CFC. Since I need
the results from the CFC query, I'll get an error on the page calling
it because the page didn't receive a query. I got a thrown error
message instead. Now I need to check to see if I'm getting an error or
a query and use a few more try catches.

There has to be a better way of handling all this. I downloaded some
apps to see how the best CFers were taking care of these sort of
things and not one of them had a try catch in their code. :-| Perhaps
I'm being a little paranoid with the error handling.



On Tue, 8 Mar 2005 20:33:33 -, COLLIE David
<[EMAIL PROTECTED]> wrote:
> > So what is the best way to handle errors in a CFC?
> 
> Throw it?  That's what I've been doing... Then document what you will
> throw so that any calling code can catch any errors and decide what to
> do.
> 
> Hopefully I'm on track with that one :)
> 
> --
> dc
>

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197901
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: cfc best practices

2005-03-08 Thread COLLIE David
> So what is the best way to handle errors in a CFC? 

Throw it?  That's what I've been doing... Then document what you will
throw so that any calling code can catch any errors and decide what to
do.

Hopefully I'm on track with that one :)

-- 
dc


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197885
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: cfc best practices

2005-03-08 Thread Phill B
Thanks you guys. I have several sites that call to the same CFCs so I
just mapped them for ease of use.

So what is the best way to handle errors in a CFC? 


On Tue, 8 Mar 2005 10:22:53 -0500, Brian Kotek <[EMAIL PROTECTED]> wrote:
> Check out the Macromedia CF coding guidelines and Mach-II development guide.
> 
> http://livedocs.macromedia.com/wtg/public/
> 
> 
> On Tue, 8 Mar 2005 10:09:04 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote:
> > One common method is the domain name methodology.
> >
> > So, for example, if you get Raymond's Blog CFC, it will typically live under
> >
> > :\site\org\camden
> >
> > And be called like so:
> >
> > CreateObject("component","org.camden.Blog") or something like that.
> >
> > However, frameworks may impose their own methodology, which is no worse, and
> > this could be adapted as well.
> >
> > :\site\model\org\camden for MachII
> >
> > And would be called like so:
> >
> > CreateObject("component","model.org.camden.Blog")
> >
> > - Calvin

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197877
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: cfc best practices

2005-03-08 Thread Brian Kotek
Check out the Macromedia CF coding guidelines and Mach-II development guide.

http://livedocs.macromedia.com/wtg/public/



On Tue, 8 Mar 2005 10:09:04 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote:
> One common method is the domain name methodology.
> 
> So, for example, if you get Raymond's Blog CFC, it will typically live under
> 
> :\site\org\camden
> 
> And be called like so:
> 
> CreateObject("component","org.camden.Blog") or something like that.
> 
> However, frameworks may impose their own methodology, which is no worse, and
> this could be adapted as well.
> 
> :\site\model\org\camden for MachII
> 
> And would be called like so:
> 
> CreateObject("component","model.org.camden.Blog")
> 
> - Calvin
> -Original Message-
> From: Phill B [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 08, 2005 9:59 AM
> To: CF-Talk
> Subject: cfc best practices
> 
> Can somebody give me some cfc best practices? I'm new to them and I
> want to get started on the right foot. One thing that is really
> bothering me is how to organize my CFCs and where to put them.
> 
> I've searched the web but I'm still not satisfied with every things I've
> found.
> 
> --
> Phillip B.
> 
> 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197832
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: cfc best practices

2005-03-08 Thread Calvin Ward
One common method is the domain name methodology. 

So, for example, if you get Raymond's Blog CFC, it will typically live under

:\site\org\camden

And be called like so: 

CreateObject("component","org.camden.Blog") or something like that.

However, frameworks may impose their own methodology, which is no worse, and
this could be adapted as well.

:\site\model\org\camden for MachII

And would be called like so:

CreateObject("component","model.org.camden.Blog")

- Calvin
-Original Message-
From: Phill B [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 08, 2005 9:59 AM
To: CF-Talk
Subject: cfc best practices

Can somebody give me some cfc best practices? I'm new to them and I
want to get started on the right foot. One thing that is really
bothering me is how to organize my CFCs and where to put them.

I've searched the web but I'm still not satisfied with every things I've
found. 

-- 
Phillip B.



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197830
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54