Skip to content

3.2.0

Compare
Choose a tag to compare
released this 07 Jul 09:44
· 164 commits to master since this release

Changes

  • Go back to mysql.js 2.15
  • Add transactions
  • Errors are now always red, unless the debug output is only written to files.
  • Use stylus for styling

Transaction examples:

local sqls = { 'UPDATE test_users SET last_name = @ln1 WHERE id = @id1', 'UPDATE test_users SET last_name = @ln2 WHERE id = @id2' }
  local params = { id1 = 21, id2 = 22, ['@ln1'] = 'MySQL-Async1', ['@ln2'] = 'MySQL-Async2' }
  MySQL.Async.transaction(sqls, params, function(result)
    if result then
      print('Success1')
    else
      print('Failure1')
    end
  end)
  local sqls = { 
    { query = 'UPDATE test_users SET last_name = @ln1 WHERE id = @id1', parameters = { id1 = 23, ['@ln1'] = 'MySQL-Async3' } },
    { query = 'UPDATE test_users SET last_name = @ln2 WHERE id = @id2', parameters = { id2 = 24, ['@ln2'] = 'MySQL-Async4' } }
  }
  MySQL.Async.transaction(sqls, function(result)
    if result then
      print('Success2')
    else
      print('Failure2')
    end
  end)
  local sqls = { 
    { query = 'UPDATE test_users SET last_name = @ln1 WHERE id = @id1', parameters = { id1 = 25, ['@ln1'] = 'MySQL-Async3' } },
    { query = 'UPDATE test_users SET last_name = @ln2 WHERE idd = @id2', parameters = { id2 = 26, ['@ln2'] = 'MySQL-Async4' } }
  }
  MySQL.Async.transaction(sqls, function(result)
    if result then
      print('Success3')
    else
      print('Failure3')
    end
  end)

This will print:

Success1
Success2
Failure3