Class: Sequel::Postgres::PGRow::ArrayRow
- Includes:
- SQL::AliasMethods
- Defined in:
- lib/sequel/extensions/pg_row.rb,
 lib/sequel/extensions/pg_row_ops.rb
Overview
:nocov:
Class Attribute Summary collapse
- 
  
    
      .db_type  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The database type for this class. 
Instance Attribute Summary collapse
- 
  
    
      #db_type  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Return the instance’s database type, or the class’s database type if the instance has not overridden it. 
Class Method Summary collapse
- 
  
    
      .subclass(db_type)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a subclass associated with a specific database type. 
Instance Method Summary collapse
- 
  
    
      #op  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Wrap the PGRow::ArrayRow instance in an PGRowOp, allowing you to easily use the PostgreSQL row functions and operators with literal rows. 
- 
  
    
      #sequel_auto_param_type(ds)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Allow automatic parameterization if all values support it. 
- 
  
    
      #sql_literal_append(ds, sql)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Append SQL fragment related to this object to the sql. 
Methods included from SQL::AliasMethods
Methods inherited from Array
#case, #pg_array, #pg_json, #pg_jsonb, #pg_row, #sql_expr, #sql_negate, #sql_or, #sql_string_join, #sql_value_list, #~
Class Attribute Details
.db_type ⇒ Object
The database type for this class. May be nil if this class done not have a specific database type.
| 104 105 106 | # File 'lib/sequel/extensions/pg_row.rb', line 104 def db_type @db_type end | 
Instance Attribute Details
#db_type ⇒ Object
Return the instance’s database type, or the class’s database type if the instance has not overridden it.
| 127 128 129 | # File 'lib/sequel/extensions/pg_row.rb', line 127 def db_type @db_type || self.class.db_type end | 
Class Method Details
.subclass(db_type) ⇒ Object
Create a subclass associated with a specific database type. This is done so that instances of this subclass are automatically casted to the database type when literalizing.
| 114 115 116 117 118 119 | # File 'lib/sequel/extensions/pg_row.rb', line 114 def self.subclass(db_type) Class.new(self) do Sequel.set_temp_name(self){"Sequel::Postgres::PGRow::ArrayRow::_Subclass(#{db_type})"} @db_type = db_type end end | 
Instance Method Details
#op ⇒ Object
Wrap the PGRow::ArrayRow instance in an PGRowOp, allowing you to easily use the PostgreSQL row functions and operators with literal rows.
| 168 169 170 | # File 'lib/sequel/extensions/pg_row_ops.rb', line 168 def op Sequel.pg_row_op(self) end | 
#sequel_auto_param_type(ds) ⇒ Object
Allow automatic parameterization if all values support it.
| 142 143 144 145 146 147 148 | # File 'lib/sequel/extensions/pg_row.rb', line 142 def sequel_auto_param_type(ds) if db_type && all?{|v| nil == v || ds.send(:auto_param_type, v)} s = String.new << "::" ds.quote_schema_table_append(s, db_type) s end end | 
#sql_literal_append(ds, sql) ⇒ Object
Append SQL fragment related to this object to the sql.
| 132 133 134 135 136 137 138 139 | # File 'lib/sequel/extensions/pg_row.rb', line 132 def sql_literal_append(ds, sql) sql << 'ROW' ds.literal_append(sql, to_a) if db_type sql << '::' ds.quote_schema_table_append(sql, db_type) end end |