.comment-link {margin-left:.6em;}

Wednesday, February 22, 2006

 

I Already Have MARS in SQL 2000


Can we really have Mars in SQL 2000 ? The answer is yes to some limit

pIDBCreateCommand->CreateCommand(NULL, IID_ICommandText, (IUnknown**)
&pICommandText);
pIDBCreateCommand->CreateCommand(NULL, IID_ICommandText, (IUnknown**)
&pICommandText2);
pICommandText->SetCommandText(DBGUID_DBSQL,
OLESTR("select operation_id, operation_code, product_id, quantity
from dbo.operations where processed=0"));
pICommandText2->SetCommandText(DBGUID_DBSQL,OLESTR("update dbo.operations
set processed=1 where operation_id=?"));
//Execute the command
pICommandText->Execute(NULL, IID_IRowset, NULL, &cRowsAffected, (IUnknown**)
&pIRowset);
..
ProcessOperation();
..
//Execute the command 2
pICommandText2->Execute(NULL, IID_IRowset, NULL, &cRowsAffected, NULL);

What does SQLOLEDB does in the background ? It opens a new connection . What
? Yes you heard me . It opens a new connection and execute command2

Some Scenarios :
1- what happens if command1 was in a DTC TX ?
in this case SQLOLEDB cannot open a new connection and command2
fails
2-Command1 in a TSQL TX not a DTC TX ?
SQLOLEDB has no idea that command1 is in a TX and it will open a new
one, ending in two command living in different TX.
3- think about more scenarios like locking (2 commands lock each other )
There are a lot of more scenarios to be covered but no time

Any way , again the answer of the question is YES of course we do support
MARS in SQL 2000 behind the scene


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?