Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Sep 21, 2018 5:03 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Thu Oct 20, 2005 10:03 am 
Offline

Joined: Fri Sep 30, 2005 8:28 am
Posts: 34
Location: Dunfermline, UK
Will Leshner wrote:
imij wrote:
By default SQLite (and most other reasonable databases) will automatically wrap a transaction around each sql statement that updates the database, whether that be an insert, update, delete or whatever.


That is the default for SQLite, but not for the REAL SQL Database. The REAL SQL Database detects that you are not in a transaction and opens one for you whenever you do something that will write to the database. So if you don't explicitly do a "BEGIN" before a bunch of INSERTs, the REAL SQL Database issues the BEGIN for you.


Ah, that's cool, I like that.

So, the obvious question then is: What happens if you don't "commit" before closing the REAL SQL Database, will it rollback any updates, even f you didn't do an explicit begin?

_________________
Ian M. Jones
IMiJ Ltd
http://www.imij.co.uk
http://www.ianmjones.com
http://twitter.com/ianmjones


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 20, 2005 10:47 am 
Offline

Joined: Fri Sep 30, 2005 9:31 am
Posts: 28
imij wrote:
So, the obvious question then is: What happens if you don't "commit" before closing the REAL SQL Database, will it rollback any updates, even f you didn't do an explicit begin?


No, it will commit the updates.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 20, 2005 2:01 pm 
Offline

Joined: Fri Sep 30, 2005 8:28 am
Posts: 34
Location: Dunfermline, UK
Will Leshner wrote:
imij wrote:
So, the obvious question then is: What happens if you don't "commit" before closing the REAL SQL Database, will it rollback any updates, even f you didn't do an explicit begin?


No, it will commit the updates.


Hmm, what if you start the transaction yourself, will it rollback then?

_________________
Ian M. Jones
IMiJ Ltd
http://www.imij.co.uk
http://www.ianmjones.com
http://twitter.com/ianmjones


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 20, 2005 7:53 pm 
Offline

Joined: Fri Sep 30, 2005 9:31 am
Posts: 28
imij wrote:
Hmm, what if you start the transaction yourself, will it rollback then?


In that case, you get SQLite's default behavior, which is to rollback.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 20, 2005 7:56 pm 
Offline

Joined: Fri Sep 30, 2005 9:31 am
Posts: 28
Will Leshner wrote:
imij wrote:
Hmm, what if you start the transaction yourself, will it rollback then?


In that case, you get SQLite's default behavior, which is to rollback.


Nope. I lied. The REAL SQL Database can't distinguish between your calling BEGIN explicitly and it having called it implicitly. So, either way, you get a commit if the database closes without your committing explicitly. Now, if the app were to crash before the database closes cleanly, then you would get a rollback the next time the application starts up.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 21, 2005 2:22 am 
Offline

Joined: Fri Sep 30, 2005 8:28 am
Posts: 34
Location: Dunfermline, UK
Will Leshner wrote:
The REAL SQL Database can't distinguish between your calling BEGIN explicitly and it having called it implicitly. So, either way, you get a commit if the database closes without your committing explicitly. Now, if the app were to crash before the database closes cleanly, then you would get a rollback the next time the application starts up.


Good stuff, that's what I was looking for, if the app crashes/gets killed then I want changes to rollback as other data in my app won't be committed either (prefs etc).

Thanks for all the info Will, very valuable and much appreciated.

_________________
Ian M. Jones
IMiJ Ltd
http://www.imij.co.uk
http://www.ianmjones.com
http://twitter.com/ianmjones


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group