Of course if you're using at least sql server you can do something like this
<cfquery name="updateInsert" datasource="#dataname#">
If not exists (select * from sometable where somefield=somevalue)
Begin
Insert into sometable (fields) values (values)
End
Else
Begin
Update sometable set someotherfield=someothervalue where
somefield=somevalue
End
</cfquery>
Russ
> -----Original Message-----
> From: Christopher Jordan [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 19, 2007 11:35 AM
> To: CF-Talk
> Subject: Re: CFML IDE's
>
> What Neil is talking about are code snippets (I think. I don't know
> about this right-clicking business, but I'm using version 5.5).
>
> Both Eclipse and Homesite support code snippets. For example, I've got a
> snippet for aborting. I have a certain procedure that runs at the end of
> each page request. This goes, obviously, in the OnRequestEnd.cfm
> template. But when I abort this template doesn't run. Code snippets to
> the rescue!
>
> I type abort and press ctrl+j and I'm given the following:
>
> <CFInclude Template="/Include/OnRequestEnd.cfm">
> <CFAbort>
>
> It's pretty cool. CFEclipse has included a few like ctrl+shift+d but I
> prefer to type the word dump followed by ctrl+j. I remapped Eclipse's
> snippet key combo from ctrl+z(?) to ctrl+j so that I could keep my
> homesite feel that I'm used to.
>
> The above example was a simple one, but I've also got a snippet for
> checking for the existence of a record in the database prior to doing an
> update. I type check followed by ctrl+j and I get:
>
> <CFQuery name="check" datasource="#DataName#">
> SELECT * FROM WHERE
> </CFQuery>
> <CFIf check.recordcount>
> <CFQuery name="update" datasource="#DataName#">
> UPDATE SET
>
> WHERE
> </CFQuery>
> <CFElse>
> <CFQuery name="insert" datasource="#DataName#">
> INSERT INTO ()
> VALUES ()
> </CFQuery>
> </CFIf>
>
> Now I just go up and fill in the blanks. It really quite slick. I also
> like that Homesite has help in-built *that can be used off-line*. I know
> that CFEclipse has help, but I have to be connected to the internet (not
> usually a problem), but I've also rarely seen it work properly, and even
> then it's slow (imo).
>
> Cheers,
> Chris
>
> Teddy Payne wrote:
> > In CFEclipse, Ctrl-Shift D creates: <cfdump var="##"> and puts teh
> cursor
> > right into the middle of the two pound symbols.
> >
> > Teddy
> >
> >
> > On 1/19/07, Robertson-Ravo, Neil (RX) <Neil.Robertson-
> [EMAIL PROTECTED]>
> > wrote:
> >
> >> Ah, it is in mine but the difference is that in homesite you just have
> to
> >> type say "<cfdump " and then right click on it and you get the edit box
> >> whereas in CFE you actually have to type the full tag, attributes and
> all
> >> before you can edit it. You would be surprised how useful that feature
> in
> >> HS is!
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: Jacob Munson [mailto:[EMAIL PROTECTED]
> >> Sent: 19 January 2007 14:36
> >> To: CF-Talk
> >> Subject: Re: CFML IDE's
> >>
> >>
> >>> If it is in the version I am using..where is it?!
> >>>
> >> I've got the latest beta, and you can right click a tag in the editor
> >> and click Edit this tag. Personally I never use it, I find it faster
> >> to just type stuff in and take advantage of the tag insight. But it's
> >> there for those that like it.
> >>
> >>
> >> --
> >>
> >>
> >>
> >>
> >>
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267012
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4