### Home Classes Methods

### Files

- CHANGELOG
- COPYING
- README.rdoc
- advanced_associations.rdoc
- association_basics.rdoc
- cheat_sheet.rdoc
- dataset_basics.rdoc
- dataset_filtering.rdoc
- migration.rdoc
- model_hooks.rdoc
- opening_databases.rdoc
- prepared_statements.rdoc
- querying.rdoc
- reflection.rdoc
- 1.0.txt
- 1.1.txt
- 1.3.txt
- 1.4.0.txt
- 1.5.0.txt
- 2.0.0.txt
- 2.1.0.txt
- 2.10.0.txt
- 2.11.0.txt
- 2.12.0.txt
- 2.2.0.txt
- 2.3.0.txt
- 2.4.0.txt
- 2.5.0.txt
- 2.6.0.txt
- 2.7.0.txt
- 2.8.0.txt
- 2.9.0.txt
- 3.0.0.txt
- 3.1.0.txt
- 3.10.0.txt
- 3.11.0.txt
- 3.12.0.txt
- 3.2.0.txt
- 3.3.0.txt
- 3.4.0.txt
- 3.5.0.txt
- 3.6.0.txt
- 3.7.0.txt
- 3.8.0.txt
- 3.9.0.txt
- sharding.rdoc
- sql.rdoc
- virtual_rows.rdoc

### Class Index

Quicksearch

