class SQLite3::Database

def initialize file, options = {}, zvfs = nil

def initialize file, options = {}, zvfs = nil
  mode = Constants::Open::READWRITE | Constants::Open::CREATE
  file = file.to_path if file.respond_to? :to_path
  if file.encoding == ::Encoding::UTF_16LE || file.encoding == ::Encoding::UTF_16BE || options[:utf16]
    open16 file
  else
    # The three primary flag values for sqlite3_open_v2 are:
    # SQLITE_OPEN_READONLY
    # SQLITE_OPEN_READWRITE
    # SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE -- always used for sqlite3_open and sqlite3_open16
    mode = Constants::Open::READONLY if options[:readonly]
    if options[:readwrite]
      raise "conflicting options: readonly and readwrite" if options[:readonly]
      mode = Constants::Open::READWRITE
    end
    if options[:flags]
      if options[:readonly] || options[:readwrite]
        raise "conflicting options: flags with readonly and/or readwrite"
      end
      mode = options[:flags]
    end
    open_v2 file.encode("utf-8"), mode, zvfs
    if options[:strict]
      disable_quirk_mode
    end
  end
  @tracefunc        = nil
  @authorizer       = nil
  @encoding         = nil
  @busy_handler     = nil
  @collations       = {}
  @functions        = {}
  @results_as_hash  = options[:results_as_hash]
  @type_translation = options[:type_translation]
  @type_translator  = make_type_translator @type_translation
  @readonly         = mode & Constants::Open::READONLY != 0
  if block_given?
    begin
      yield self
    ensure
      close
    end
  end
end