title: add json-based data into a sqlite database using swiftyJSON and sqlite.swift
body: <p>Please bear with me this is my first swift project, I'm not yet up to speed with the syntax/language.</p>
  
  <p>I retrieve data from a web service using AlamoFire and parse it using SwiftyJson. Then I want to insert it into a local SQLite database using SQLite.swift.</p>
  
  <p>So far AlomoFire, SwiftyJson and SQLite.swift are installed and working in my project, things went very smooth to my surprise ;)</p>
  
  <p>Now my question. The data I got is in JSON, in an Array so I want to do this:</p>
  
  <pre><code>let companiesTable = db["companies"] // get the table from our SQLite Database
  db.transaction(.Deferred) { txn in
      for (index,company) in data {
          if companiesTable.insert(name &lt;- company["name"]!), shortname &lt;- company["short_name"]).statement.failed {
              return .Rollback
          }
      }
      return .Commit
  }
  </code></pre>
  
  <p>My problem is in the insert. I have to force unwrap using a !, which is ok for name (required column in the database), but not ok for shortname or a dozen other columns (not mentioned in the example above for simplicity) which may be empty/null. Of course only columns with a value should be inserted.</p>
  
  <p>Second question. I found the stuff about transactions here on stackoverflow, is the transaction automatically Committed or Roll-backed when doing the 'return'</p>