- Sequel
- Sequel::ADO
- Sequel::ADO::Database
- Sequel::ADO::Dataset
- Sequel::ADO::MSSQL
- Sequel::ADO::MSSQL::DatabaseMethods
- Sequel::ADO::MSSQL::Dataset
- Sequel::AdapterNotFound
- Sequel::Amalgalite
- Sequel::Amalgalite::Database
- Sequel::Amalgalite::Dataset
- Sequel::Amalgalite::SequelTypeMap
- Sequel::BasicObject
- Sequel::BeforeHookFailed
- Sequel::ConnectionPool
- Sequel::ConnectionPool::ClassMethods
- Sequel::DB2
- Sequel::DB2::Database
- Sequel::DB2::Dataset
- Sequel::DBI
- Sequel::DBI::Database
- Sequel::DBI::Dataset
- Sequel::DataObjects
- Sequel::DataObjects::Database
- Sequel::DataObjects::Dataset
- Sequel::DataObjects::MySQL
- Sequel::DataObjects::MySQL::DatabaseMethods
- Sequel::DataObjects::MySQL::Dataset
- Sequel::DataObjects::Postgres
- Sequel::DataObjects::Postgres::AdapterMethods
- Sequel::DataObjects::Postgres::DatabaseMethods
- Sequel::DataObjects::Postgres::Dataset
- Sequel::DataObjects::SQLite
- Sequel::DataObjects::SQLite::DatabaseMethods
- Sequel::DataObjects::SQLite::Dataset
- Sequel::Database
- Sequel::DatabaseConnectionError
- Sequel::DatabaseDisconnectError
- Sequel::DatabaseError
- Sequel::Dataset
- Sequel::Dataset::ArgumentMapper
- Sequel::Dataset::Pagination
- Sequel::Dataset::PreparedStatementMethods
- Sequel::Dataset::QueryBlockCopy
- Sequel::Dataset::StoredProcedureMethods
- Sequel::Dataset::StoredProcedures
- Sequel::Dataset::UnnumberedArgumentMapper
- Sequel::Error
- Sequel::Error::AdapterNotFound
- Sequel::Error::InvalidOperation
- Sequel::Error::InvalidValue
- Sequel::Error::PoolTimeoutError
- Sequel::Error::Rollback
- Sequel::Firebird
- Sequel::Firebird::Database
- Sequel::Firebird::Dataset
- Sequel::Inflections
- Sequel::Informix
- Sequel::Informix::Database
- Sequel::Informix::Dataset
- Sequel::IntegerMigrator
- Sequel::InvalidOperation
- Sequel::InvalidValue
- Sequel::JDBC
- Sequel::JDBC::AS400
- Sequel::JDBC::AS400::DatabaseMethods
- Sequel::JDBC::AS400::Dataset
- Sequel::JDBC::Database
- Sequel::JDBC::Dataset
- Sequel::JDBC::Dataset::PreparedStatementMethods
- Sequel::JDBC::Dataset::StoredProcedureMethods
- Sequel::JDBC::H2
- Sequel::JDBC::H2::DatabaseMethods
- Sequel::JDBC::H2::Dataset
- Sequel::JDBC::JavaLang
- Sequel::JDBC::JavaSQL
- Sequel::JDBC::JavaxNaming
- Sequel::JDBC::MSSQL
- Sequel::JDBC::MSSQL::DatabaseMethods
- Sequel::JDBC::MSSQL::Dataset
- Sequel::JDBC::MySQL
- Sequel::JDBC::MySQL::DatabaseMethods
- Sequel::JDBC::MySQL::Dataset
- Sequel::JDBC::Oracle
- Sequel::JDBC::Oracle::DatabaseMethods
- Sequel::JDBC::Oracle::Dataset
- Sequel::JDBC::Postgres
- Sequel::JDBC::Postgres::AdapterMethods
- Sequel::JDBC::Postgres::DatabaseMethods
- Sequel::JDBC::Postgres::Dataset
- Sequel::JDBC::SQLite
- Sequel::JDBC::SQLite::DatabaseMethods
- Sequel::JDBC::SQLite::Dataset
- Sequel::LiteralString
- Sequel::LooserTypecasting
- Sequel::MSSQL
- Sequel::MSSQL::DatabaseMethods
- Sequel::MSSQL::DatasetMethods
- Sequel::Metaprogramming
- Sequel::Migration
- Sequel::MigrationDSL
- Sequel::Migrator
- Sequel::Migrator::Error
- Sequel::Model
- Sequel::Model::Associations
- Sequel::Model::Associations::AssociationDatasetMethods
- Sequel::Model::Associations::AssociationReflection
- Sequel::Model::Associations::ClassMethods
- Sequel::Model::Associations::DatasetMethods
- Sequel::Model::Associations::InstanceMethods
- Sequel::Model::Associations::ManyToManyAssociationReflection
- Sequel::Model::Associations::ManyToOneAssociationReflection
- Sequel::Model::Associations::OneToManyAssociationReflection
- Sequel::Model::Associations::OneToOneAssociationReflection
- Sequel::Model::ClassMethods
- Sequel::Model::DatasetMethods
- Sequel::Model::Errors
- Sequel::Model::InstanceMethods
- Sequel::MySQL
- Sequel::MySQL::Database
- Sequel::MySQL::DatabaseMethods
- Sequel::MySQL::Dataset
- Sequel::MySQL::Dataset::CallableStatementMethods
- Sequel::MySQL::Dataset::PreparedStatementMethods
- Sequel::MySQL::Dataset::StoredProcedureMethods
- Sequel::MySQL::DatasetMethods
- Sequel::NamedTimezones
- Sequel::NoExistingObject
- Sequel::NotImplemented
- Sequel::ODBC
- Sequel::ODBC::Database
- Sequel::ODBC::Dataset
- Sequel::ODBC::MSSQL
- Sequel::ODBC::MSSQL::DatabaseMethods
- Sequel::ODBC::MSSQL::Dataset
- Sequel::OpenBase
- Sequel::OpenBase::Database
- Sequel::OpenBase::Dataset
- Sequel::Oracle
- Sequel::Oracle::Database
- Sequel::Oracle::DatabaseMethods
- Sequel::Oracle::Dataset
- Sequel::Oracle::DatasetMethods
- Sequel::Plugins
- Sequel::Plugins::ActiveModel
- Sequel::Plugins::ActiveModel::InstanceMethods
- Sequel::Plugins::AssociationDependencies
- Sequel::Plugins::AssociationDependencies::ClassMethods
- Sequel::Plugins::AssociationDependencies::InstanceMethods
- Sequel::Plugins::AssociationPks
- Sequel::Plugins::AssociationPks::ClassMethods
- Sequel::Plugins::AssociationProxies
- Sequel::Plugins::AssociationProxies::AssociationProxy
- Sequel::Plugins::AssociationProxies::ClassMethods
- Sequel::Plugins::BooleanReaders
- Sequel::Plugins::BooleanReaders::ClassMethods
- Sequel::Plugins::Caching
- Sequel::Plugins::Caching::ClassMethods
- Sequel::Plugins::Caching::InstanceMethods
- Sequel::Plugins::ClassTableInheritance
- Sequel::Plugins::ClassTableInheritance::ClassMethods
- Sequel::Plugins::ClassTableInheritance::InstanceMethods
- Sequel::Plugins::Composition
- Sequel::Plugins::Composition::ClassMethods
- Sequel::Plugins::Composition::InstanceMethods
- Sequel::Plugins::ForceEncoding
- Sequel::Plugins::ForceEncoding::ClassMethods
- Sequel::Plugins::ForceEncoding::InstanceMethods
- Sequel::Plugins::HookClassMethods
- Sequel::Plugins::HookClassMethods::ClassMethods
- Sequel::Plugins::HookClassMethods::InstanceMethods
- Sequel::Plugins::IdentityMap
- Sequel::Plugins::IdentityMap::ClassMethods
- Sequel::Plugins::IdentityMap::InstanceMethods
- Sequel::Plugins::InstanceFilters
- Sequel::Plugins::InstanceFilters::InstanceMethods
- Sequel::Plugins::InstanceHooks
- Sequel::Plugins::InstanceHooks::InstanceMethods
- Sequel::Plugins::LazyAttributes
- Sequel::Plugins::LazyAttributes::ClassMethods
- Sequel::Plugins::LazyAttributes::InstanceMethods
- Sequel::Plugins::ManyThroughMany
- Sequel::Plugins::ManyThroughMany::ClassMethods
- Sequel::Plugins::ManyThroughMany::ManyThroughManyAssociationReflection
- Sequel::Plugins::NestedAttributes
- Sequel::Plugins::NestedAttributes::ClassMethods
- Sequel::Plugins::NestedAttributes::InstanceMethods
- Sequel::Plugins::OptimisticLocking
- Sequel::Plugins::OptimisticLocking::ClassMethods
- Sequel::Plugins::OptimisticLocking::InstanceMethods
- Sequel::Plugins::RcteTree
- Sequel::Plugins::Schema
- Sequel::Plugins::Schema::ClassMethods
- Sequel::Plugins::Serialization
- Sequel::Plugins::Serialization::ClassMethods
- Sequel::Plugins::Serialization::InstanceMethods
- Sequel::Plugins::Sharding
- Sequel::Plugins::Sharding::ClassMethods
- Sequel::Plugins::Sharding::DatasetMethods
- Sequel::Plugins::Sharding::InstanceMethods
- Sequel::Plugins::SingleTableInheritance
- Sequel::Plugins::SingleTableInheritance::ClassMethods
- Sequel::Plugins::SingleTableInheritance::InstanceMethods
- Sequel::Plugins::SkipCreateRefresh
- Sequel::Plugins::SkipCreateRefresh::InstanceMethods
- Sequel::Plugins::StringStripper
- Sequel::Plugins::StringStripper::InstanceMethods
- Sequel::Plugins::Subclasses
- Sequel::Plugins::Subclasses::ClassMethods
- Sequel::Plugins::TacticalEagerLoading
- Sequel::Plugins::TacticalEagerLoading::DatasetMethods
- Sequel::Plugins::TacticalEagerLoading::InstanceMethods
- Sequel::Plugins::Timestamps
- Sequel::Plugins::Timestamps::ClassMethods
- Sequel::Plugins::Timestamps::InstanceMethods
- Sequel::Plugins::Touch
- Sequel::Plugins::Touch::ClassMethods
- Sequel::Plugins::Touch::InstanceMethods
- Sequel::Plugins::TypecastOnLoad
- Sequel::Plugins::TypecastOnLoad::ClassMethods
- Sequel::Plugins::TypecastOnLoad::InstanceMethods
- Sequel::Plugins::UpdatePrimaryKey
- Sequel::Plugins::UpdatePrimaryKey::ClassMethods
- Sequel::Plugins::UpdatePrimaryKey::InstanceMethods
- Sequel::Plugins::ValidationClassMethods
- Sequel::Plugins::ValidationClassMethods::ClassMethods
- Sequel::Plugins::ValidationClassMethods::ClassMethods::Generator
- Sequel::Plugins::ValidationClassMethods::InstanceMethods
- Sequel::Plugins::ValidationHelpers
- Sequel::Plugins::ValidationHelpers::InstanceMethods
- Sequel::PoolTimeout
- Sequel::Postgres
- Sequel::Postgres::Adapter
- Sequel::Postgres::AdapterMethods
- Sequel::Postgres::Database
- Sequel::Postgres::DatabaseMethods
- Sequel::Postgres::Dataset
- Sequel::Postgres::Dataset::ArgumentMapper
- Sequel::Postgres::Dataset::BindArgumentMethods
- Sequel::Postgres::Dataset::PreparedStatementMethods
- Sequel::Postgres::DatasetMethods
- Sequel::Postgres::DatasetMethods::PreparedStatementMethods
- Sequel::PrettyTable
- Sequel::Progress
- Sequel::Progress::DatabaseMethods
- Sequel::Progress::DatasetMethods
- Sequel::Rollback
- Sequel::SQL
- Sequel::SQL::AliasMethods
- Sequel::SQL::AliasedExpression
- Sequel::SQL::BitwiseMethods
- Sequel::SQL::Blob
- Sequel::SQL::BooleanConstant
- Sequel::SQL::BooleanExpression
- Sequel::SQL::BooleanMethods
- Sequel::SQL::CaseExpression
- Sequel::SQL::Cast
- Sequel::SQL::CastMethods
- Sequel::SQL::ColumnAll
- Sequel::SQL::ComplexExpression
- Sequel::SQL::ComplexExpressionMethods
- Sequel::SQL::Constant
- Sequel::SQL::Constants
- Sequel::SQL::Expression
- Sequel::SQL::Function
- Sequel::SQL::GenericComplexExpression
- Sequel::SQL::GenericExpression
- Sequel::SQL::Identifier
- Sequel::SQL::IdentifierMethods
- Sequel::SQL::InequalityMethods
- Sequel::SQL::JoinClause
- Sequel::SQL::JoinOnClause
- Sequel::SQL::JoinUsingClause
- Sequel::SQL::NegativeBooleanConstant
- Sequel::SQL::NoBooleanInputMethods
- Sequel::SQL::NumericExpression
- Sequel::SQL::NumericMethods
- Sequel::SQL::OrderMethods
- Sequel::SQL::OrderedExpression
- Sequel::SQL::PlaceholderLiteralString
- Sequel::SQL::QualifiedIdentifier
- Sequel::SQL::QualifyingMethods
- Sequel::SQL::SQLArray
- Sequel::SQL::StringConcatenationMethods
- Sequel::SQL::StringExpression
- Sequel::SQL::StringMethods
- Sequel::SQL::Subscript
- Sequel::SQL::SubscriptMethods
- Sequel::SQL::VirtualRow
- Sequel::SQL::Window
- Sequel::SQL::WindowFunction
- Sequel::SQLite
- Sequel::SQLite::Database
- Sequel::SQLite::DatabaseMethods
- Sequel::SQLite::Dataset
- Sequel::SQLite::Dataset::ArgumentMapper
- Sequel::SQLite::Dataset::PreparedStatementMethods
- Sequel::SQLite::DatasetMethods
- Sequel::Schema
- Sequel::Schema::AlterTableGenerator
- Sequel::Schema::Generator
- Sequel::ShardedSingleConnectionPool
- Sequel::ShardedThreadedConnectionPool
- Sequel::SimpleMigration
- Sequel::SingleConnectionPool
- Sequel::ThreadLocalTimezones
- Sequel::ThreadedConnectionPool
- Sequel::TimestampMigrator
- Sequel::Timezones
- Sequel::ValidationFailed
- String
- String::Inflections
- Array
- FalseClass
- Hash
- NilClass
- Numeric
- Object
- PGconn
- PGresult
- Proc
- Symbol
- TrueClass

