I took a quick look and pure java JDBC implementations are able to access the rowcount from an update query, so I guess it must be getting dropped at the CF level.
 
As for how to circumvent this, I think the only way will be to write the query itself in Java.
 
Queries that don't return a result set don't create a query variable, so you probalby won't have much luck there.
 
You might be able to get away with doing something like this which works on my SQL Server installation
 

<cfquery datasource="lawschool" name="myQuery">

UPDATE test

SET test = '5'

WHERE test = '4'

BEGIN

SELECT @@rowcount

END

</cfquery>

<cfdump var="#myquery#">

Spike

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Barry Beattie
Sent: Tuesday, June 15, 2004 5:59 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: returning number of rows affected (updates, deletes)

 

thankyou Spike and Taco

 

I’m researching into what the ESQL (Informix’s version of T-SQL) can actually do with output parameters in returning something like SQL’s @@rowcount

 

>> statement will return the number of rows affected. This gets supressed as an informational message (I don't remember whether that's at the ODBC/JDBC level, or by ColdFusion)

 

if this “dumping the junk” is done at the driver level (ODBC socket and datadirect JDBC) then we’ve probably got no hope.

 

but if it was CF that blocked the return status codes/values/etc, any idea where to start looking within the java classes, looking for a property where it might be (Oh, wouldn’t it be cute to be something like myQuery.rowcount(), eh?)

 

thanx again for your help

barry.b

 

 

 

From: Stephen Milligan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 16 June 2004 10:40 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: returning number of rows affected (updates, deletes)

 

In SQL Server you would normally do this by supressing informational messages using NOCOUNT

 

e.g.

 

<cfquery datasource="#somedsn#' name="qInsertUser">

 

SET NOCOUNT ON

 

INSERT INTO users

(firstname,surname)

VALUES

('bob','cratchitt')

 

SET NOCOUNT OFF

 

SELECT @@IDENTITY AS newID

</cfquery>

 

The problem being that by default the insert statement will return the number of rows affected. This gets supressed as an informational message (I don't remember whether that's at the ODBC/JDBC level, or by ColdFusion) and the rest of the information coming back is assumed to be junk even if it may contain a recordset.

 

If Informix has an equivalent of NOCOUNT then you should be able to do something similar.

 

Spike

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org

 

 

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to