Phalanger icon indicating copy to clipboard operation
Phalanger copied to clipboard

PhpNetMsSql Transactions Bug on Mono/Linux

Open kripper opened this issue 10 years ago • 3 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.

kripper avatar May 20 '14 23:05 kripper

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

kripper avatar May 21 '14 00:05 kripper

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

jakubmisek avatar May 21 '14 16:05 jakubmisek

I agree.

kripper avatar May 21 '14 16:05 kripper