No matching classes.

Deprecated Methods/Features Removed

Methods and features that were deprecated in 2.12.0 have been removed in 3.0.0. Many features were moved into plugins or extensions, so in many cases you just need to require an extension or use Model.plugin and not make any changes to your code. See the 2.12.0 release notes for the list of methods/features deprecated in 2.12.0.

If you are upgrading from a previous 2.x release, please upgrade to 2.12.0 first, fix your code to remove all deprecation warnings, and then upgrade to 3.0.0.

New Adapter

- Sequel now has an Amalgalite adapter. Amalgalite is a ruby extension that embeds SQLite without requiring a separate SQLite installation. The adapter is functionality complete but significantly slower than the native SQLite adapter.

New Features

- The JDBC, PostgreSQL, MySQL, and SQLite adapters all now have a Database#indexes method that returns indexes for a given table:

      DB.indexes(:songs)
      => {:songs_name_index=>{:unique=>true, :columns=>[:name]},
          :songs_lyricid_index=>{:unique=>false, :columns=>[:lyricid]}}

- A schema_dumper extension was added to Sequel. It supports dumping the schema of a table (including indexes) as a string that can be evaluated in the context of a Database object to create the table. It also supports dumping all tables in the database as a string containing a Migration subclass that will rebuild the database.

      require 'sequel/extensions/schema_dumper'
      DB.dump_table_schema(:table)
      DB.dump_schema_migration
      DB.dump_schema_migration(:same_db=>true)
      DB.dump_schema_migration(:indexes=>false)
      DB.dump_indexes_migration

  The :same_db option causes Sequel to not translate column types to generic column types. By default, the migration created will use generic types so it will run on other databases. However, if you only want to support a single database, using the :same_db option will make the migration use the exact database type parsed from the database.

  The :indexes=>false option causes indexes not be included in the migration. The dump_indexes_migration can be used to create a separate migration with the indexes. This can be useful if you plan on loading a lot of data right after creating the tables, since it is faster to add indexes after the data has been added.

