<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 11/04/2015 03:53, Xiangrong Fang a
écrit :<br>
<br>
The transaction process depends upon the DBMS used. In a general
way, all DBMS execute SQL statement under the control of a
transaction. Some of the DBMS (MS SQL Server) use to have
"automatic" transaction control as default and some others
(Firebird) need explicit Start and Commits. Using Oracle
definition a transaction "is a logical, atomic unit of work that
contains one or more SQL statements". I'm used to always work with
fine tuned transaction control. This way I know what the DBMS is
doing with data.<br>
</div>
<blockquote
cite="mid:CAP93jB0O-Yf7SGkNwB=HXBwEgDvw8+6MsHWK=h85LKe5ZFQCjw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default"
style="font-family:monospace,monospace"><br>
<div class="gmail_default">1. How to control the use of
transactions in SQLDB? Sometime I do NOT want transaction,
but want the DDL/DML statement to be executed immediately.
Why sometime SQLDB's ExecSQL won't take effect if not
followed by a Commit? BTW, I tried to set tr.Active to
true/false before execute the sql, but it seems not making a
difference?</div>
<div class="gmail_default"><br>
</div>
</div>
</div>
</blockquote>
Michael's comments do not need further explanation<br>
<br>
If you want an Sql statement be executed immediately attach an
TSqlTransaction to a DB component, attach the TSqlQuery to the
transaction and enclose it between a StartTransaction and a Commit.<br>
<br>
TR.StartTransaction;<br>
qr.ExecSql;<br>
TR.Commit;<br>
<br>
The Commit matters as well<br>
<br>
Working with DBMS since a long time, I always use the same rules:
Start a transaction, do whatever Sql statements have to be done all
together, Commit the transaction. This way I control how data is
goes to and from the databsase.
<blockquote
cite="mid:CAP93jB0O-Yf7SGkNwB=HXBwEgDvw8+6MsHWK=h85LKe5ZFQCjw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default"
style="font-family:monospace,monospace">
<div class="gmail_default">Xiangrong</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<br>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="http://www.avast.com/">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
<br><a href="http://www.avast.com/">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br />
</body>
</html>