?
Solved

What is the difference between post and commit?

Posted on 1998-07-23
9
Medium Priority
?
869 Views
Last Modified: 2010-08-05
Which situation do you use post or commit? Does post have autocommit itself?
0
Comment
Question by:ceds98
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1358486
Hoi ceds98.

I dunno either. But I can guess:
I think commit is used 4 client/server-databases (multiple layer models) working with transactions. In this case u work on a local protocol of changes which r submitted when u commit'em.
On local databases, u use post 2 write back your changes.
Sumthing like that.

Hey guys - could this b correct?

I continue searching 4 more information. If I've got some, I'll post'em.
0
 
LVL 3

Expert Comment

by:vladika
ID: 1358487
Post and Commit are different things.

Post writes changes to the current record to the database.
Commit makes database changes permanent.

From help ...
By default, Delphi provides implicit transaction control for your applications through
the Borland Database Engine (BDE). When an application is under implicit transaction
control, Delphi uses a separate transaction for each record in a dataset
that is written to the underlying database.
It commits each individual write operation, such as Post and AppendRecord.

If you want work with explicit transaction control
you may use TDatabase component and its method
StartTransaction, Commit, Rollback.

Difference on example:
Implicit transaction:
  Table1.Post;
for this operation Delphi uses separate transaction
i.e
  Database.StartTransaction;  // Implicit
  try
    Table1.Post; // your operation
    Database.Commit; // implicit  make database changes permanent
  except
    Database.Rollback; // rollback database changes(Table1.Post) implicit
    raise;
  end;

Explisit transaction:
you write
  Database1.StartTransaction;
  try
    ....
    Table1.Post;
    ....
    Query1.Post;
    .....
    /// many many database changes
    Database1.Commit;  // make ALL changes from StartTransaction permanent
  except
    Database1.Rollback;  // rollback ALL changes from StartTransaction
    raise;
  end;

0
 
LVL 3

Expert Comment

by:vladika
ID: 1358488
You can use Transaction not only for client-server databases.
BDE allow use Transaction for DBase, Paradox etc
(But there is restriction for this databases on number of rows in transaction)

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:Matvey
ID: 1358489
My english is not very good. Does transaction means cached updates? Things like commit and rallback are used with cached updates...
0
 
LVL 3

Expert Comment

by:rickpet
ID: 1358490
Transaction and cached updates are 2 different things...

Look at a transaction as a try except block on the server side...you are basically telling the server or in the case of local database the engine...to protect a block of records...

If everything goes as planned we commit the records...should anything go wrong after we start the Transaction roll all records since we started a transaction back...

In cached updates(everything is client side)...we are keeping all changes local until we apply the updates or discard them they stay local...though we could implement a form of transaction scope on the client side...we still most likely still want to protect our apply updates in a transaction in case anything goes wrong...

Rick
0
 
LVL 1

Expert Comment

by:bozo7
ID: 1358491
The difference between commit and post is:
 1: Post notifies server that a record has been changed.
 2: Commit makes the change permanent.
Your code would look like:
 database1.starttransaction;
 table1.append;
 table1.fieldbyname('field1').asstring := 'Hello World';
 (other fields changed)
 table1.post; //Sends change to server but not committed
 database1.commit;
Now commit is only necessary when you use a database component and transactions.
Commit has nothing to do with cached updates.
Commit is on the server side not the client side.
Bozo
0
 
LVL 3

Expert Comment

by:rickpet
ID: 1358492
Don't we just love new people...=)-~

I guess they don't read the comments...

Rick
0
 

Author Comment

by:ceds98
ID: 1358493
To vladika
Thank you very much.
0
 
LVL 3

Accepted Solution

by:
vladika earned 80 total points
ID: 1358494
Hello ceds98,

According to your letter

> Hello vladika,

> I'd like to assign my points in Q.10066332 (What difference between
> post & commit?) to you.  But I don't know how.  
>
> Regards,
> ceds98

I post my "official" answer (see below/above)

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question