Re: Table locking
| From: | Rosen | Date: | Sat, 10 Jul 2004 22:44:37 +0000 |
| Subject: | Re: Table locking | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35188@lists.php.net to get a copy of this message | ||
I have an orders with one main record in table1 ( client, date, e.t.c. ) and
detail description in table2 ( all materials with quant, price, e.t.c. )
and I save data in table1 for positions (range of id - autoinc field of
records in table2) for detailed data of order . And I don't want someone
else to insert data in table2, because will be a problem with orders.
Now I insert data first in table2 and then insert main record in table1 with
the range of id's of detail order data.
Could be some solution for this ?
Thanks in advance.
Rosen
"John W. Holmes" <holmes072000@charter.net> wrote in message
news:40F01718.5090100@charter.net...
> Rosen wrote:
> > I need to be sure, thath nobody else will can write on some tables until
I
> > don't append obout 4-500 records in these tables.
> > But until now I never used table locking in MySQL and I didn't found
> > information about this ( like examples ).
>
> You could try a multi insert syntax such as
>
> INSERT INTO yourtable (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);
>
> which will insert three rows into the table. Couldn't confirm in the
> manual, but this INSERT should run completely before anything else does.
>
> I still have to question _why_ another INSERT in the middle of your
> insertion will mess things up. Sounds like the problem is there.
>
> > Is there a problem with locking if PHP uses same user&pass for all users
in
> > database ?
>
> No. The LOCK is on a per connection basis and is not tied to the
> username and/or password.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals www.phparch.com