### 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::Error
- 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.

New Features

- The ConnectionPool classes were refactored from 2 separate classes to a 5 class hierarchy, with one main class and 4 subclasses, one for each combination of sharding and threading.

  The primary reason for this refactoring is to make it so that the user doesn’t have to pay a performance penalty for sharding if they aren’t using it. A connection pool that supports sharding is automatically used if the :servers option is used when setting up the database connection.

  In addition, the default connection pool no longer contains the code to schedule future disconnections of currently allocated connections. The sharded connection pool must be used if that feature is desired.

  The unsharded connection pools are about 25-30% faster than the sharded versions.

- An optimistic_locking plugin was added to Sequel::Model. This plugin implements a simple database-independent locking mechanism to ensure that concurrent updates do not override changes:

      class Person < Sequel::Model
        plugin :optimistic_locking
      end
      p1 = Person[1]
      p2 = Person[1]
      # works
      p1.update(:name=>'Jim')
      # raises Sequel::Plugins::OptimisticLocking::Error
      p2.update(:name=>'Bob')

  In order for this plugin to work, you need to make sure that the database table has a lock_version column (or other column you name via the lock_column class level accessor) that defaults to 0.

  The optimistic_locking plugin does not work with the class_table_inheritance plugin.

- Dataset#unused_table_alias was added, which takes a symbol and returns either that symbol or a new symbol which can be used as a table alias when joining a table to the dataset. The symbol returned is guaranteed to not already be used by the dataset:

      DB[:test].unused_table_alias(:blah) # => :blah
      DB[:test].unused_table_alias(:test) # => :test_0

  The use case is when you need to join a table to a dataset, where the table may already be used inside the dataset, and you want to generate a unique alias:

      ds.join(:table.as(ds.unused_table_alias(:table)), ...)

- The Sequel::ValidationFailed exception now has an errors accessor which returns the Sequel::Model::Errors instance with the validation errors. This can be helpful in situations where a generalized rescue is done where the model object reference is not available.

- bin/sequel now works without an argument, which is useful for testing SQL generation (and not much else).

- Support SELECT … INTO in the MSSQL adapter, using Dataset#into, which takes a table argument.

- You can now provide your own connection pool class via the :pool_class option when instantiating the database.

Other Improvements

- IN/NOT IN constructs with an empty array are now handled properly.

      DB[:table].filter(:id=>[]) # IN
      DB[:table].exclude(:id=>[]) # NOT IN

  Before, the IN construct would mostly work, other than some minor differences in NULL semantics. However, the NOT IN construct would not work. Sequel now handles the NOT IN case using an expression that evaluates to true.

- If using an IN/NOT IN construct with multiple columns and a dataset argument, where multiple column IN/NOT IN support is emulated, a separate query is done to get the records, which is then handled like an array of values. This means that the following type of query now works on all tested databases:

      DB[:table1].filter([:id1, :id2]=>DB[:table2].select(:id1, :id2))

- Schemas and aliases are now handled correctly when eager graphing.

- Implicitly qualified symbols are now handled correctly in update statements, useful if you are updating a joined dataset and need to reference a column that appears in multiple tables.

- The active_model plugin has been brought up to date with activemodel 3.0 beta (though it doesn’t work on edge). Additionally, the active_model plugin now requires active_model in order to use ActiveModel::Naming.

- In the schema_dumper extension, always include the varchar limit, even if it is 255 columns (the default). This makes it so that PostgreSQL will use a varchar(255) column instead of a text column when restoring a schema dump of a varchar(255) column from another database.

- You can now load adapters from outside the Sequel lib directory, now they just need to be in a sequel/adapters directory somewhere in the LOAD_PATH.

- You can now load extensions from outside the Sequel lib directory using Sequel.extension. External extensions need to be in a sequel/extensions directory somewhere in the LOAD_PATH.

- Using bound variables for limit and offset in prepared statements now works correctly.

- Performance of prepared statements was improved in the native SQLite adapter.

- The schema_dumper extension now passes the options hash from dump_*_migration to Database#tables.

- In the single_table_inheritance plugin, qualify the sti_key column with the table name, so that subclass datasets can safely be joined to other tables having the same column name.

- In the single_table_inheritance plugin, handle case where the sti_key value is nil or ” specially, so that those cases always return an instance of the main model class. This fixes issues if constantize(nil) returns Object instead of raising an exception.

- No longer use Date#to_s for literalization, always use ISO8601 format for dates.

- A couple lambdas which were instance_evaled were changed to procs for ruby 1.9.2 compatibility.

- MSSQL emulated offset support was simplified to only use one subquery, and made to work correctly on ruby 1.9.

- Emulate multiple column IN/NOT IN on H2, since it doesn’t handle all cases correctly.

- ODBC timestamps are now handled correctly if the database_timezone is nil.

- ArgumentErrors raised when running queries in the ODBC adapter are now raised as DatabaseErrors.

- Attempting to use DISTINCT ON on SQLite now raises an error before sending the query to the database.

- The options hash passed to the database connection method is no longer modified. However, there may be additional options present in Database#opts that weren’t specified by the options hash passed to the database connection method.

- Make Dataset#add_graph_aliases handle the case where the dataset has not yet been graphed.

- You can now provide an SQL::Identifier as a 4th argument to Dataset#join_table, and unsupported arguments are caught and an exception is raised.

- The gem specification has been moved out of the Rakefile, so that the gem can now be built without rake, and works well with gem build and bundler.

- The Rakefile no longer assumes the current directory is in the $LOAD_PATH, so it should work correctly on ruby 1.9.2.

- All internal uses of require are now thread safe.

- Empty query parameter keys in connection strings are now ignored instead of raising an exception.

- The specs were changed so that you can run them in parallel. Previously there was a race condition in the migration extension specs.

Backwards Compatibility

- If you plan on using sharding at any point, you now must pass a :servers option when connecting to the database, even if it is an empty hash. You can no longer just call Database#add_servers later.

- The connection_proc and disconnection_proc accessors were removed from the connection pools, so you can no longer modify the procs after the connection pool has been instantiated. You must now provide the connection_proc as the block argument when instantiating the pool, and the disconnection_proc via the :disconnection_proc option.

- In the hash passed to Dataset#update, symbol keys with a double embedded underscore are now considerated as implicit qualifiers, instead of being used verbatim. If you have a column that includes a double underscore, you now need to wrap it in an SQL::Identifier or use a String instead.

- The connection pools no longer convert non-StandardError based exceptions to RuntimeErrors. Previously, all of the common adapters turned this feature off, so there is no change for most users.

- Sequel::ConnectionPool is now considered an abstract class and should not be instantiated directly. Use ConnectionPool.get_pool to return an instance of the appropriate subclass.

- The Sequel::SingleThreadedPool constant is no longer defined.

- The private Dataset#eager_unique_table_alias method was removed, use the new public Dataset#unused_table_alias method instead, which has a slightly different API.

- The private Dataset#eager_graph_qualify_order method was removed, used Dataset#qualified_expression instead.

- The private Sequel::Model class methods plugin_gem_location and plugin_gem_location_old have been removed.

- Gems built with the rake tasks now show up in the root directory instead of the pkg subdirectory, and no tarball package is created.

Other News

- Sequel now has an official blog at sequel.heroku.com.

[Validate]

Generated with the Darkfish Rdoc Generator 2.