/ Published in: ActionScript 3
Active Record ORM implementation in ActionScript 3 for AIR's SQLite DB
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
1. var employee = new Employee(); 2. employee.loadBy("username = ?", "bobTheBuilder"); 3. 4. // accessing tasks will autoload them from the database 5. for each (var task:Task in employee.tasks) 6. trace(task); 7. 8. task = new Task("Call your mother"); 9. employee.task.push(task); 10. employee.saveTasks(); 11. 12. employee.firstName = "Bobby"; 13. employee.save(); 14. 15. var employee2:Employee = new Employee(); 16. employee2.firstName = "Sue"; 17. .... 18. employee2.save(); 19. trace(employee2.id); // new id
URL: http://jacwright.com/blog/79/air-activerecord-is-open-source/