freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Niklas Lampén <Niklas.Lampen AT eventusmedia.fi>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] transactions using freetds and php
- Date: Mon, 28 Jun 2010 09:10:57 +0300
> -----Original Message-----
> From: freetds-bounces AT lists.ibiblio.org [mailto:freetds-
> bounces AT lists.ibiblio.org] On Behalf Of Ben Vogan
> Sent: 24. kesäkuuta 2010 19:58
> To: freetds AT lists.ibiblio.org
> Subject: [freetds] transactions using freetds and php
>
>
> Hi all,
> This might be more of a PHP question that freetds but I thought I would
> try my luck here. I was wondering what the proper way to use
> transactions from PHP talking to SQL Server 2008. I tried:
> mssql_query('BEGIN TRANSACTION');try { loop { //multiple inserts here
> } mssql_query('COMMIT TRANSACTION');} catch (Exception $ex) {
> mssql_query('ROLLBACK TRANSACTION');}
> However I get errors that there was no begin transaction. Is this
> pattern possible in PHP or do I have to concatenate all my sql into one
> query (which would be very unfortunate)?
> Thanks for your help,--Ben
You might want to try give your transaction a name:
mssql_query("{BEGIN|COMMIT|ROLLBACK} TRANSACTION MyTransAction");
And make sure that transaction begins and ends with the very same connection.
Niklas
-
[freetds] transactions using freetds and php,
Ben Vogan, 06/24/2010
- Re: [freetds] transactions using freetds and php, Niklas Lampén, 06/28/2010
Archive powered by MHonArc 2.6.24.