GSAK (Geocaching Swiss Army Knife)
 

Contents - Index


Transaction (command)

Transaction <Action=Begin|End|Rollback>

Use to speed up multiple database base variable updates on all tables.

Action - Begin = start a transaction. End = finish the transaction and commit the changes to disk.Rollback = rollback all changes made to the start of the transaction. 

Database variable updates have been converted over in the macro language to transparently work via the SQL "update" statement. However this means that any time you update a database variable you are doing a write to the hard disk.

Take the following sample code that just keeps replacing the value of the log text 100 times (run this on a test database only)
 

timer status=on
table active=logs scope=parent
$x = 0
While $x < 100
$x = $x + 1
$d_ltext = "xxxx"
endwhile
timer status=off

 


So on my system this takes nearly a whopping 6 seconds!!!

What we need to do is wrap this code inside a transaction

So now our code should look like:
 

timer status=on
table active=logs scope=parent
transaction action=begin
$x = 0
While $x < 100
$x = $x + 1
$d_ltext = "xxxx"
endwhile
transaction action=end
timer status=off

 


A huge difference!!!  

Note: When updating GSAK database variables, the transaction command should always be used in preference to the native Sqlite transactions (more information)

Alpha List         Category List







Copyright 2004-2011 CWE Computer Services  
Privacy Policy Contact