Module: Sequel::SQL::Builders

### Home Classes Methods

### In Files

- lib/sequel/extensions/date_arithmetic.rb
- lib/sequel/extensions/pg_array.rb
- lib/sequel/extensions/pg_array_ops.rb
- lib/sequel/extensions/pg_hstore.rb
- lib/sequel/extensions/pg_hstore_ops.rb
- lib/sequel/extensions/pg_json.rb
- lib/sequel/extensions/pg_json_ops.rb
- lib/sequel/extensions/pg_range.rb
- lib/sequel/extensions/pg_range_ops.rb
- lib/sequel/extensions/pg_row.rb
- lib/sequel/extensions/pg_row_ops.rb
- lib/sequel/sql.rb

### Methods

- #as
- #asc
- #blob
- #case
- #cast
- #cast_numeric
- #cast_string
- #char_length
- #date_add
- #date_sub
- #deep_qualify
- #delay
- #desc
- #expr
- #extract
- #function
- #hstore
- #hstore_op
- #identifier
- #ilike
- #join
- #like
- #lit
- #negate
- #or
- #pg_array
- #pg_array_op
- #pg_json
- #pg_json_op
- #pg_jsonb
- #pg_jsonb_op
- #pg_range
- #pg_range_op
- #pg_row
- #pg_row_op
- #qualify
- #subscript
- #trim
- #value_list

### Files

- CHANGELOG
- MIT-LICENSE
- README.rdoc
- active_record.rdoc
- advanced_associations.rdoc
- association_basics.rdoc
- bin_sequel.rdoc
- cheat_sheet.rdoc
- code_order.rdoc
- core_extensions.rdoc
- dataset_basics.rdoc
- dataset_filtering.rdoc
- extensions.rdoc
- mass_assignment.rdoc
- migration.rdoc
- model_hooks.rdoc
- model_plugins.rdoc
- mssql_stored_procedures.rdoc
- object_model.rdoc
- opening_databases.rdoc
- postgresql.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.13.0.txt
- 3.14.0.txt
- 3.15.0.txt
- 3.16.0.txt
- 3.17.0.txt
- 3.18.0.txt
- 3.19.0.txt
- 3.2.0.txt
- 3.20.0.txt
- 3.21.0.txt
- 3.22.0.txt
- 3.23.0.txt
- 3.24.0.txt
- 3.25.0.txt
- 3.26.0.txt
- 3.27.0.txt
- 3.28.0.txt
- 3.29.0.txt
- 3.3.0.txt
- 3.30.0.txt
- 3.31.0.txt
- 3.32.0.txt
- 3.33.0.txt
- 3.34.0.txt
- 3.35.0.txt
- 3.36.0.txt
- 3.37.0.txt
- 3.38.0.txt
- 3.39.0.txt
- 3.4.0.txt
- 3.40.0.txt
- 3.41.0.txt
- 3.42.0.txt
- 3.43.0.txt
- 3.44.0.txt
- 3.45.0.txt
- 3.46.0.txt
- 3.47.0.txt
- 3.48.0.txt
- 3.5.0.txt
- 3.6.0.txt
- 3.7.0.txt
- 3.8.0.txt
- 3.9.0.txt
- 4.0.0.txt
- 4.1.0.txt
- 4.10.0.txt
- 4.11.0.txt
- 4.12.0.txt
- 4.13.0.txt
- 4.14.0.txt
- 4.15.0.txt
- 4.16.0.txt
- 4.17.0.txt
- 4.18.0.txt
- 4.19.0.txt
- 4.2.0.txt
- 4.20.0.txt
- 4.21.0.txt
- 4.22.0.txt
- 4.23.0.txt
- 4.3.0.txt
- 4.4.0.txt
- 4.5.0.txt
- 4.6.0.txt
- 4.7.0.txt
- 4.8.0.txt
- 4.9.0.txt
- schema_modification.rdoc
- security.rdoc
- sharding.rdoc
- sql.rdoc
- testing.rdoc
- thread_safety.rdoc
- transactions.rdoc
- validations.rdoc
- virtual_rows.rdoc

### Class/Module Index

Quicksearch

