Skip to content

2.0.0 / 2024-04-17

Compare
Choose a tag to compare
@flavorjones flavorjones released this 17 Apr 17:44
· 101 commits to main since this release
59eee1d

2.0.0 / 2024-04-17

This is a major release which contains some breaking changes, primarily the removal of
long-deprecated functionality. Before upgrading, please make sure to address deprecation warnings
emitted from your application using sqlite3-ruby v1.7.x.

Ruby

Packaging

Native (precompiled) gems are now available for Linux Musl. [#442] @flavorjones

Here are the platforms for which native gems are shipped:

  • aarch64-linux-gnu (requires: glibc >= 2.29)
  • aarch64-linux-musl
  • arm-linux-gnu (requires: glibc >= 2.29)
  • arm-linux-musl
  • arm64-darwin
  • x64-mingw32 / x64-mingw-ucrt
  • x86-linux-gnu (requires: glibc >= 2.17)
  • x86-linux-musl
  • x86_64-darwin
  • x86_64-linux-gnu (requires: glibc >= 2.17)
  • x86_64-linux-musl

⚠ Ruby 3.0 linux users must use Rubygems >= 3.3.22 in order to use these gems.

⚠ Musl linux users should update to Bundler >= 2.5.6 to avoid rubygems/rubygems#7432

See the INSTALLATION doc for more information.

Dependencies

Added

  • Database#busy_handler_timeout= introduced as an alternative to #busy_timeout= that can be used when it's desired to release the GVL between retries. [#443, #456] @fractaledmind
  • Support the SUPER_JOURNAL flag which is an alias for MASTER_JOURNAL as of sqlite 3.33.0. [#467] @flavorjones
  • Statement#stat and Statement#memused introduced to report statistics. [#461] @fractaledmind
  • Statement#sql and Statement#expanded_sql introduced to retrieve the SQL statement associated with the Statement object. [#293, #498] @tenderlove
  • SQLite3.status introduced to return run-time status and reset high-water marks. See SQLite3::Constants::Status for details. [#520] @wjlroe

Improved

Changed

  • Consistently use SQLite3::Exception or subclasses. Previously some Pragmas methods raised Exception, and Database#execute_batch2 and Database#load_extension raised RuntimeError. [#467, #490] @flavorjones
  • Database#columns returns a list of internal frozen strings. [#155, #474, #486] @tenderlove
  • Freeze results that come from the database. [#480] @tenderlove
  • The encoding of a Database is no longer cached. [#485] @tenderlove
  • Database#transaction returns the result of the block when used with a block. [#508] @alexcwatt
  • Database#execute_batch returns the result of the last statement executed. [#512] @alexcwatt

Removed

  • Removed class SQLite3::Translator and all related type translation methods which have been deprecated since v1.3.2. [#470] @tenderlove

    If you need to do type translation on values returned from the statement object, please wrap it
    with a delegate object. Here is an example of using a delegate class to implement type
    translation:

    require "sqlite3"
    require "delegate"
    
    db = SQLite3::Database.new(":memory:")
    
    return_value = db.execute_batch2 <<-EOSQL
            CREATE TABLE items (id integer PRIMARY KEY AUTOINCREMENT, name string);
            INSERT INTO items (name) VALUES ("foo");
            INSERT INTO items (name) VALUES ("bar");
    EOSQL
    
    class MyTranslator < DelegateClass(SQLite3::Statement)
      def step
        row = super
        return if done?
    
        row.map.with_index do |item, i|
          case types[i]
          when "integer" # turn all integers to floats
            item.to_f
          when "string" # add "hello" to all strings
            item + "hello"
          end
        end
      end
    end
    
    db.prepare("SELECT * FROM items") do |stmt|
      stmt = MyTranslator.new(stmt)
      while row = stmt.step
        p row
      end
    end
  • Removed types and fields readers on row objects, which have been deprecated since
    v1.3.6. [#471] @tenderlove

    Deprecated code looks like this:

    row = @db.execute("select * from foo")
    assert_equal ["blob"], row.first.types

    If you would like to access the "types" associated with a returned query,
    use a prepared statement like this:

    @db.prepare("select * from foo") do |v|
      assert_equal ["blob"], v.types
    end
  • Removed support for non-Array bind parameters to methods Database#execute, #execute_batch, and #query, which has been deprecated since v1.3.0. [#511] @flavorjones

    Deprecated code looks like this:

    @db.query("select * from foo where a = ? and b = ? and c = ?", 1, 2, 3)

    For these cases, pass the bind parameters as an array:

    @db.query("select * from foo where a = ? and b = ? and c = ?", [1, 2, 3])
  • Removed class SQLite3::VersionProxy which has been deprecated since v1.3.2. [#453] @flavorjones

  • Removed methods SQLite3::Database::FunctionProxy#count and #set_error which have been broken since at least v1.3.13. [#164, #509, #510] @alexcwatt @flavorjones


sha256 checksums:

c6720d3e695aab101058b20888784e45f0b060240d2265220ccf6905b3673c78  sqlite3-2.0.0-aarch64-linux-gnu.gem
c7941aa1fee7df021f023d77d980db887b400807c29b1ae321ad5c81678abe54  sqlite3-2.0.0-aarch64-linux-musl.gem
0e4f7e56a0569940c4d8ffd3bc56b9338f5ea93448bd6904dfaf4ba46f15ba9a  sqlite3-2.0.0-arm-linux-gnu.gem
a3950521c0e6a4e345069064cd8818ef2307e119eb8babf186893dd00de73838  sqlite3-2.0.0-arm-linux-musl.gem
4997a2530053565329ef0dee50178541626abb561eac2aff73efce2f86014e5e  sqlite3-2.0.0-arm64-darwin.gem
cc202af7f33e4e793c46b004827795a5c5cb90270eba2638b675d6be67380a87  sqlite3-2.0.0-x64-mingw-ucrt.gem
bb3c70fe0bcd64572b0d490f92735139b881442a295cf0d8bbca9eef9542c09e  sqlite3-2.0.0-x64-mingw32.gem
5e287bd13cbc7c2f824e29e90f181a41def579baab0bb4919b201087fb7067b7  sqlite3-2.0.0-x86-linux-gnu.gem
e07a4d3e92e843079f12f720152740c1eba70b07446cf1b597b824847ba8e395  sqlite3-2.0.0-x86-linux-musl.gem
356dbfeff65f0dd9ece1ac8a0bb057b3aa58a88a0187b64f7bbf6c6d6767ea43  sqlite3-2.0.0-x86_64-darwin.gem
5312d0f1bc1670c3223ec5c49906beead9b4dc797616dec37270d54b0e7de4b2  sqlite3-2.0.0-x86_64-linux-gnu.gem
df7dac50baaa93fc216903a09262d2d5141f09a60c74941df534ac53c7e7ff3a  sqlite3-2.0.0-x86_64-linux-musl.gem
f688e4aae13f60abb8f3a49d3fa23a814d3c6643b89fec96baef33602c8f4e07  sqlite3-2.0.0.gem