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 t

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 n

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 uncou

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 n

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 importan

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 ( , ,

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: C

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 softwa

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 J

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

RE: CFC Best Practices

2008-08-19 Thread Craig Dudley
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 yo

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

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

RE: CFC Best Practices

2008-08-19 Thread Craig Dudley
as 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 t

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, ag

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 an

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

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

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 t

CFC Best Practices

2008-08-19 Thread Scott Stewart
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 c

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... noth

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 adolescen

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

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

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 'be

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

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 hav

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

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

Re: CFC Best practices question

2008-03-05 Thread Gerald Guido
gs 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

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

RE: CFC Best practices question

2008-03-05 Thread Russ
> 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

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 acces

CFC Best practices question

2008-03-05 Thread Gerald Guido
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 -- "As an adolescent I aspired to lasting f

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 becau

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 resu

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

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 develo

Re: cfc best practices

2005-03-08 Thread Brian Kotek
orse, 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 PRO

RE: cfc best practices

2005-03-08 Thread Calvin Ward
: 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

cfc best practices

2005-03-08 Thread Phill B
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 fo

CFUN-04 interviews 3 - CFC Best Practices, Tips and Ticks with Ray Camden

2004-03-22 Thread Michael Smith
In the third part of our CFUN-04 interview series, Michael Smith interviews Raymond Camden, co-founder of the CFLib.org amd CFCzone.org sites, who will be presenting on CFCs at CFUN-04. Michael Smith: Ray, I am intrigued about your "CFC Best Practices, Tips and Tricks" talk at CF