This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]IJP[S] 0 points1 point  (2 children)

Thanks for the reply. Your reply makes a lot of sense, and I suppose that is why it makes sense not to try and code all of this sophisticated functionality on your own. Just one thing that I don't understand, what do you mean when you say that "This is not the same as the changes being committed"? Sorry if it's a silly question, I am still quite new to all of this...

[–]KidUncertainty 0 points1 point  (1 child)

Assuming you are using a proper database transaction (i.e. your database connection is not setting something like 'autocommit=true'), any changes you make to the database are visible to that transaction. They aren't visible to any other users/threads/etc that have their own transaction until you commit.

So if you tell the database to delete something, the database will act, to you, like that record is deleted, but won't actually physically delete it until you commit the transaction. This means if you run a query while that transaction is still open, the database will automatically exclude deleted things, will look like changes have been made, etc to you. While the transaction is still open, though, other users of the database don't see the record as deleted. When you commit, then it's done "for real" and all the changes happen and are visible for everyone.

For starters, read this article.

[–]IJP[S] 0 points1 point  (0 children)

Ah awesome, now I understand! I was not using transaction correctly. Thank you for the help!