- Using options with the generic database types is now supported to a limited extent. For example, the following code now works:

      DB.create_table(:table) do
        String :a, :size=>50               # varchar(50)
        String :b, :text=>true             # text
        String :c, :fixed=>true, :size=>30 # char(30)
        Time :ts                           # timestamp
        Time :t, :only_time=>true          # time
      end

- Using Dataset#filter and related methods with multiple arguments now works much more intuitively:

      # 2.12.0
      dataset.filter(:a, :b=>1) # a IS NULL AND (b = 1) IS NULL
      # 3.0.0
      dataset.filter(:a, :b=>1) # a AND b = 1

- You can now create temporary tables by passing the :temp=>true option to Database#create_table.

- The Oracle shared adapter now supports emulation of autoincrementing primary keys by creating a sequence and a trigger, similar to how the Firebird adapter works.

- The Database#database_type method was added that returns a symbol specifying the database type being used. This can be different than Database.adapter_scheme if you are using an adapter like JDBC that allows connecting to multiple different types of databases.

- Database#drop_index and related methods now support an options hash that respects the :name option, so they can now be used to drop an index that doesn’t use the default index name.

- The PostgreSQL shared adapter now supports a Database#reset_primary_key_sequence method to reset the primary key sequence for a given table, based on code from ActiveRecord.