- Sequel
- Sequel::ADO
- Sequel::ADO::Access
- Sequel::ADO::Access::AdoSchema
- Sequel::ADO::Access::AdoSchema::Column
- Sequel::ADO::Access::DatabaseMethods
- Sequel::ADO::Access::Dataset
- Sequel::ADO::Database
- Sequel::ADO::Dataset
- Sequel::ADO::MSSQL
- Sequel::ADO::MSSQL::DatabaseMethods
- Sequel::ADO::MSSQL::Dataset
- Sequel::ASTTransformer
- Sequel::Access
- Sequel::Access::DatabaseMethods
- Sequel::Access::DatasetMethods
- Sequel::Amalgalite
- Sequel::Amalgalite::Database
- Sequel::Amalgalite::Dataset
- Sequel::Amalgalite::SequelTypeMap
- Sequel::ArbitraryServers
- Sequel::BasicObject
- Sequel::BeforeHookFailed
- Sequel::ColumnsIntrospection
- Sequel::ConnectionPool
- Sequel::ConnectionPool::ClassMethods
- Sequel::ConnectionValidator
- Sequel::ConnectionValidator::Retry
- Sequel::ConstraintValidations
- Sequel::ConstraintValidations::AlterTableGeneratorMethods
- Sequel::ConstraintValidations::CreateTableGeneratorMethods
- Sequel::ConstraintValidations::Generator
- Sequel::CoreRefinements
- Sequel::Cubrid
- Sequel::Cubrid::Database
- Sequel::Cubrid::DatabaseMethods
- Sequel::Cubrid::Dataset
- Sequel::Cubrid::DatasetMethods
- Sequel::CurrentDateTimeTimestamp
- Sequel::CurrentDateTimeTimestamp::DatasetMethods
- Sequel::CurrentDateTimeTimestamp::DateTime
- Sequel::CurrentDateTimeTimestamp::Time
- Sequel::DB2
- Sequel::DB2::DB2Error
- Sequel::DB2::Database
- Sequel::DB2::DatabaseMethods
- Sequel::DB2::Dataset
- Sequel::DB2::DatasetMethods
- 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::DatabaseMethods
- Sequel::DataObjects::SQLite
- Sequel::DataObjects::SQLite::DatabaseMethods
- Sequel::Database
- Sequel::Database::DatasetClass
- Sequel::Database::FromBlock
- Sequel::Database::ResetIdentifierMangling
- Sequel::Database::SplitAlterTable
- Sequel::DatabaseError
- Sequel::DatabaseQuery
- Sequel::Dataset
- Sequel::Dataset::ArgumentMapper
- Sequel::Dataset::DatasetSourceAlias
- Sequel::Dataset::NullDataset
- Sequel::Dataset::Nullifiable
- Sequel::Dataset::Pagination
- Sequel::Dataset::PlaceholderLiteralizer
- Sequel::Dataset::PlaceholderLiteralizer::Argument
- Sequel::Dataset::PlaceholderLiteralizer::Recorder
- Sequel::Dataset::PreparedStatementMethods
- Sequel::Dataset::Query
- Sequel::Dataset::Replace
- Sequel::Dataset::RoundTimestamps
- Sequel::Dataset::SplitArrayNil
- Sequel::Dataset::StoredProcedureMethods
- Sequel::Dataset::StoredProcedures
- Sequel::Dataset::UnnumberedArgumentMapper
- Sequel::DatasetPagination
- Sequel::DatasetPrinter
- Sequel::DatasetQuery
- Sequel::Deprecation
- Sequel::EmptyArrayIgnoreNulls
- Sequel::EmulateOffsetWithReverseAndCount
- Sequel::EmulateOffsetWithRowNumber
- Sequel::Error
- Sequel::ErrorSQL
- Sequel::EvalInspect
- Sequel::FilterHaving
- Sequel::Firebird
- Sequel::Firebird::Database
- Sequel::Firebird::DatabaseMethods
- Sequel::Firebird::Dataset
- Sequel::Firebird::DatasetMethods
- Sequel::GraphEach
- Sequel::HashAliases
- Sequel::HookFailed
- Sequel::IBMDB
- Sequel::IBMDB::Connection
- Sequel::IBMDB::Connection::Error
- Sequel::IBMDB::Database
- Sequel::IBMDB::Dataset
- Sequel::IBMDB::Dataset::CallableStatementMethods
- Sequel::IBMDB::Statement
- Sequel::Inflections
- Sequel::Informix
- Sequel::Informix::Database
- Sequel::Informix::DatabaseMethods
- Sequel::Informix::Dataset
- Sequel::Informix::DatasetMethods
- Sequel::IntegerMigrator
- Sequel::JDBC
- Sequel::JDBC::AS400
- Sequel::JDBC::AS400::DatabaseMethods
- Sequel::JDBC::AS400::Dataset
- Sequel::JDBC::Cubrid
- Sequel::JDBC::Cubrid::DatabaseMethods
- Sequel::JDBC::DB2
- Sequel::JDBC::DB2::DatabaseMethods
- Sequel::JDBC::DB2::Dataset
- Sequel::JDBC::Database
- Sequel::JDBC::Dataset
- Sequel::JDBC::Derby
- Sequel::JDBC::Derby::DatabaseMethods
- Sequel::JDBC::Derby::Dataset
- Sequel::JDBC::Firebird
- Sequel::JDBC::Firebird::DatabaseMethods
- Sequel::JDBC::H2
- Sequel::JDBC::H2::DatabaseMethods
- Sequel::JDBC::H2::Dataset
- Sequel::JDBC::HSQLDB
- Sequel::JDBC::HSQLDB::DatabaseMethods
- Sequel::JDBC::HSQLDB::Dataset
- Sequel::JDBC::Informix
- Sequel::JDBC::Informix::DatabaseMethods
- Sequel::JDBC::JTDS
- Sequel::JDBC::JTDS::DatabaseMethods
- Sequel::JDBC::JTDS::Dataset
- Sequel::JDBC::JavaLang
- Sequel::JDBC::JavaSQL
- Sequel::JDBC::JavaxNaming
- Sequel::JDBC::MSSQL
- Sequel::JDBC::MSSQL::DatabaseMethods
- Sequel::JDBC::MySQL
- Sequel::JDBC::MySQL::DatabaseMethods
- Sequel::JDBC::Oracle
- Sequel::JDBC::Oracle::DatabaseMethods
- Sequel::JDBC::Oracle::Dataset
- Sequel::JDBC::Postgres
- Sequel::JDBC::Postgres::DatabaseMethods
- Sequel::JDBC::Postgres::Dataset
- Sequel::JDBC::Progress
- Sequel::JDBC::Progress::DatabaseMethods
- Sequel::JDBC::SQLServer
- Sequel::JDBC::SQLServer::DatabaseMethods
- Sequel::JDBC::SQLServer::DatabaseMethods::MetadataDatasetMethods
- Sequel::JDBC::SQLite
- Sequel::JDBC::SQLite::DatabaseMethods
- Sequel::JDBC::SqlAnywhere
- Sequel::JDBC::SqlAnywhere::DatabaseMethods
- Sequel::JDBC::SqlAnywhere::Dataset
- Sequel::JDBC::Transactions
- Sequel::JDBC::TypeConvertor
- Sequel::LiteralString
- Sequel::LooserTypecasting
- Sequel::MSSQL
- Sequel::MSSQL::DatabaseMethods
- Sequel::MSSQL::DatasetMethods
- Sequel::MSSQL::EmulateLateralWithApply
- Sequel::Metaprogramming
- Sequel::Migration
- Sequel::MigrationAlterTableReverser
- Sequel::MigrationDSL
- Sequel::MigrationReverser
- Sequel::Migrator
- Sequel::Migrator::Error
- Sequel::Migrator::NotCurrentError
- Sequel::Mock
- Sequel::Mock::Connection
- Sequel::Mock::Database
- Sequel::Mock::Dataset
- Sequel::Model
- Sequel::Model::Associations
- Sequel::Model::Associations::AssociationDatasetMethods
- Sequel::Model::Associations::AssociationReflection
- Sequel::Model::Associations::ClassMethods
- Sequel::Model::Associations::DatasetMethods
- Sequel::Model::Associations::EagerGraphLoader
- Sequel::Model::Associations::InstanceMethods
- Sequel::Model::Associations::ManyToManyAssociationReflection
- Sequel::Model::Associations::ManyToOneAssociationReflection
- Sequel::Model::Associations::OneThroughOneAssociationReflection
- Sequel::Model::Associations::OneToManyAssociationReflection
- Sequel::Model::Associations::OneToOneAssociationReflection
- Sequel::Model::Associations::SingularAssociationReflection
- Sequel::Model::ClassMethods
- Sequel::Model::DatasetMethods
- Sequel::Model::DatasetModule
- Sequel::Model::Errors
- Sequel::Model::InstanceMethods
- Sequel::MySQL
- Sequel::MySQL::Database
- Sequel::MySQL::DatabaseMethods
- Sequel::MySQL::Dataset
- Sequel::MySQL::DatasetMethods
- Sequel::MySQL::PreparedStatements
- Sequel::MySQL::PreparedStatements::DatabaseMethods
- Sequel::MySQL::PreparedStatements::DatasetMethods
- Sequel::MySQL::PreparedStatements::DatasetMethods::CallableStatementMethods
- Sequel::Mysql2
- Sequel::Mysql2::Database
- Sequel::Mysql2::Dataset
- Sequel::NamedTimezones
- Sequel::NamedTimezones::DatabaseMethods
- Sequel::ODBC
- Sequel::ODBC::Database
- Sequel::ODBC::Dataset
- Sequel::ODBC::MSSQL
- Sequel::ODBC::MSSQL::DatabaseMethods
- Sequel::ODBC::MSSQL::Dataset
- Sequel::Oracle
- Sequel::Oracle::Database
- Sequel::Oracle::DatabaseMethods
- Sequel::Oracle::Dataset
- Sequel::Oracle::Dataset::ArgumentMapper
- Sequel::Oracle::DatasetMethods
- Sequel::Plugins
- Sequel::Plugins::AccessedColumns
- Sequel::Plugins::AccessedColumns::InstanceMethods
- Sequel::Plugins::ActiveModel
- Sequel::Plugins::ActiveModel::ClassMethods
- Sequel::Plugins::ActiveModel::Errors
- Sequel::Plugins::ActiveModel::InstanceMethods
- Sequel::Plugins::AfterInitialize
- Sequel::Plugins::AfterInitialize::ClassMethods
- Sequel::Plugins::AfterInitialize::InstanceMethods
- Sequel::Plugins::AssociationAutoreloading
- Sequel::Plugins::AssociationDependencies
- Sequel::Plugins::AssociationDependencies::ClassMethods
- Sequel::Plugins::AssociationDependencies::InstanceMethods
- Sequel::Plugins::AssociationPks
- Sequel::Plugins::AssociationPks::ClassMethods
- Sequel::Plugins::AssociationPks::InstanceMethods
- Sequel::Plugins::AssociationProxies
- Sequel::Plugins::AssociationProxies::AssociationProxy
- Sequel::Plugins::AssociationProxies::ClassMethods
- Sequel::Plugins::AutoValidations
- Sequel::Plugins::AutoValidations::ClassMethods
- Sequel::Plugins::AutoValidations::InstanceMethods
- Sequel::Plugins::BlacklistSecurity
- Sequel::Plugins::BlacklistSecurity::ClassMethods
- Sequel::Plugins::BlacklistSecurity::InstanceMethods
- Sequel::Plugins::BlacklistSecurity::InstanceMethods::ExceptionList
- 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::ColumnConflicts
- Sequel::Plugins::ColumnConflicts::ClassMethods
- Sequel::Plugins::ColumnConflicts::InstanceMethods
- Sequel::Plugins::ColumnSelect
- Sequel::Plugins::ColumnSelect::ClassMethods
- Sequel::Plugins::Composition
- Sequel::Plugins::Composition::ClassMethods
- Sequel::Plugins::Composition::InstanceMethods
- Sequel::Plugins::ConstraintValidations
- Sequel::Plugins::ConstraintValidations::ClassMethods
- Sequel::Plugins::ConstraintValidations::DatabaseMethods
- Sequel::Plugins::ConstraintValidations::InstanceMethods
- Sequel::Plugins::CsvSerializer
- Sequel::Plugins::CsvSerializer::ClassMethods
- Sequel::Plugins::CsvSerializer::DatasetMethods
- Sequel::Plugins::CsvSerializer::InstanceMethods
- Sequel::Plugins::DatasetAssociations
- Sequel::Plugins::DatasetAssociations::ClassMethods
- Sequel::Plugins::DatasetAssociations::DatasetMethods
- Sequel::Plugins::DefaultsSetter
- Sequel::Plugins::DefaultsSetter::ClassMethods
- Sequel::Plugins::DefaultsSetter::InstanceMethods
- Sequel::Plugins::DelayAddAssociation
- Sequel::Plugins::DelayAddAssociation::InstanceMethods
- Sequel::Plugins::Dirty
- Sequel::Plugins::Dirty::InstanceMethods
- Sequel::Plugins::EagerEach
- Sequel::Plugins::EagerEach::DatasetMethods
- Sequel::Plugins::ErrorSplitter
- Sequel::Plugins::ErrorSplitter::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::InputTransformer
- Sequel::Plugins::InputTransformer::ClassMethods
- Sequel::Plugins::InputTransformer::InstanceMethods
- Sequel::Plugins::InsertReturningSelect
- Sequel::Plugins::InsertReturningSelect::ClassMethods
- Sequel::Plugins::InsertReturningSelect::InstanceMethods
- Sequel::Plugins::InstanceFilters
- Sequel::Plugins::InstanceFilters::InstanceMethods
- Sequel::Plugins::InstanceHooks
- Sequel::Plugins::InstanceHooks::InstanceMethods
- Sequel::Plugins::JsonSerializer
- Sequel::Plugins::JsonSerializer::ClassMethods
- Sequel::Plugins::JsonSerializer::DatasetMethods
- Sequel::Plugins::JsonSerializer::InstanceMethods
- Sequel::Plugins::JsonSerializer::Literal
- Sequel::Plugins::LazyAttributes
- Sequel::Plugins::LazyAttributes::ClassMethods
- Sequel::Plugins::LazyAttributes::InstanceMethods
- Sequel::Plugins::List
- Sequel::Plugins::List::ClassMethods
- Sequel::Plugins::List::InstanceMethods
- Sequel::Plugins::ManyThroughMany
- Sequel::Plugins::ManyThroughMany::ClassMethods
- Sequel::Plugins::ManyThroughMany::DatasetMethods
- Sequel::Plugins::ManyThroughMany::ManyThroughManyAssociationReflection
- Sequel::Plugins::ManyThroughMany::OneThroughManyAssociationReflection
- Sequel::Plugins::ManyToOnePkLookup
- Sequel::Plugins::ModificationDetection
- Sequel::Plugins::ModificationDetection::ClassMethods
- Sequel::Plugins::ModificationDetection::InstanceMethods
- Sequel::Plugins::MssqlOptimisticLocking
- Sequel::Plugins::MssqlOptimisticLocking::ClassMethods
- Sequel::Plugins::MssqlOptimisticLocking::InstanceMethods
- Sequel::Plugins::NestedAttributes
- Sequel::Plugins::NestedAttributes::ClassMethods
- Sequel::Plugins::NestedAttributes::InstanceMethods
- Sequel::Plugins::OptimisticLocking
- Sequel::Plugins::OptimisticLocking::ClassMethods
- Sequel::Plugins::OptimisticLocking::InstanceMethods
- Sequel::Plugins::PgArrayAssociations
- Sequel::Plugins::PgArrayAssociations::ClassMethods
- Sequel::Plugins::PgArrayAssociations::DatasetMethods
- Sequel::Plugins::PgArrayAssociations::ManyToPgArrayAssociationReflection
- Sequel::Plugins::PgArrayAssociations::PgArrayToManyAssociationReflection
- Sequel::Plugins::PgRow
- Sequel::Plugins::PgRow::ClassMethods
- Sequel::Plugins::PgRow::DatabaseMethods
- Sequel::Plugins::PgRow::InstanceMethods
- Sequel::Plugins::PgTypecastOnLoad
- Sequel::Plugins::PgTypecastOnLoad::ClassMethods
- Sequel::Plugins::PgTypecastOnLoad::InstanceMethods
- Sequel::Plugins::PreparedStatements
- Sequel::Plugins::PreparedStatements::ClassMethods
- Sequel::Plugins::PreparedStatements::InstanceMethods
- Sequel::Plugins::PreparedStatementsAssociations
- Sequel::Plugins::PreparedStatementsAssociations::InstanceMethods
- Sequel::Plugins::PreparedStatementsSafe
- Sequel::Plugins::PreparedStatementsSafe::ClassMethods
- Sequel::Plugins::PreparedStatementsSafe::InstanceMethods
- Sequel::Plugins::PreparedStatementsWithPk
- Sequel::Plugins::PreparedStatementsWithPk::ClassMethods
- Sequel::Plugins::PreparedStatementsWithPk::DatasetMethods
- Sequel::Plugins::RcteTree
- Sequel::Plugins::Schema
- Sequel::Plugins::Schema::ClassMethods
- Sequel::Plugins::Scissors
- Sequel::Plugins::Scissors::ClassMethods
- Sequel::Plugins::Serialization
- Sequel::Plugins::Serialization::ClassMethods
- Sequel::Plugins::Serialization::InstanceMethods
- Sequel::Plugins::SerializationModificationDetection
- Sequel::Plugins::SerializationModificationDetection::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::SplitValues
- Sequel::Plugins::SplitValues::ClassMethods
- Sequel::Plugins::SplitValues::InstanceMethods
- Sequel::Plugins::StaticCache
- Sequel::Plugins::StaticCache::ClassMethods
- Sequel::Plugins::StaticCache::InstanceMethods
- Sequel::Plugins::StringStripper
- Sequel::Plugins::StringStripper::ClassMethods
- Sequel::Plugins::Subclasses
- Sequel::Plugins::Subclasses::ClassMethods
- Sequel::Plugins::TableSelect
- Sequel::Plugins::TableSelect::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::Tree
- Sequel::Plugins::Tree::ClassMethods
- Sequel::Plugins::Tree::InstanceMethods
- Sequel::Plugins::Tree::SingleRoot
- Sequel::Plugins::Tree::SingleRoot::ClassMethods
- Sequel::Plugins::Tree::SingleRoot::InstanceMethods
- Sequel::Plugins::Tree::TreeMultipleRootError
- Sequel::Plugins::TypecastOnLoad
- Sequel::Plugins::TypecastOnLoad::ClassMethods
- Sequel::Plugins::TypecastOnLoad::InstanceMethods
- Sequel::Plugins::UnlimitedUpdate
- Sequel::Plugins::UnlimitedUpdate::InstanceMethods
- Sequel::Plugins::UpdateOrCreate
- Sequel::Plugins::UpdateOrCreate::ClassMethods
- Sequel::Plugins::UpdatePrimaryKey
- Sequel::Plugins::UpdatePrimaryKey::InstanceMethods
- Sequel::Plugins::UpdateRefresh
- Sequel::Plugins::UpdateRefresh::InstanceMethods
- Sequel::Plugins::ValidateAssociated
- Sequel::Plugins::ValidateAssociated::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::Plugins::XmlSerializer
- Sequel::Plugins::XmlSerializer::ClassMethods
- Sequel::Plugins::XmlSerializer::DatasetMethods
- Sequel::Plugins::XmlSerializer::InstanceMethods
- Sequel::Postgres
- Sequel::Postgres::Adapter
- Sequel::Postgres::AlterTableGenerator
- Sequel::Postgres::ArrayOp
- Sequel::Postgres::ArrayOpMethods
- Sequel::Postgres::CreateTableGenerator
- Sequel::Postgres::Database
- Sequel::Postgres::DatabaseMethods
- Sequel::Postgres::Dataset
- Sequel::Postgres::Dataset::ArgumentMapper
- Sequel::Postgres::DatasetMethods
- Sequel::Postgres::DatasetMethods::PreparedStatementMethods
- Sequel::Postgres::EnumDatabaseMethods
- Sequel::Postgres::ExclusionConstraintViolation
- Sequel::Postgres::HStore
- Sequel::Postgres::HStore::DatabaseMethods
- Sequel::Postgres::HStore::Parser
- Sequel::Postgres::HStoreOp
- Sequel::Postgres::HStoreOpMethods
- Sequel::Postgres::InetDatabaseMethods
- Sequel::Postgres::InetDatasetMethods
- Sequel::Postgres::IntervalDatabaseMethods
- Sequel::Postgres::IntervalDatabaseMethods::Parser
- Sequel::Postgres::IntervalDatasetMethods
- Sequel::Postgres::JSONArray
- Sequel::Postgres::JSONArrayBase
- Sequel::Postgres::JSONBArray
- Sequel::Postgres::JSONBHash
- Sequel::Postgres::JSONBOp
- Sequel::Postgres::JSONBaseOp
- Sequel::Postgres::JSONDatabaseMethods
- Sequel::Postgres::JSONHash
- Sequel::Postgres::JSONHashBase
- Sequel::Postgres::JSONOp
- Sequel::Postgres::JSONOpMethods
- Sequel::Postgres::LooseCount
- Sequel::Postgres::PGArray
- Sequel::Postgres::PGArray::Creator
- Sequel::Postgres::PGArray::DatabaseMethods
- Sequel::Postgres::PGArray::JSONCreator
- Sequel::Postgres::PGArray::Parser
- Sequel::Postgres::PGRange
- Sequel::Postgres::PGRange::DatabaseMethods
- Sequel::Postgres::PGRange::DatasetMethods
- Sequel::Postgres::PGRange::Parser
- Sequel::Postgres::PGRow
- Sequel::Postgres::PGRow::ArrayRow
- Sequel::Postgres::PGRow::DatabaseMethods
- Sequel::Postgres::PGRow::HashRow
- Sequel::Postgres::PGRow::Parser
- Sequel::Postgres::PGRow::Splitter
- Sequel::Postgres::PGRowOp
- Sequel::Postgres::PGRowOp::ExpressionMethods
- Sequel::Postgres::RangeOp
- Sequel::Postgres::RangeOpMethods
- Sequel::Postgres::StaticCacheUpdater
- Sequel::PrettyTable
- Sequel::Progress
- Sequel::Progress::DatabaseMethods
- Sequel::Progress::DatasetMethods
- Sequel::Qualifier
- Sequel::QueryLiterals
- 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::Builders
- 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::DateAdd
- Sequel::SQL::DateAdd::DatasetMethods
- Sequel::SQL::DelayedEvaluation
- Sequel::SQL::Expression
- Sequel::SQL::Function
- Sequel::SQL::GenericExpression
- Sequel::SQL::Identifier
- Sequel::SQL::InequalityMethods
- Sequel::SQL::JoinClause
- Sequel::SQL::JoinOnClause
- Sequel::SQL::JoinUsingClause
- Sequel::SQL::NegativeBooleanConstant
- Sequel::SQL::NumericExpression
- Sequel::SQL::NumericMethods
- Sequel::SQL::OperatorBuilders
- Sequel::SQL::OrderMethods
- Sequel::SQL::OrderedExpression
- Sequel::SQL::PatternMatchMethods
- Sequel::SQL::PlaceholderLiteralString
- Sequel::SQL::QualifiedIdentifier
- Sequel::SQL::QualifyingMethods
- Sequel::SQL::StringConcatenationMethods
- Sequel::SQL::StringExpression
- Sequel::SQL::StringMethods
- Sequel::SQL::Subscript
- Sequel::SQL::SubscriptMethods
- Sequel::SQL::ValueList
- Sequel::SQL::VirtualRow
- Sequel::SQL::Window
- Sequel::SQL::Wrapper
- Sequel::SQLTime
- Sequel::SQLite
- Sequel::SQLite::Database
- Sequel::SQLite::DatabaseMethods
- Sequel::SQLite::Dataset
- Sequel::SQLite::Dataset::ArgumentMapper
- Sequel::SQLite::DatasetMethods
- Sequel::Schema
- Sequel::Schema::AlterTableGenerator
- Sequel::Schema::CreateTableGenerator
- Sequel::Schema::Generator
- Sequel::SchemaCaching
- Sequel::SchemaDumper
- Sequel::SelectRemove
- Sequel::Sequel3DatasetMethods
- Sequel::ServerBlock
- Sequel::SetOverrides
- Sequel::ShardedSingleConnectionPool
- Sequel::ShardedThreadedConnectionPool
- Sequel::SimpleMigration
- Sequel::SingleConnectionPool
- Sequel::SqlAnywhere
- Sequel::SqlAnywhere::Database
- Sequel::SqlAnywhere::DatabaseMethods
- Sequel::SqlAnywhere::Dataset
- Sequel::SqlAnywhere::DatasetMethods
- Sequel::SqlAnywhere::SQLAnywhereException
- Sequel::Swift
- Sequel::Swift::Database
- Sequel::Swift::Dataset
- Sequel::Swift::MySQL
- Sequel::Swift::MySQL::DatabaseMethods
- Sequel::Swift::MySQL::Dataset
- Sequel::Swift::Postgres
- Sequel::Swift::Postgres::DatabaseMethods
- Sequel::Swift::SQLite
- Sequel::Swift::SQLite::DatabaseMethods
- Sequel::Swift::SQLite::Dataset
- Sequel::ThreadLocalTimezones
- Sequel::ThreadedConnectionPool
- Sequel::ThreadedServerBlock
- Sequel::TimestampMigrator
- Sequel::Timezones
- Sequel::TinyTDS
- Sequel::TinyTDS::Database
- Sequel::TinyTDS::Dataset
- Sequel::TinyTDS::Dataset::ArgumentMapper
- Sequel::ToDot
- Sequel::ToDot::DatasetMethods
- Sequel::Unbinder
- Sequel::UnthreadedServerBlock
- Sequel::ValidationFailed
- String
- String::Inflections
- Array
- FalseClass
- Hash
- NilClass
- Numeric
- Object
- PGconn
- PGresult
- Range
- Symbol
- TrueClass

