473,386 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Simultaneous operations inside queries / Time falling between two other times

I'm looking to do something similar to a feature found on
Ticketmaster.com, where you select your seats at a venue, and then you
have two minutes in which to take or leave them.

QUESTION 1a. Inside (or just after) the same query that searches for
available seats, I need to SIMULTANEOUSLY mark those seats as "on
hold".

I've only read about, but not yet used MySQL transactions, and wonder
if this simultaneous "search-and-hold" would/could be done in a
transaction (of multiple queries) or if possible inside just one
query? Either way, how would I do this "search-and-change" of data?
(i.e. changing fields in the rows that are returned by the query.)

QUESTION 1b. So the seats have been put on hold. But by putting seats
on hold, the user may leave them - by either going over their two
minutes, or just navigating away, closing their browser, or even the
browser/computer crashing etc. So I can't set a seat on hold as a
binary yes/no flag, which may never get cleared if the user goes away
abruptly.

I also can't lock a table for two minutes, which is way too long, and
I can't have an automated script scanning all the time through all
tickets to see if they were on hold, but were never taken, and make
them available again.

So I was thinking, place the seats on hold by attaching to them a time
two minutes into the future. During the next two minutes, these "on
hold" seats are passed over by other user's searches because the
current time is still before the "hold-until-time" - but if they never
get purchased, then they become available again after two minutes.

What do people think of this, and what methods have you used in
similar situations?

And so, if the user likes (and then pays for) this set of seats, I can
just go through all the seats and mark them as permanently taken.

QUESTION 2. While I'm here asking time-related questions, how can I
determine in a MySQL query if a certain time falls between two others,
because of the dilemma arising due to the circular nature of times
i.e. any time can occur both inside AND outside of two times. I want
rows to be selected, say when a certain event happens between 9:00 PM
and 6:00 AM, and not sure if something like the following would work
in all cases:

SELECT stuff from table WHERE ($time > start_time) AND ($time <
end_time)

Thanks in advance!

Simon.
Jul 20 '05 #1
0 1769

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Timo | last post by:
I just got a new dual opteron system, with raid 01, 2gb ram, and fedora core linux running 2.4.22-smp kernel. For some reason mysql is running pathetically slow. Queries that should take 2ms...
1
by: slugger | last post by:
Hope this is not OT: I am running into some strange things whenever my ASP pages send out simultaneous requests to another ASP page which in turn gains access to a MySQL database using a DSNless...
0
by: Javier Fernandez | last post by:
We just migrate out p690 from kernel 32 bits to kernel 64 bits in order to migrate DB2 v7 to DB2 v8 FP3. The only problem without a solution we find out is since we did the change we cannot run...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
17
by: Chad Myers | last post by:
I've been perf testing an application of mine and I've noticed that there are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String instances being created. I've done some...
12
by: Dan V. | last post by:
Since an ASP.NET/ADO.NET website is run on the server by a single "asp_net worker process", therefore doesn't that mean that even 50 simultaneous human users of the website would appear to the...
1
by: loosecannon_1 | last post by:
Hello everyone, I am hoping someone can help me with this problem. I will say up front that I am not a SQL Server DBA, I am a developer. I have an application that sends about 25 simultaneous...
2
by: dmagliola | last post by:
Hello all, I'm experiencing a problem with ASP.Net for which I can't find a reasonable explanation, or any information. I'm currently developing an application that, through AJAX, asks the...
4
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.