Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 13th, 2006, 04:21 PM
clivew clivew is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 732 clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 19 h 34 m 57 sec
Reputation Power: 12
Every 100th record?

Any suggestions about how to implement capturing every 100th order placed in real time?

My client wants every 100th order to qualify for a reward and the placer to be informed in real time.

As multiple customers could be placing orders over the Internet at the same time, with some transactions as yet uncommitted, I am looking for a good way to make sure that one and only one order is recognized as the 100th.

I also do not want some serial locking logic that could put transactions into a wait loop that causes TCP connections to time out and orders to be rolled back.

I could probably tolerate some flexibility over whether it was exactly 100th. i.e. if it was the 99th. or the 102nd. it might be OK. But ending with 99th. AND 102nd. is definitely NOT OK.

Thanks,
Clive.

Reply With Quote
  #2  
Old September 14th, 2006, 07:20 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,801 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 14 h 25 sec
Reputation Power: 278
I'd say a trigger that after insert checks if the record is 100th and sets some kind of flag, it won't see uncommitted data, but let me say that if a transaction is complete it's also committed and thus you shouldn't have any problem.
Or, couldn't your customer be satisfied with a nightly procedure that goes through the records, finds out the right ones and sends an email aknowledging the prize?

Reply With Quote
  #3  
Old September 14th, 2006, 12:09 PM
clivew clivew is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 732 clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 19 h 34 m 57 sec
Reputation Power: 12
Quote:
Originally Posted by pabloj
Or, couldn't your customer be satisfied with a nightly procedure that goes through the records, finds out the right ones and sends an email aknowledging the prize?

I wish!
My customer (probably correctly ) thinks that the instant gratification is important.
Quote:
I'd say a trigger that after insert checks if the record is 100th and sets some kind of flag, it won't see uncommitted data, but let me say that if a transaction is complete it's also committed and thus you shouldn't have any problem.

I was thinking along similar lines or a one record table with an integer field that is incremented and then checked for ( = 100); but I am not clear on how to both:
a. Lock the record (or table) while doing this.
b. Make sure other transactions wait for the lock to clear (it would only be locked momentarily) rather than return an exception to the caller.

My only real issue is to make sure not more than one order thinks it is the 100th.

Clive.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Every 100th record?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway