Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose sqlite's sqlite3_create_collation() #2495

Closed
wants to merge 7 commits into from

Commits on Sep 11, 2020

  1. Configuration menu
    Copy the full SHA
    cbed866 View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2020

  1. Prevent panics from escaping SqliteAggregatorFunction

    Panics across FFI boundaries cause undefined behavior in current Rust.
    The aggregator functions are callbacks invoked from C (libsqlite).
    To safe-guard against panics, std::panic::catch_unwind() is used. On
    panic the functions now return with an error result indicating the
    unexpected panic occurred.
    
    std::panic::catch_unwind() requires types to implement
    std::panic::UnwindSafe, a marker trait indicating that care must be
    taken since panics introduce control-flow that is not very visible.
    Refer to https://doc.rust-lang.org/std/panic/trait.UnwindSafe.html for a
    more detailed explanation.
    For SqliteAggregatorFunction::step() we must use
    std::panic::AssertUnwindSafe, since &mut references are never considered
    UnwindSafe, and the requirement to ensure unwind-safety is documented on
    the method.
    Of note is that in safe Rust, even if the method is not unwind-safe
    the language still guarantees memory-safety. The marker trait is mainly
    to prevent logic bugs.
    z33ky committed Sep 14, 2020
    Configuration menu
    Copy the full SHA
    ee2f792 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3464a40 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1568d9f View commit details
    Browse the repository at this point in the history
  4. Add assert_fail!() convenience function

    This encompasses the pattern of eprintln!() + std::process::abort() and
    adds a request to open an issue if the message is observed.
    z33ky committed Sep 14, 2020
    Configuration menu
    Copy the full SHA
    eaa78e1 View commit details
    Browse the repository at this point in the history
  5. Prevent panics from escaping SQLite custom functions

    This is essentially the same treatment that custom aggregate functions
    got in ee2f792.
    z33ky committed Sep 14, 2020
    Configuration menu
    Copy the full SHA
    5d134c1 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bf4c952 View commit details
    Browse the repository at this point in the history