Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> LOCK_TABLES i TRUNCATE, czy da sie sprawic by TRUNCATE dzialalo
sobstel
post
Post #1





Grupa: Zarejestrowani
Postów: 853
Pomógł: 25
Dołączył: 27.08.2003
Skąd: Katowice

Ostrzeżenie: (0%)
-----


wykonanie ponizszeg kodu

  1. <?php
  2.  
  3. mysql_query('LOCK TABLES table WRITE');
  4. mysql_query('TRUNCATE TABLE table');
  5. mysql_query('UNLOCK TABLES');
  6.  
  7. ?>


skutkuje wystapieniem nastepujacego bledu :

Fatal error: 1192:Can't execute the given command because you have active locked tables or an active transaction


Czy jest jakis sposob na uzycie TRUNCATE po zablokowaniu tabeli?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
markac
post
Post #2





Grupa: Zarejestrowani
Postów: 83
Pomógł: 0
Dołączył: 23.02.2005

Ostrzeżenie: (10%)
X----


Cytat
TRUNCATE TABLE differs from DELETE FROM ... in the following ways:

Truncate operations drop and re-create the table, which is much faster than deleting rows one by one.
Not transaction-safe; you will get an error if you have an active transaction or an active table lock.
Doesn't return the number of deleted rows.
As long as the table definition file `table_name.frm' is valid, the table can be re-created this way, even if the data or index files have become corrupted.


Mam nadzieję, że to trochę rozjaśniło sytuację (IMG:http://forum.php.pl/style_emoticons/default/cool.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 01:55