RE: correction ... [PHP-DB] Time Consuming DB-Transaction
| From: | Jose Moreira | Date: | Mon, 17 Jun 2002 16:40:57 +0000 |
| Subject: | RE: correction ... [PHP-DB] Time Consuming DB-Transaction | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19846@lists.php.net to get a copy of this message | ||
the theory is using javascript, every time u make an operation, must
increment a load bar
must have :
.... a table sort like this on the page where u are processing ...
<table width="600" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td bgcolor="#000066" width="<?=$percent ?>%" height="20"
name="progresso"
id="progresso">
<div align="right"><font color="#FFFFFF">
</font></div>
</td>
<td bgcolor="#0066FF" width="50%"
height="20"> </td>
</tr>
</table>
notice the NAME & ID assigned
.... while not end of CVS file, do the operations and output this :
<script language="JavaScript">
document.all.progresso.width ='<?=$percent + 1 ?>%'
</script>
this will make the bar 'increment'
u must calculate the percent wich is current_operation/Total_operations ,
before the cycle
ex.:
1. read line from CVS
2. insert into db ( or whatever )
3. increment bar
1. read line from CVS
2. insert into db ( or whatever )
3. increment bar
and so on
the thing is that u most know how many lines ( operations ) will occur to
calculate the percentage
-----Mensagem original-----
De: Hannes Wyss [mailto:hwyss@ywesee.com]
Enviada: segunda-feira, 17 de Junho de 2002 9:38
Para: php-db@lists.php.net
Assunto: [PHP-DB] Time Consuming DB-Transaction
Hi list,
I need to provide the facility to upload a large csv-file (>800kb) to my
customer, do some expensive string comparison stuff (cut off empty lines
or superfluous fields - Excel-Generated csv seems to be unpredictable in
some cases; convert some of the fields - '3%' -> 3) and then load the
file or insert each row into a postgres backend.
This takes anywhere between 20 secs and 90 secs at the moment, and the
file is likely to grow in the near future.
How can I provide feedback to the user while keeping the db-transaction
running and providing rollback facilities in case of a failure?
tia.
Hannes
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php