No matching classes.

# Sequel::SQL::Builders

These methods are designed as replacements for the core extensions, so that Sequel is still easy to use if the core extensions are not enabled.

### Public Instance Methods

as(exp, aliaz, columns=nil) click to toggle source

Create an SQL::AliasedExpression for the given expression and alias.

    Sequel.as(:column, :alias) # "column" AS "alias"
    Sequel.as(:column, :alias, [:col_alias1, :col_alias2]) # "column" AS "alias"("col_alias1", "col_alias2")

    # File lib/sequel/sql.rb, line 325
    def as(exp, aliaz, columns=nil)
      SQL::AliasedExpression.new(exp, aliaz, columns)
    end

asc(arg, opts=OPTS) click to toggle source

Order the given argument ascending. Options:

:nulls | Set to :first to use NULLS FIRST (so NULL values are ordered before other values), or :last to use NULLS LAST (so NULL values are ordered after other values).

    Sequel.asc(:a) # a ASC
    Sequel.asc(:b, :nulls=>:last) # b ASC NULLS LAST

    # File lib/sequel/sql.rb, line 338
    def asc(arg, opts=OPTS)
      SQL::OrderedExpression.new(arg, false, opts)
    end

blob(s) click to toggle source

Return an `SQL::Blob` that holds the same data as this string. Blobs provide proper escaping of binary data. If given a blob, returns it directly.

    # File lib/sequel/sql.rb, line 345
    def blob(s)
      if s.is_a?(SQL::Blob)
        s
      else
        SQL::Blob.new(s)
      end
    end

