Edit report at https://bugs.php.net/bug.php?id=58600&edit=1

 ID:                 58600
 Updated by:         ssuffic...@php.net
 Reported by:        sigurdne at online dot no
 Summary:            Support for transactions -mssql
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            PDO_DBLIB
+Package:            *General Issues
 Operating System:   Ubuntu 8.10
 PHP Version:        5.2.6
-Assigned To:        
+Assigned To:        ssufficool
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

Try 5.4 RC2


Previous Comments:
------------------------------------------------------------------------
[2009-03-30 02:26:16] sigurdne at online dot no

By looking at the pdo_mysql - it looks like something like this could work.
However there seems to be a problem that the transaction state is not reported 
correctly - so when it comes to the commit - it claims that it is not in a 
transaction.

Anyone that could help out?

diff -aburN --exclude='.svn*' --exclude='CVS*' PDO_DBLIB-1.0.org/dblib_driver.c 
PDO_DBLIB-1.0/dblib_driver.c
--- PDO_DBLIB-1.0.org/dblib_driver.c    2005-10-16 16:58:50.000000000 +0200
+++ PDO_DBLIB-1.0/dblib_driver.c        2009-03-27 13:10:14.000000000 +0100
@@ -166,14 +166,30 @@
        return 1;
 }
 
+static int dblib_handle_begin(pdo_dbh_t *dbh TSRMLS_DC)
+{
+       return 0 <= dblib_handle_doer(dbh, ZEND_STRL("BEGIN TRAN") TSRMLS_CC);
+}
+
+static int dblib_handle_commit(pdo_dbh_t *dbh TSRMLS_DC)
+{
+       return 0 <= dblib_handle_doer(dbh, ZEND_STRL("COMMIT TRAN") TSRMLS_CC);
+}
+
+static int dblib_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
+{
+       return 0 <= dblib_handle_doer(dbh, ZEND_STRL("ROLLBACK TRAN") 
TSRMLS_CC);
+}
+
+
 static struct pdo_dbh_methods dblib_methods = {
        dblib_handle_closer,
        dblib_handle_preparer,
        dblib_handle_doer,
        dblib_handle_quoter,
-       NULL,
-       NULL,
-       NULL,
+       dblib_handle_begin,
+       dblib_handle_commit,
+       dblib_handle_rollback,
        NULL,
        NULL, /* last insert */
        dblib_fetch_error, /* fetch error */

------------------------------------------------------------------------
[2009-03-27 04:57:32] sigurdne at online dot no

Description:
------------
Would be nice to support transactions for mssql.

Tried both the precompiled ubuntu packages and custom built from pecl with the 
same result:

'This driver doesn't support transactions'

Cutom built:
versions:
* PDO-1.0.3
* PDO_DBLIB-1.0
* FreeTDS 0.82

To allow configure to work:
 $ touch /usr/include/tds.h
 $ touch /usr/lib/libtds.a

configure:
 $ ./configure --with-mssql


Reproduce code:
---------------
$this->db = new PDO("dblib:host={$this->Host};dbname={$this->Database}", 
$this->User, $this->Password, array(PDO::ATTR_PERSISTENT => $persistent));

$this->db->beginTransaction();

Actual result:
--------------
Error message: 'This driver doesn't support transactions'


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=58600&edit=1

Reply via email to