AIR ActiveRecord is Open Source


/ Published in: ActionScript 3
Save to your folder(s)

Active Record ORM implementation in ActionScript 3 for AIR's SQLite DB


Copy this code and paste it in your HTML
  1. 1.
  2. var employee = new Employee();
  3. 2.
  4. employee.loadBy("username = ?", "bobTheBuilder");
  5. 3.
  6.  
  7. 4.
  8. // accessing tasks will autoload them from the database
  9. 5.
  10. for each (var task:Task in employee.tasks)
  11. 6.
  12. trace(task);
  13. 7.
  14.  
  15. 8.
  16. task = new Task("Call your mother");
  17. 9.
  18. employee.task.push(task);
  19. 10.
  20. employee.saveTasks();
  21. 11.
  22.  
  23. 12.
  24. employee.firstName = "Bobby";
  25. 13.
  26. employee.save();
  27. 14.
  28.  
  29. 15.
  30. var employee2:Employee = new Employee();
  31. 16.
  32. employee2.firstName = "Sue";
  33. 17.
  34. ....
  35. 18.
  36. employee2.save();
  37. 19.
  38. trace(employee2.id); // new id

URL: http://jacwright.com/blog/79/air-activerecord-is-open-source/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.