title: Update database version in Lua
body: <p>I'm trying to update the database version but, I'm facing a strange problem...
  Here's my code:</p>
  
  <pre><code>version = 2
  local cur_db_version=nil
  for data in db:nrows("PRAGMA user_version") do
      cur_db_version=data
      break
  end
  local db_version=cur_db_version.user_version
  print(db_version)
  print(version)
  if (db_version~=version) then
      create()
      db:exec("PRAGMA user_version="..version)
  end
  </code></pre>
  
  <p>Imagining that the database version is <code>1</code>, I'm expecting that my script prints this:</p>
  
  <pre><code>1
  2
  </code></pre>
  
  <p>But what it is printing is:</p>
  
  <pre><code>2
  2
  </code></pre>
  
  <p>Why? I don't know but, I do know that if I comment the line <code>db:exec("PRAGMA user_version="..version)</code>, then it really prints this:</p>
  
  <pre><code>1
  2
  </code></pre>
  
  <p>So, what's wrong in my code that causes the wrong output? Is the line <code>db:exec("PRAGMA user_version="..version)</code> somehow being executed before the prints? If so, how can I change my code in order that it only calls <code>create()</code> when <code>version</code> changes?</p>
  
  <p>By the way, I'm using Corona SDK but, I don't believe that the problem is related to it right?</p>