Re: [PHP-DB] Re: MySQL Database Locking - needed?

2001-07-10 Thread Tom Peck

Thanks for the reply Manual.

The updating IS done with one single query - but the problem is that if two 
people are editing the same car, the second update will overwrite the 
first.  Not a huge problem - and the chance of it happening is almost nil - 
but there is still the possibility..  Changing databases seems a little 
extreme - and not possible with our web host.

Tom



At 20:03 10/07/2001 -0300, you wrote:
Hello,

Tom Peck wrote:
 
  Hi
 
  The company I work for has recently developed a Car Dealer type site, which
  acts as a large on-line used car yard.  Currently the MySQL database
  holding the cars is added too / edited / deleted by one person employed for
  the job - but we hope to expand to allow the Dealers themselves admin
  rights to their on-line cars.
 
  I have begun development of a Dealer Admin area - but have a couple of
  questions regarding this:
 
  1)  Would any sort of Table Locking be needed for this -  for example if
  two people were trying to update the same car, at the same time etc etc..

No, if updating is done with a single query.


  2)  If yes, is there any on-line documentation on this?
  3)  What other problems could arise if this was implemented?

It depends on what you really want to do.

Anyway, MySQL has LOCK TABLES but I don't recommend to use them without
proper because you inadvertdly may leave the database locked. The latest
versions also support transactions. It's a bit awkward but it works,
although the recommendation is the same.

Maybe you want to try other databases that handle transactions more
efficiently like Oracle, or PostgreSQL if you can't afford a commercial
database.

If you are not sure about switching to other databases, you may want to
try Metabase which is a database abstraction package that lets you write
portable database applications. That way, you may switch (or not) to
another database later without changing your application code.

Metabase is free and is available here:

http://phpclasses.UpperDesign.com/browse.html/package/20

Manuel Lemos

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: MySQL Database Locking - needed?

2001-07-10 Thread Raquel Rice

Tom Peck wrote:
 
 Thanks for the reply Manual.
 
 The updating IS done with one single query - but the problem is that if two
 people are editing the same car, the second update will overwrite the
 first.  Not a huge problem - and the chance of it happening is almost nil -
 but there is still the possibility..  Changing databases seems a little
 extreme - and not possible with our web host.
 
 Tom

How about writing a text file that would be your lock file, rather
than depending upon MySQL to do it for you?

-- 
Raquel

He who has imagination without learning has wings and no feet.  
  --Anonymous

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: MySQL Database Locking - needed?

2001-07-10 Thread Tom Peck

So what you mean is:

If someone clicks on a car to edit, a txt file is written (maybe called the 
carID.txt).  Then if someone else clicks on that car to edit it, it says 
that it is already being edited by someone else because the txt file 
exists?  So what happens if that person who clicked first closes his 
browser before updating the car?  How can that text file be automatically 
erased?

I think I'll just assume that this wont be a problem, and if someone 
overwrites someone elses edit then too bad.. :-)

Tom


At 16:30 10/07/2001 -0700, you wrote:
Tom Peck wrote:
 
  Thanks for the reply Manual.
 
  The updating IS done with one single query - but the problem is that if two
  people are editing the same car, the second update will overwrite the
  first.  Not a huge problem - and the chance of it happening is almost nil -
  but there is still the possibility..  Changing databases seems a little
  extreme - and not possible with our web host.
 
  Tom

How about writing a text file that would be your lock file, rather
than depending upon MySQL to do it for you?

--
Raquel

He who has imagination without learning has wings and no feet.
   --Anonymous


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]