update_recordset custTable setting email = '' where
custTable.custGroup == 'Trade';
custTable.rowCount();
Does the trick
mku wrote:
"sy"I assume the amount of rows affected is needed as a important input to
07-Aug-07
"sy
I assume the amount of rows affected is needed as a important input to other
processing, not just as message to the user
You can
1) convert your update_recordset and insert_recordset into
// replace
// update_recordset custTable setting email = '' where
custTable.custGroup == 'Trade'
CustTable custTable
Statement stmt
str updateStmt
int rowsAffected
CustTable.company(curExt()); //to detect the virtual compan
stmt = new UserConnection().createStatement()
updateStmt = strFmt("update %1 set %2 = %3 where %1.%4 = '%5' and %1.%6
= %7
, new DictTable(tableNum(CustTable)).name(DbBackend::Sql
, new
DictField(tableNum(CustTable),fieldNum(CustTable,Email)).name(DbBackend::Sql
, "''
, new
DictField(tableNum(CustTable),fieldNum(CustTable,DataAreaId)).name(DbBackend::Sql
, CustTable.dataAreaI
, new
DictField(tableNum(CustTable),fieldNum(CustTable,CustGroup)).name(DbBackend::Sql
, "'Trade'
)
rowsAffected = stmt.executeUpdate(updateStmt)
if you are on 4.0 you would need to also deal with
SqlStatementExecutePermissio
2) You may try to programatically switch on the SQLTrace for the moment you
do your operations, then try to find the trace record for your update and
use the field RowsAffected. There is no direct link so you will have to
check the date,time range and SPID, and even then you will not be able to
get 100% sure answer
3) In 3.0 it was possible to do SystemMonitor::sqlDump() and get the
container with all currently running queries. If you dig there you may
locate the info about SQLquery for update_recordset and get the
RowsAffected. Same assumptions as point 2 apply
Regard
-
Michal Kupczy
mku
Previous Posts In This Thread:
On Tuesday, August 07, 2007 6:22 AM
s wrote:
update/insert count in update_recordset or insert_recordset
Hi
I am working with a large amount of data and am using bulk (array)
insert/updates to speeden up the operations. I would however like to know the
count of the impacted rows. I want to avoid quering the tables to find the
count. Any suggestions will be appreciated
eg
update_recordset a where <condition>
info I need -> yyyy rows update
insert_recordset
select b where <condition
info I need -> nnnn rows inserted
On Tuesday, August 07, 2007 8:20 AM
kashperuk(at)mail(dot)ru(nospam) wrote:
I think the only option here is making a select count(RecId) from table where
I think the only option here is making a select count(RecId) from table where
<conditions
where the <conditions> match the ones in the update_recordse
Which is what you wrote - quering the tables before insert/update
Otherwise, it won't be possible.
--
Kashperuk Ivan (Vanya),
Dynamics AX MCBMS
My blog - http://kashperuk.blogspot.co
MorphX IT in Russian - http://www.lulu.com/content/72388
"sy" wrote:
On Tuesday, August 07, 2007 12:54 PM
mku wrote:
"sy"I assume the amount of rows affected is needed as a important input to
"sy
I assume the amount of rows affected is needed as a important input to other
processing, not just as message to the user
You can
1) convert your update_recordset and insert_recordset into
// replace
// update_recordset custTable setting email = '' where
custTable.custGroup == 'Trade'
CustTable custTable
Statement stmt
str updateStmt
int rowsAffected
CustTable.company(curExt()); //to detect the virtual compan
stmt = new UserConnection().createStatement()
updateStmt = strFmt("update %1 set %2 = %3 where %1.%4 = '%5' and %1.%6
= %7
, new DictTable(tableNum(CustTable)).name(DbBackend::Sql
, new
DictField(tableNum(CustTable),fieldNum(CustTable,Email)).name(DbBackend::Sql
, "''"
, new
DictField(tableNum(CustTable),fieldNum(CustTable,DataAreaId)).name(DbBackend::Sql)
, CustTable.dataAreaId
, new
DictField(tableNum(CustTable),fieldNum(CustTable,CustGroup)).name(DbBackend::Sql)
, "'Trade'"
);
rowsAffected = stmt.executeUpdate(updateStmt);
if you are on 4.0 you would need to also deal with
SqlStatementExecutePermission
2) You may try to programatically switch on the SQLTrace for the moment you
do your operations, then try to find the trace record for your update and
use the field RowsAffected. There is no direct link so you will have to
check the date,time range and SPID, and even then you will not be able to
get 100% sure answer.
3) In 3.0 it was possible to do SystemMonitor::sqlDump() and get the
container with all currently running queries. If you dig there you may
locate the info about SQLquery for update_recordset and get the
RowsAffected. Same assumptions as point 2 apply.
Regards
--
Michal Kupczyk
mku
Submitted via EggHeadCafe - Software Developer Portal of Choice
DataContractSerializer Basics
http://www.eggheadcafe.com/tutorials/aspnet/ad947ce6-cd3e-4647-b69c-94d2f3b1b265/datacontractserializer-ba.aspx