SQL Server - do I need PHP to run COMMIT?
| From: | Alex Gemmell | Date: | Fri, 16 Dec 2005 12:12:08 +0000 |
| Subject: | SQL Server - do I need PHP to run COMMIT? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-40873@lists.php.net to get a copy of this message | ||
Hello people,
My PHP application uses a SQL Server 2000 database. I have previously only ever used MySQL and so my knowledge of SQL Server comes just from experimentation and trial and error experience.
My PHP application appears to be working fine but I have just discovered that although the database itself is rather small on the disk (about 25MB) the transaction log file is huge (400MB). I have had a quick look at Microsoft's website about large transaction files and they suggest many reasons, one of which is the application not COMMITing transactions. This is certainly true because I simply make INSERT and UPDATE queries but don't include a COMMIT statement.
So my question is this: should I be COMMITing?
How do I do that? Do I simply run something like this after every INSERT/UPDATE/DELETE:
mssql_query('COMMIT', $link_identifier);
Please help - I feel like I'm missing a trick here.
FYI: I'm also now doubting my use of "mssql_pconnect()" - should I being using "mssql_connect()" with "mssql_close()" instead?
Thanks,
Alex