RE: [PHP-DB] Transaction over persistent connection problem

2005-04-27 Thread Oskar

Thanks for your help, Manuel. Your advice saved me hours of searching the
web.

Regards, OKi98

> -Original Message-
> From: Manuel Lemos [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 27, 2005 7:20 PM
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] Transaction over persistent connection problem
>
>
> Yes, it is not possible to achive that. What happens is that first
> access to script is handled by one Web server process or thread and you
> cannot assure that the second access will be handled by the same Web
> process or server to finish the same transaction that was started.
>
> Furthermore, you should never leave a transaction open that you cannot
> guarantee that it will finished in a very short notice, otherwise it may
> block the access to the whole database forever.
>
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



RE: [PHP-DB] Transaction over persistent connection problem

2005-04-27 Thread Oskar
Ok. So the idea of splitting one transaction into two steps of a script is
wrong?

I wanted to use it in a script that is importing big amount of datas (about
200k rows).

First step:
mysql_pconnect()
start transaction
insert rows and test errors
no errors => commit, mysql_close()
some errors => echo("Some errors occured. Do you want to keep 
non-error
entries in database? Yes/No");
Second step:
mysql_pconnect()
Yes => commit
No  => rollback
mysql_close()



> -Original Message-
> From: Manuel Lemos [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 27, 2005 4:21 PM
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] Transaction over persistent connection problem
>
>
> The solution of Metabase (portable database abstraction package) is to
> implicitly register a shutdown function that clean any pending
> transactions:
>
> http://www.phpclasses.org/metabase
>
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



[PHP-DB] Transaction over persistent connection problem

2005-04-27 Thread Oskar
Hello,

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

Example:



  Apply changes?
  
Yes
No
  





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