Transaction over persistent connection problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I would like to create transaction that is commited/rolled back in the next
step of the script.

Example:

	<?
	if (isset($commit)):
		$connection=mysql_pconnect($server);
		mysql_query((($commit) ? "commit" : "rollback"));
		mysql_close($spojeni);
		echo("Done");
	else:
		$connection=mysql_pconnect($server);
		mysql_select_db($database);
		mysql_query("start transaction");
		mysql_query("insert into some_table values ('value1','value2')");
	?>
	<FORM METHOD="post">
	  Apply changes?
	  <SELECT NAME="commit">
	    <OPTION VALUE="1">Yes
	    <OPTION VALUE="0">No
	  </SELECT>
	<BR>
	<INPUT TYPE="submit">
	</FORM>
	<?endif;?>

I don't know why but sometimes the script works sometimes not and then MySQL
processlist is:
	------------
	TRANSACTIONS
	------------
	Trx id counter 0 1647875
	Purge done for trx's n:o < 0 1647364 undo n:o < 0 0
	History list length 5
	Total number of lock structs in row lock hash table 1
	LIST OF TRANSACTIONS FOR EACH SESSION:
	---TRANSACTION 0 0, not started, OS thread id 620
	MySQL thread id 6, query id 23 localhost 127.0.0.1 root
	SHOW INNODB STATUS
	---TRANSACTION 0 1647874, not started, OS thread id 2852
	MySQL thread id 5, query id 12 localhost 127.0.0.1 ODBC
	---TRANSACTION 0 1647873, not started, OS thread id 1152
	MySQL thread id 3, query id 8 localhost 127.0.0.1 ODBC
	---TRANSACTION 0 1647872, ACTIVE 926 sec, OS thread id 440
	2 lock struct(s), heap size 320, undo log entries 1
	MySQL thread id 1, query id 3 localhost 127.0.0.1 ODBC

You see - tables are locked and the only way to fix it is restarting MySQL.

Could you tell me what am I doing wrong, please?

OKi98

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux