DEVSENSE / Phalanger

PHP 5.4 compiler for .NET/Mono frameworks. Predecessor to the opensource PeachPie project (www.peachpie.io).

Home Page:http://v4.php-compiler.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PhpNetMsSql Transactions Bug on Mono/Linux

kripper opened this issue · comments

Using managed extension "PhpNetMsSql"...

$con = mssql_pconnect('<host>,<port>', '<user>', '<pass>');
mssql_select_db('<database>');
mssql_query('BEGIN TRANSACTION');

Throws:

Warning: mssql_query(): Command execution failed: Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.

This happens only on Mono/Linux. On Windows, it's working fine.

Mono doesn't support calling ExecuteReader() for NonQuery commands like "BEGIN TRANSACTION" or "SET ...".
ExecuteNonQuery() must be used instead.

Bug reported to the Mono project:
https://bugzilla.xamarin.com/show_bug.cgi?id=19950

It would be hard to recognize whether ExecuteNonQuery or ExecuteReader has to be used (without parsing the expression which would cost performance), so the only way would be to wait for fix in mono