API_CHANGES.rdoc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. = API Changes
  2. * SQLite3::Database#execute only accepts an array for bind parameters.
  3. * SQLite3::ResultSet used to query the database for the first row, regardless
  4. of whether the user asked for it or not. I have removed that so that rows
  5. will not be returned until the user asks for them. This is a subtle but
  6. sometimes important change in behavior.
  7. 83882d2208ed189361617d5ab8532a325aaf729d
  8. * SQLite3::Database#trace now takes either a block or an object that responds
  9. to "call". The previous implementation passed around a VALUE that was cast
  10. to a void *. This is dangerous because the value could get garbage collected
  11. before the proc was called. If the user wants data passed around with the
  12. block, they should use variables available to the closure or create an
  13. object.
  14. * SQLite3::Statement#step automatically converts to ruby types, where before
  15. all values were automatically yielded as strings. This will only be a
  16. problem for people who were accessing information about the database that
  17. wasn't previously passed through the pure ruby conversion code.
  18. * SQLite3::Database#errmsg no longer takes a parameter to return error
  19. messages as UTF-16. Do people even use that? I opt for staying UTF-8 when
  20. possible. See test_integration.rb test_errmsg_utf16
  21. * SQLite3::Database#authorize same changes as trace
  22. * test/test_tc_database.rb was removed because we no longer use the Driver
  23. design pattern.
  24. = Garbage Collection Strategy
  25. All statements keep pointers back to their respective database connections.
  26. The @connection instance variable on the Statement handle keeps the database
  27. connection alive. Memory allocated for a statement handler will be freed in
  28. two cases:
  29. * close is called on the statement
  30. * The SQLite3::Database object gets garbage collected
  31. We can't free the memory for the statement in the garbage collection function
  32. for the statement handler. The reason is because there exists a race
  33. condition. We cannot guarantee the order in which objects will be garbage
  34. collected. So, it is possible that a connection and a statement are up for
  35. garbage collection. If the database connection were to be free'd before the
  36. statement, then boom. Instead we'll be conservative and free unclosed
  37. statements when the connection is terminated.