Subject | Re: [firebird-support] Re: Either update conflict or count slow - Cant implement mail functionality |
---|---|
Author | GOVINDKRISHNA |
Post date | 2004-05-28T10:43:10Z |
Ali,
This looks good.
Thank you very much.
Regards
S. Govindkrishna
JL Infomatrix Limited
------------------Original Message-----------
From : QWxpIEf2a+dlbg== <alig@...>
To : firebird-support@yahoogroups.com
Date : 27/05/2004 9:50:07 PM
Subject : [firebird-support] Re: Either update conflict or count slow - Cant implement mail functionality
Hi,
Try this:
balance table:
RECID USERID countertype counter
1 90 'TOTALNEW' 12
2 90 'TOTALOLD' 1789
3 90 'NEW' 1
4 90 'NEW' 1
5 90 'OLD' 1
6 90 'OLD' 1
7 90 'NEW' 1
(i prefer to use numeric flags instead of string flags)
here is newmail status:
select sum(counter) as TOTAL_NEW from balance where countertype in
('NEW','TOTALNEW') where userid=90
insert new record with id 8 and userid 90 //
commit;
if(success) start to cleaning operation...
select count('NEW') AS NEWRECS where id <=8
update balance set counter=counter+NEWRECS where
countertype='TOTALNEW' and userid=90;
delete from balance where countertype='NEW' and USERID=90 and id<=8
commit;
if(not success) rollback; // dont wory, give a chance for next time
this technique will keep small your balance table without locks.
Note: you can write cleaning procedure to minimize client coding.
Regards.
Ali
This looks good.
Thank you very much.
Regards
S. Govindkrishna
JL Infomatrix Limited
------------------Original Message-----------
From : QWxpIEf2a+dlbg== <alig@...>
To : firebird-support@yahoogroups.com
Date : 27/05/2004 9:50:07 PM
Subject : [firebird-support] Re: Either update conflict or count slow - Cant implement mail functionality
Hi,
Try this:
balance table:
RECID USERID countertype counter
1 90 'TOTALNEW' 12
2 90 'TOTALOLD' 1789
3 90 'NEW' 1
4 90 'NEW' 1
5 90 'OLD' 1
6 90 'OLD' 1
7 90 'NEW' 1
(i prefer to use numeric flags instead of string flags)
here is newmail status:
select sum(counter) as TOTAL_NEW from balance where countertype in
('NEW','TOTALNEW') where userid=90
insert new record with id 8 and userid 90 //
commit;
if(success) start to cleaning operation...
select count('NEW') AS NEWRECS where id <=8
update balance set counter=counter+NEWRECS where
countertype='TOTALNEW' and userid=90;
delete from balance where countertype='NEW' and USERID=90 and id<=8
commit;
if(not success) rollback; // dont wory, give a chance for next time
this technique will keep small your balance table without locks.
Note: you can write cleaning procedure to minimize client coding.
Regards.
Ali
>>> This mail is created in Hamsa (www.jlmatrix.com) <<<