case(*args) click to toggle source

Return an `SQL::CaseExpression` created with the given arguments.

    Sequel.case([[{:a=>[2,3]}, 1]], 0) # SQL: CASE WHEN a IN (2, 3) THEN 1 ELSE 0 END
    Sequel.case({:a=>1}, 0, :b) # SQL: CASE b WHEN a THEN 1 ELSE 0 END

    # File lib/sequel/sql.rb, line 357
    def case(*args) # core_sql ignore
      SQL::CaseExpression.new(*args)
    end

cast(arg, sql_type) click to toggle source

Cast the reciever to the given SQL type. You can specify a ruby class as a type, and it is handled similarly to using a database independent type in the schema methods.

    Sequel.cast(:a, :integer) # CAST(a AS integer)
    Sequel.cast(:a, String) # CAST(a AS varchar(255))

    # File lib/sequel/sql.rb, line 366
    def cast(arg, sql_type)
      SQL::Cast.new(arg, sql_type)
    end

cast_numeric(arg, sql_type = nil) click to toggle source

Cast the reciever to the given SQL type (or the database's default Integer type if none given), and return the result as a `NumericExpression`, so you can use the bitwise operators on the result.

    Sequel.cast_numeric(:a) # CAST(a AS integer)
    Sequel.cast_numeric(:a, Float) # CAST(a AS double precision)

    # File lib/sequel/sql.rb, line 376
    def cast_numeric(arg, sql_type = nil)
      cast(arg, sql_type || Integer).sql_number
    end

cast_string(arg, sql_type = nil) click to toggle source

Cast the reciever to the given SQL type (or the database's default String type if none given), and return the result as a `StringExpression`, so you can use + directly on the result for SQL string concatenation.

    Sequel.cast_string(:a) # CAST(a AS varchar(255))
    Sequel.cast_string(:a, :text) # CAST(a AS text)

    # File lib/sequel/sql.rb, line 386
    def cast_string(arg, sql_type = nil)
      cast(arg, sql_type || String).sql_string
    end

char_length(arg) click to toggle source

Return an emulated function call for getting the number of characters in the argument:

    Sequel.char_length(:a) # char_length(a) -- Most databases
    Sequel.char_length(:a) # length(a) -- SQLite

    # File lib/sequel/sql.rb, line 395
    def char_length(arg)
      SQL::Function.new!(:char_length, [arg], :emulate=>true)
    end

date_add(expr, interval) click to toggle source

Return a DateAdd expression, adding an interval to the date/timestamp expr.

    # File lib/sequel/extensions/date_arithmetic.rb, line 32
    def date_add(expr, interval)
      DateAdd.new(expr, interval)
    end

date_sub(expr, interval) click to toggle source

Return a DateAdd expression, adding the negative of the interval to the date/timestamp expr.

    # File lib/sequel/extensions/date_arithmetic.rb, line 38
    def date_sub(expr, interval)
      interval = if interval.is_a?(Hash)
        h = {}
        interval.each{|k,v| h[k] = -v unless v.nil?}
        h
      else
        -interval
      end
      DateAdd.new(expr, interval)
    end

deep_qualify(qualifier, expr) click to toggle source

Do a deep qualification of the argument using the qualifier. This recurses into nested structures.

    Sequel.deep_qualify(:table, :column) # "table"."column"
    Sequel.deep_qualify(:table, Sequel.+(:column, 1)) # "table"."column" + 1
    Sequel.deep_qualify(:table, Sequel.like(:a, 'b')) # "table"."a" LIKE 'b' ESCAPE '\'

    # File lib/sequel/sql.rb, line 405
    def deep_qualify(qualifier, expr)
      Sequel::Qualifier.new(Sequel, qualifier).transform(expr)
    end

delay(&block) click to toggle source

Return a delayed evaluation that uses the passed block. This is used to delay evaluations of the code to runtime. For example, with the following code:

    ds = DB[:table].where{column > Time.now}

The filter is fixed to the time that where was called. Unless you are only using the dataset once immediately after creating it, that's probably not desired. If you just want to set it to the time when the query is sent to the database, you can wrap it in Sequel.delay:

    ds = DB[:table].where{column > Sequel.delay{Time.now}}

Note that for dates and timestamps, you are probably better off using Sequel::CURRENT_DATE and Sequel::CURRENT_TIMESTAMP instead of this generic delayed evaluation facility.

    # File lib/sequel/sql.rb, line 425
    def delay(&block)
      raise(Error, "Sequel.delay requires a block") unless block
      SQL::DelayedEvaluation.new(block)
    end

desc(arg, opts=OPTS) click to toggle source

Order the given argument descending. Options:

:nulls | Set to :first to use NULLS FIRST (so NULL values are ordered before other values), or :last to use NULLS LAST (so NULL values are ordered after other values).

    Sequel.desc(:a) # b DESC
    Sequel.desc(:b, :nulls=>:first) # b DESC NULLS FIRST

    # File lib/sequel/sql.rb, line 439
    def desc(arg, opts=OPTS)
      SQL::OrderedExpression.new(arg, true, opts)
    end

expr(arg=(no_arg=true), &block) click to toggle source

Wraps the given object in an appropriate Sequel wrapper. If the given object is already a Sequel object, return it directly. For condition specifiers (hashes and arrays of two pairs), true, and false, return a boolean expressions. For numeric objects, return a numeric expression. For strings, return a string expression. For procs or when the method is passed a block, evaluate it as a virtual row and wrap it appropriately. In all other cases, use a generic wrapper.

This method allows you to construct SQL expressions that are difficult to construct via other methods. For example:

    Sequel.expr(1) - :a # SQL: (1 - a)

    # File lib/sequel/sql.rb, line 455
    def expr(arg=(no_arg=true), &block)
      if block_given?
        if no_arg
          return expr(block)
        else
          raise Error, 'cannot provide both an argument and a block to Sequel.expr'
        end
      elsif no_arg
        raise Error, 'must provide either an argument or a block to Sequel.expr'
      end

      case arg
      when Symbol
        t, c, a = Sequel.split_symbol(arg)

        arg = if t
          SQL::QualifiedIdentifier.new(t, c)
        else
          SQL::Identifier.new(c)
        end

        if a
          arg = SQL::AliasedExpression.new(arg, a)
        end

        arg
      when SQL::Expression, LiteralString, SQL::Blob
        arg
      when Hash
        SQL::BooleanExpression.from_value_pairs(arg, :AND)
      when Array
        if condition_specifier?(arg)
          SQL::BooleanExpression.from_value_pairs(arg, :AND)
        else
          SQL::Wrapper.new(arg)
        end
      when Numeric
        SQL::NumericExpression.new(:NOOP, arg)
      when String
        SQL::StringExpression.new(:NOOP, arg)
      when TrueClass, FalseClass
        SQL::BooleanExpression.new(:NOOP, arg)
      when Proc
        expr(virtual_row(&arg))
      else
        SQL::Wrapper.new(arg)
      end
    end

extract(datetime_part, exp) click to toggle source

Extract a datetime_part (e.g. year, month) from the given expression:

    Sequel.extract(:year, :date) # extract(year FROM "date")

    # File lib/sequel/sql.rb, line 508
    def extract(datetime_part, exp)
      SQL::NumericExpression.new(:extract, datetime_part, exp)
    end

function(name, *args) click to toggle source

Returns a `Sequel::SQL::Function` with the function name and the given arguments.

    Sequel.function(:now) # SQL: now()
    Sequel.function(:substr, :a, 1) # SQL: substr(a, 1)

    # File lib/sequel/sql.rb, line 517
    def function(name, *args)
      SQL::Function.new(name, *args)
    end

hstore(v) click to toggle source

Return a Postgres::HStore proxy for the given hash.

    # File lib/sequel/extensions/pg_hstore.rb, line 317
    def hstore(v)
      case v
      when Postgres::HStore
        v
      when Hash
        Postgres::HStore.new(v)
      else
        # May not be defined unless the pg_hstore_ops extension is used
        hstore_op(v)
      end
    end

hstore_op(v) click to toggle source

Return the object wrapped in an Postgres::HStoreOp.

    # File lib/sequel/extensions/pg_hstore_ops.rb, line 324
    def hstore_op(v)
      case v
      when Postgres::HStoreOp
        v
      else
        Postgres::HStoreOp.new(v)
      end
    end

identifier(name) click to toggle source

Return the argument wrapped as an `SQL::Identifier`.

    Sequel.identifier(:a__b) # "a__b"

    # File lib/sequel/sql.rb, line 524
    def identifier(name)
      SQL::Identifier.new(name)
    end

ilike(*args) click to toggle source

Create a `BooleanExpression` case insensitive (if the database supports it) pattern match of the receiver with the given patterns. See `SQL::StringExpression.like`.

    Sequel.ilike(:a, 'A%') # "a" ILIKE 'A%' ESCAPE '\'

    # File lib/sequel/sql.rb, line 561
    def ilike(*args)
      SQL::StringExpression.like(*(args << {:case_insensitive=>true}))
    end

join(args, joiner=nil) click to toggle source

Return a `Sequel::SQL::StringExpression` representing an SQL string made up of the concatenation of the given array's elements. If an argument is passed, it is used in between each element of the array in the SQL concatenation.

    Sequel.join([:a]) # SQL: a
    Sequel.join([:a, :b]) # SQL: a || b
    Sequel.join([:a, 'b']) # SQL: a || 'b'
    Sequel.join(['a', :b], ' ') # SQL: 'a' || ' ' || b

    # File lib/sequel/sql.rb, line 537
    def join(args, joiner=nil)
      raise Error, 'argument to Sequel.join must be an array' unless args.is_a?(Array)
      if joiner
        args = args.zip([joiner]*args.length).flatten
        args.pop
      end

      return SQL::StringExpression.new(:NOOP, '') if args.empty?

      args = args.map do |a|
        case a
        when Symbol, ::Sequel::SQL::Expression, ::Sequel::LiteralString, TrueClass, FalseClass, NilClass
          a
        else
          a.to_s
        end
      end
      SQL::StringExpression.new(:'||', *args)
    end

like(*args) click to toggle source

Create a `SQL::BooleanExpression` case sensitive (if the database supports it) pattern match of the receiver with the given patterns. See `SQL::StringExpression.like`.

    Sequel.like(:a, 'A%') # "a" LIKE 'A%' ESCAPE '\'

    # File lib/sequel/sql.rb, line 569
    def like(*args)
      SQL::StringExpression.like(*args)
    end

lit(s, *args) click to toggle source

Converts a string into a `Sequel::LiteralString`, in order to override string literalization, e.g.:

    DB[:items].filter(:abc => 'def').sql #=>
      "SELECT * FROM items WHERE (abc = 'def')"

    DB[:items].filter(:abc => Sequel.lit('def')).sql #=>
      "SELECT * FROM items WHERE (abc = def)"

You can also provide arguments, to create a `Sequel::SQL::PlaceholderLiteralString`:

    DB[:items].select{|o| o.count(Sequel.lit('DISTINCT ?', :a))}.sql #=>
      "SELECT count(DISTINCT a) FROM items"

    # File lib/sequel/sql.rb, line 586
    def lit(s, *args) # core_sql ignore
      if args.empty?
        if s.is_a?(LiteralString)
          s
        else
          LiteralString.new(s)
        end
      else
        SQL::PlaceholderLiteralString.new(s, args)
      end
    end

negate(arg) click to toggle source

Return a `Sequel::SQL::BooleanExpression` created from the condition specifier, matching none of the conditions.

    Sequel.negate(:a=>true) # SQL: a IS NOT TRUE
    Sequel.negate([[:a, true]]) # SQL: a IS NOT TRUE
    Sequel.negate([[:a, 1], [:b, 2]]) # SQL: ((a != 1) AND (b != 2))

    # File lib/sequel/sql.rb, line 604
    def negate(arg)
      if condition_specifier?(arg)
        SQL::BooleanExpression.from_value_pairs(arg, :AND, true)
      else
        raise Error, 'must pass a conditions specifier to Sequel.negate'
      end
    end

or(arg) click to toggle source

Return a `Sequel::SQL::BooleanExpression` created from the condition specifier, matching any of the conditions.

    Sequel.or(:a=>true) # SQL: a IS TRUE
    Sequel.or([[:a, true]]) # SQL: a IS TRUE
    Sequel.or([[:a, 1], [:b, 2]]) # SQL: ((a = 1) OR (b = 2))

    # File lib/sequel/sql.rb, line 618
    def or(arg)
      if condition_specifier?(arg)
        SQL::BooleanExpression.from_value_pairs(arg, :OR, false)
      else
        raise Error, 'must pass a conditions specifier to Sequel.or'
      end
    end

pg_array(v, array_type=nil) click to toggle source

Return a Postgres::PGArray proxy for the given array and database array type.

    # File lib/sequel/extensions/pg_array.rb, line 573
    def pg_array(v, array_type=nil)
      case v
      when Postgres::PGArray
        if array_type.nil? || v.array_type == array_type
          v
        else
          Postgres::PGArray.new(v.to_a, array_type)
        end
      when Array
        Postgres::PGArray.new(v, array_type)
      else
        # May not be defined unless the pg_array_ops extension is used
        pg_array_op(v)
      end
    end

pg_array_op(v) click to toggle source

Return the object wrapped in an Postgres::ArrayOp.

    # File lib/sequel/extensions/pg_array_ops.rb, line 291
    def pg_array_op(v)
      case v
      when Postgres::ArrayOp
        v
      else
        Postgres::ArrayOp.new(v)
      end
    end

pg_json(v) click to toggle source

Wrap the array or hash in a Postgres::JSONArray or Postgres::JSONHash.

    # File lib/sequel/extensions/pg_json.rb, line 268
    def pg_json(v)
      case v
      when Postgres::JSONArray, Postgres::JSONHash
        v
      when Array
        Postgres::JSONArray.new(v)
      when Hash
        Postgres::JSONHash.new(v)
      when Postgres::JSONBArray
        Postgres::JSONArray.new(v.to_a)
      when Postgres::JSONBHash
        Postgres::JSONHash.new(v.to_hash)
      else
        Sequel.pg_json_op(v)
      end
    end

pg_json_op(v) click to toggle source

Return the object wrapped in an Postgres::JSONOp.

    # File lib/sequel/extensions/pg_json_ops.rb, line 391
    def pg_json_op(v)
      case v
      when Postgres::JSONOp
        v
      else
        Postgres::JSONOp.new(v)
      end
    end

pg_jsonb(v) click to toggle source

Wrap the array or hash in a Postgres::JSONBArray or Postgres::JSONBHash.

    # File lib/sequel/extensions/pg_json.rb, line 286
    def pg_jsonb(v)
      case v
      when Postgres::JSONBArray, Postgres::JSONBHash
        v
      when Array
        Postgres::JSONBArray.new(v)
      when Hash
        Postgres::JSONBHash.new(v)
      when Postgres::JSONArray
        Postgres::JSONBArray.new(v.to_a)
      when Postgres::JSONHash
        Postgres::JSONBHash.new(v.to_hash)
      else
        Sequel.pg_jsonb_op(v)
      end
    end

pg_jsonb_op(v) click to toggle source

Return the object wrapped in an Postgres::JSONBOp.

    # File lib/sequel/extensions/pg_json_ops.rb, line 401
    def pg_jsonb_op(v)
      case v
      when Postgres::JSONBOp
        v
      else
        Postgres::JSONBOp.new(v)
      end
    end

pg_range(v, db_type=nil) click to toggle source

Convert the object to a Postgres::PGRange.

    # File lib/sequel/extensions/pg_range.rb, line 506
    def pg_range(v, db_type=nil)
      case v
      when Postgres::PGRange
        if db_type.nil? || v.db_type == db_type
          v
        else
          Postgres::PGRange.new(v.begin, v.end, :exclude_begin=>v.exclude_begin?, :exclude_end=>v.exclude_end?, :db_type=>db_type)
        end
      when Range
        Postgres::PGRange.from_range(v, db_type)
      else
        # May not be defined unless the pg_range_ops extension is used
        pg_range_op(v)
      end
    end

pg_range_op(v) click to toggle source

Return the expression wrapped in the Postgres::RangeOp.

    # File lib/sequel/extensions/pg_range_ops.rb, line 129
    def pg_range_op(v)
      case v
      when Postgres::RangeOp
        v
      else
        Postgres::RangeOp.new(v)
      end
    end

pg_row(expr) click to toggle source

Wraps the expr array in an anonymous Postgres::PGRow::ArrayRow instance.

    # File lib/sequel/extensions/pg_row.rb, line 582
    def pg_row(expr)
      case expr
      when Array
        Postgres::PGRow::ArrayRow.new(expr)
      else
        # Will only work if pg_row_ops extension is loaded
        pg_row_op(expr)
      end
    end

pg_row_op(expr) click to toggle source

Return a PGRowOp wrapping the given expression.

    # File lib/sequel/extensions/pg_row_ops.rb, line 166
    def pg_row_op(expr)
      Postgres::PGRowOp.wrap(expr)
    end

qualify(qualifier, identifier) click to toggle source

Create a qualified identifier with the given qualifier and identifier

    Sequel.qualify(:table, :column) # "table"."column"
    Sequel.qualify(:schema, :table) # "schema"."table"
    Sequel.qualify(:table, :column).qualify(:schema) # "schema"."table"."column"

    # File lib/sequel/sql.rb, line 631
    def qualify(qualifier, identifier)
      SQL::QualifiedIdentifier.new(qualifier, identifier)
    end

subscript(exp, *subs) click to toggle source

Return an `SQL::Subscript` with the given arguments, representing an SQL array access.

    Sequel.subscript(:array, 1) # array[1]
    Sequel.subscript(:array, 1, 2) # array[1, 2]
    Sequel.subscript(:array, [1, 2]) # array[1, 2]
    Sequel.subscript(:array, 1..2) # array[1:2]
    Sequel.subscript(:array, 1...3) # array[1:2]

    # File lib/sequel/sql.rb, line 643
    def subscript(exp, *subs)
      SQL::Subscript.new(exp, subs.flatten)
    end

trim(arg) click to toggle source

Return an emulated function call for trimming a string of spaces from both sides (similar to ruby's String#strip).

    Sequel.trim(:a) # trim(a) -- Most databases
    Sequel.trim(:a) # ltrim(rtrim(a)) -- Microsoft SQL Server

    # File lib/sequel/sql.rb, line 652
    def trim(arg)
      SQL::Function.new!(:trim, [arg], :emulate=>true)
    end

value_list(arg) click to toggle source

Return a `SQL::ValueList` created from the given array. Used if the array contains all two element arrays and you want it treated as an SQL value list (IN predicate) instead of as a conditions specifier (similar to a hash). This is not necessary if you are using this array as a value in a filter, but may be necessary if you are using it as a value with placeholder SQL:

    DB[:a].filter([:a, :b]=>[[1, 2], [3, 4]]) # SQL: (a, b) IN ((1, 2), (3, 4))
    DB[:a].filter('(a, b) IN ?', [[1, 2], [3, 4]]) # SQL: (a, b) IN ((1 = 2) AND (3 = 4))
    DB[:a].filter('(a, b) IN ?', Sequel.value_list([[1, 2], [3, 4]])) # SQL: (a, b) IN ((1, 2), (3, 4))

    # File lib/sequel/sql.rb, line 665
    def value_list(arg)
      raise Error, 'argument to Sequel.value_list must be an array' unless arg.is_a?(Array)
      SQL::ValueList.new(arg)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.