- SQL::QualifiedIdentifiers can now be qualified, allowing you to do:

      :column.qualify(:table).qualify(:schema)

- Using the :db_type=>‘mssql’ option with the DBI adapter will now load the MSSQL support.

- The MySQL shared adapter now supports Dataset#full_text_sql, which you can use in queries like the following:

      ds.select(:table.*, ds.full_text_sql(:column, 'value').as(:ft))

Other Improvements

- Sequel will now release connections from the connection pool automatically if they are held by a dead thread. This can happen if you are using MRI 1.8 and you are heavily multithreaded or you call Thread#exit! or similar method explicitly. Those methods skip the execution of ensure blocks which normally release the connections when the threads exit.

- Model#save will now always use the same server when refreshing data after an insert. This fixes an issue when Sequel’s master/slave database support is used with models.

- SQL Array references are now quoted correctly, so code like this now works:

      :table__column.sql_subscript(1)

- The PostgreSQL shared adapter now handles sequences that need to be quoted correctly (previously these were quoted twice).

- String quoting on Oracle no longer doubles backslashes.

- Database#count now works correctly when used on MSSQL when using an adapter that doesn’t handle unnamed columns.

- Full text searching in the MySQL adapter now works correctly when multiple search terms are used.

- Altering a column’s name, type, default, or NULL/NOT NULL status on MySQL now keeps other relevent column information. For example, if you alter a column’s type, it’ll keep an existing default. This functionality isn’t complete, there may be other column information that is lost.

