That should work, although it dosen't 'feel' particularly nice. What about creating a function that generates the correct SQL for returning the record count. Your queries would look like this:

<cfquery name="blah" datasource="#application.dsn#">
update users.........
#WriteUpdateCountSQL(application.DSNFlavour)#
</cfquery>

In application.cfm you set up the datasource and also set application.DSNFlavour ="Oracle" or "MSSQL"

Your UDF then looks at the type and prints out the correct bit of server-specific SQL code to generate the count you're after

This would at least move the database specific code into just 2 places.

Barny

----- Original Message ----- From: "Xavi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 18, 2004 5:01 PM
Subject: Re: [CFCDev] [off-topic] Number of registers deleted, inserted, updated



I guess the solution is connect and querying through Java and later capture the result of executeUpdate().


On Thu, 18 Nov 2004 16:56:05 -0000, Barnaby Relph <[EMAIL PROTECTED]> wrote:
I think you might have a problem doing this without using one of the
suggestions already offered. I've just had a quick scan through
java.sql.ResultSet and it dosen't define how many rows were updated. If you
call Statement.executeUpdate() then it will return a count, but I don't
think that CF does this. My suspicion is that CF always uses executeQuery or
something like it for all operations.


Barny



----- Original Message -----
From: "Xavi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 18, 2004 4:27 PM
Subject: Re: [CFCDev] [off-topic] Number of registers deleted, inserted,
updated

I dont want to use triggers pl/sql neither. The previous solution is for
pl/sql:

declare
  rows_affected number;
begin
  update [any table]
  set ...
  where... ;
  rows_affected := sql%rowcount;
  dbms_output.put_line('Rows '||to_char(rows_affected));
end;
/
(Remember to "set serveroutput on" in SQL*Plus first.)

I need a more easy solution... (cf solution w/ java)

On Thu, 18 Nov 2004 14:21:39 -0200, Marcos Placoná
<[EMAIL PROTECTED]> wrote:
> Can't you use triggers?
>
> Regards,
>
> Marcos Placoná
> Desenvolvedor - NAVITA
> Fone: 55 11 3055-2001
> Celular: 55 11 9560-3260
> http://www.navita.com.br
>
> ------------- Segue mensagem original! -------------
>
> De: Bill Rawlinson <[EMAIL PROTECTED]>
> Data: Thu, 18 Nov 2004 09:38:52 -0500
> Para: [EMAIL PROTECTED]
> Assunto: Re: [CFCDev] [off-topic] Number of registers deleted, inserted,
> updated
>
>
>
> i don't know, but I will ask a guy who will and get back to you shortly.
>
> On Thu, 18 Nov 2004 15:33:50 +0100, Xavi <[EMAIL PROTECTED]> wrote:
> > Im using Oracle 8. Is there a CF solution? or only DB one.
> >
> > On Thu, 18 Nov 2004 09:29:11 -0500, Bill Rawlinson
> >
> >
> > <[EMAIL PROTECTED]> wrote:
> > > If your using MS SQL server there is an easier way to get the number
> > > of rows effected by an update and delete.
> > >
> > > <cfquery name="users" datasource="#request.dsn#">
> > > SET NOCOUNT ON
> > >
> > > UPDATE user SET role = <cfqueryparam cfsqltype="cf_sql_varchar"
> > > value="newrole">
> > > WHERE role = <cfqueryparam cfsqltype="cf_sql_varchar" > > > value="oldrole">
> > >
> > > select @@ROWCOUNT as numberModified from USER
> > >
> > > SET NOCOUNT OFF
> > >
> > > </cfquery>
> > >
> > > if deleting just replace the update statement with the delete
> > > statement but leave the other things alone..
> > >
> > > you could then reference this number as users.numberModified
> > >
> > > --
> > > Bill
> > > http://blog.rawlinson.us
> > >
> > >
> > > ----------------------------------------------------------
> > > You are subscribed to cfcdev. To unsubscribe, send an email
> > > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> > > in the message of the email.
> > >
> > > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > > by Mindtool, Corporation (www.mindtool.com).
> > >
> > > An archive of the CFCDev list is available at
> > > [EMAIL PROTECTED]
> > >
> >
> > --
> > Xavi (http://xavicl.blogspot.com)
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
> >
> > An archive of the CFCDev list is available at
> > [EMAIL PROTECTED]
> >
>
> --
> Bill
> http://blog.rawlinson.us
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at
> [EMAIL PROTECTED]
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at
> [EMAIL PROTECTED]
>


--
Xavi (http://xavicl.blogspot.com)
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at [EMAIL PROTECTED]



--
Xavi (http://xavicl.blogspot.com)
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at [EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at [EMAIL PROTECTED]

Reply via email to