![]() | ![]() |
|||||||||||||||||||||||||||||||
|
ASTA Vision
Transactions in ASTA are optimized to keep network traffic to a minimum.
For this reason, ASTA clients do not start a transaction on the client, execute
some sql statements, and then end the transaction. For that you would need many
round trips to and from the server to perform each step. You would also need an
open connection to the server and that would not fit in with the sharing of
resources that allows ASTA servers to scale. A
complete transaction is always sent to the server to be started and ended
entirely on the server side. ASTA was designed so that you need only write SQL
for select statements and any insert, update or delete statements as well as
anything necessary execute those statements under transaction control, is
handled by ASTA. Here
is a step by step walkthrough of how ASTA’s Cached Edit Mode uses transactions 1.
Write a Select Statement and set active to True 2.
Set EditMode to Cached using the EditMode property editor and set the
UpdateTableName and PrimeKey Fields 3.
Connect to an ASTA Server which executes the Select and then allow your
users to append, edit, and delete. They can even disconnect from the server[1]
and continue to append, edit and delete. The original values of the Dataset are
pushed into the internal FoldValuesDataset so that you can call RevertRecord or
CancelUpdates at any time to restore a row to it’s pre-edited state. 4.
Call ApplyUpdates(usmServerTransactions) 5.
The AstaclientDataSet will now either generate SQL if you are using
client side sql, or packup FoldValuesDataSet and a dataset consisting of rows
affected by changes and transport them to the server. If you are using any blobs
or memos then a TastaParamlist containing their data goes to the server also. 6.
A Database Session is obtained depending on which ASTA threading model. 7.
A thread is launched if the server is running threaded. 8.
A call is made to ThreadedDBSupplyQuery to obtain the component that can
start a transaction 9.
A transaction is started 10.
SQL is generated on the server if using server side components and the
TAstaProviders Before/After events are fired. 11.
Each line of SQL is passed to OnExecSQLParamList to be executed. 12.
If any SQL Fails or if all succeed another call is made to
ThreadedDBSupplyQuery to get a Component to Commit or RollBack the transaction 13.
If there were problems, an exception is streamed back to the client,
otherwise the client is notified of a success and the FoldValuesDataSet is
emptied on the client. 14.
Any Fields tagged to be refetched are brought back.
Notice
all the processing takes place on the server which shows how the use of the
middle tier can be leveraged for processing. Multiple
AstaClientDataSets can be sent in one transaction by calling procedure
SendDataSetTransactions(TransactionName:String;
Const DataSets:Array of TDataSet); If
you want to send multiple SQL Statements to an ASTA server use the
TAstaClientDataSet call Function
SendSQLTransaction(TransactionName:String;List:TStrings):Boolean; Where each item in the List has a separate SQL Statement |
||||||||||||||||||||||||||||||||
|
ASTA
in 60 Seconds | Products & Training |
Developer Details | Free
Internet Tools Copyright
© 2000, ASTA Technology
Group. | ||||||||||||||||||||||||||||||||