- Fix creation of an index with a given type on MySQL, since MySQL’s documentation lies.

- The schema parser now handles decimal types with size specifiers, fixing use on MySQL.

- Dataset#quote_identifier now works correctly when given an SQL::Identifier. This allows you to do:

      dataset.select{sum(hours).as(hours)}

Backwards Compatibility

- Sequel will now use instance_eval on all virtual row blocks without an argument. This can lead to much nicer code:

      dataset.filter{(number > 10) & (name > 'M')}
      # WHERE number > 10 AND name > 'M'

  2.12.0 raised a deprecation warning if you used a virtual row block without an argument and you hadn’t set Sequel.virtual_row_instance_eval = true.

- Dataset#exclude now inverts the given argument, instead of negating it. This only changes its behavior if it is called with a hash or array of all two pairs that have more than one element.

      # 2.12.0
      dataset.exclude(:a=>1, :b=>1) # a != 1 AND b != 1
      # 3.0.0
      dataset.exclude(:a=>1, :b=>1) # a != 1 OR b != 1

  This was done for consistency, since exclude would only negate a hash if it was given an argument, it would invert the same hash if you used a block:

      # 2.12.0
      dataset.exclude{{:a=>1, :b=>1}} # a != 1 OR b != 1

  If you want the previous behavior, change the code to the following:

      dataset.filter({:a=>1, :b=>1}.sql_negate)

- As noted above, the methods/features deprecated in 2.12.0 were removed.

- The private Dataset#select_*_sql methods now only take a single argument, the SQL string being built.

- Dataset#from when called without arguments would previously cause an error to be raised when the SQL string is generated. Now it causes no FROM clause to be used, similar to how Dataset#select with no arguments causes SELECT * to be used.

- The internals of the generic type support and the schema generators were changed significantly, which could have some fallout in terms of old migrations breaking if they used the generic types and were relying on some undocumented behavior (such as using Integer as a type with the :unsigned option).

- The Firebird adapter no longer translates the text database specific type. Use the following instead:

      String :column, :text=>true

- The MySQL shared adapter used to use the timestamp type for Time, now it uses datetime. This is because the timestamp type cannot represent everything that the ruby Time class can represent.

- Metaprogramming#metaattr_accessor and metaattr_reader methods were removed.

- Dataset#irregular_function_sql was removed.

[Validate]

Generated with the Darkfish Rdoc Generator 2.