You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm trying using mysql/mariadb,
and test this simple command in demo,
select connection_id()
result always change, if you use mysql client or heidisql etc, connection id is always same until new connection create/broken
if use use this method, (i'm talk about single command not batchsql), whats happen ???
OpenSQL('set autocommit=0');
try
try
if NOT OpenSQL('update stok where qty=1') then //update with no autocommit
raise Exception.Create('error');
if NOT OpenSQL('updateS produk where stokqty=x') then //trying send wrong sql, what happen with previous sql, rollback or commit ?
raise Exception.Create('error');
if NOT OpenSQL('Commit') then
raise Exception.Create('error');
except
if NOT OpenSQL('rollback') then
raise Exception.Create('error');
end;
Connection_id is always different because for every request that you send to server, a new instance of the ServerMethodClass (RESTDWDataModule) will be created to individually process the request. After the request is processed, the instance will automatically be destroyed and released from memory. That behavior is called "Stateless call".
About commit and rollback that will depend on which DAC you're using, if its FireDAC, you will need to handle the SQL Queries through:
BeginTransaction;
do something with query
if true then
Commit
else
Rollback;
Those are transaction controlling commands. On different DACs (Data Access Components) it will have different sintax, but that's the general Idea.
Activity
mobius1qwe commentedon Oct 12, 2022
Connection_id is always different because for every request that you send to server, a new instance of the ServerMethodClass (RESTDWDataModule) will be created to individually process the request. After the request is processed, the instance will automatically be destroyed and released from memory. That behavior is called "Stateless call".
About commit and rollback that will depend on which DAC you're using, if its FireDAC, you will need to handle the SQL Queries through:
Those are transaction controlling commands. On different DACs (Data Access Components) it will have different sintax, but that's the general Idea.