Class: Arel::InsertManager

### Home Classes Methods

### In Files

- lib/arel/insert_manager.rb

### Parent

Arel::TreeManager

### Methods

- ::new
- #columns
- #create_values
- #insert
- #into
- #values=

### Files

- History.txt
- MIT-LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Arel
- Arel::AliasPredication
- Arel::Attributes
- Arel::Attributes::Attribute
- Arel::Attributes::Boolean
- Arel::Attributes::Decimal
- Arel::Attributes::Float
- Arel::Attributes::Integer
- Arel::Attributes::String
- Arel::Attributes::Time
- Arel::Attributes::Undefined
- Arel::Crud
- Arel::DeleteManager
- Arel::Expression
- Arel::Expressions
- Arel::FactoryMethods
- Arel::InsertManager
- Arel::Math
- Arel::Nodes
- Arel::Nodes::Addition
- Arel::Nodes::And
- Arel::Nodes::Ascending
- Arel::Nodes::Binary
- Arel::Nodes::BindParam
- Arel::Nodes::Count
- Arel::Nodes::CurrentRow
- Arel::Nodes::DeleteStatement
- Arel::Nodes::Descending
- Arel::Nodes::Distinct
- Arel::Nodes::Division
- Arel::Nodes::Equality
- Arel::Nodes::Extract
- Arel::Nodes::False
- Arel::Nodes::Following
- Arel::Nodes::Function
- Arel::Nodes::In
- Arel::Nodes::InfixOperation
- Arel::Nodes::InnerJoin
- Arel::Nodes::InsertStatement
- Arel::Nodes::JoinSource
- Arel::Nodes::Multiplication
- Arel::Nodes::NamedFunction
- Arel::Nodes::NamedWindow
- Arel::Nodes::Node
- Arel::Nodes::Ordering
- Arel::Nodes::OuterJoin
- Arel::Nodes::Over
- Arel::Nodes::Preceding
- Arel::Nodes::Range
- Arel::Nodes::Rows
- Arel::Nodes::SelectCore
- Arel::Nodes::SelectStatement
- Arel::Nodes::SqlLiteral
- Arel::Nodes::StringJoin
- Arel::Nodes::Subtraction
- Arel::Nodes::TableAlias
- Arel::Nodes::True
- Arel::Nodes::Unary
- Arel::Nodes::UnqualifiedColumn
- Arel::Nodes::UpdateStatement
- Arel::Nodes::Values
- Arel::Nodes::Window
- Arel::Nodes::With
- Arel::Nodes::WithRecursive
- Arel::OrderPredications
- Arel::Predications
- Arel::Relation
- Arel::SelectManager
- Arel::Sql
- Arel::Sql::Engine
- Arel::SqlLiteral
- Arel::Table
- Arel::TreeManager
- Arel::UpdateManager
- Arel::Visitors
- Arel::Visitors::BindVisitor
- Arel::Visitors::DepthFirst
- Arel::Visitors::Dot
- Arel::Visitors::IBM_DB
- Arel::Visitors::Informix
- Arel::Visitors::JoinSql
- Arel::Visitors::MSSQL
- Arel::Visitors::MySQL
- Arel::Visitors::Oracle
- Arel::Visitors::OrderClauses
- Arel::Visitors::PostgreSQL
- Arel::Visitors::SQLite
- Arel::Visitors::ToSql
- Arel::Visitors::Visitor
- Arel::Visitors::WhereSql
- Arel::WindowPredications

No matching classes.

# Arel::InsertManager

### Public Class Methods

new(engine) click to toggle source

    # File lib/arel/insert_manager.rb, line 3
    def initialize engine
      super
      @ast = Nodes::InsertStatement.new
    end

### Public Instance Methods

columns() click to toggle source

    # File lib/arel/insert_manager.rb, line 13
    def columns; @ast.columns end

create_values(values, columns) click to toggle source

    # File lib/arel/insert_manager.rb, line 34
    def create_values values, columns
      Nodes::Values.new values, columns
    end

insert(fields) click to toggle source

    # File lib/arel/insert_manager.rb, line 16
    def insert fields
      return if fields.empty?

      if String === fields
        @ast.values = SqlLiteral.new(fields)
      else
        @ast.relation ||= fields.first.first.relation

        values = []

        fields.each do |column, value|
          @ast.columns << column
          values << value
        end
        @ast.values = create_values values, @ast.columns
      end
    end

into(table) click to toggle source

    # File lib/arel/insert_manager.rb, line 8
    def into table
      @ast.relation = table
      self
    end

values=(val;) click to toggle source

    # File lib/arel/insert_manager.rb, line 14
    def values= val; @ast.values = val; end

[Validate]

Generated with the Darkfish Rdoc Generator 2.