class Sequel::Postgres::PGRow::ArrayRow
Class for row-valued/composite types that are treated as arrays. By default, this is only used for generic PostgreSQL record types, as registered types use HashRow by default.
:nocov:
Attributes
The database type for this class. May be nil if this class done not have a specific database type.
Sets the database type associated with this instance. This is used to override the class’s default database type.
Public Class Methods
Source
# File lib/sequel/extensions/pg_row.rb 114 def self.subclass(db_type) 115 Class.new(self) do 116 Sequel.set_temp_name(self){"Sequel::Postgres::PGRow::ArrayRow::_Subclass(#{db_type})"} 117 @db_type = db_type 118 end 119 end
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.
Public Instance Methods
Source
# File lib/sequel/extensions/pg_row.rb 127 def db_type 128 @db_type || self.class.db_type 129 end
Return the instance’s database type, or the class’s database type if the instance has not overridden it.
Source
# File lib/sequel/extensions/pg_row_ops.rb 168 def op 169 Sequel.pg_row_op(self) 170 end
Wrap the PGRow::ArrayRow
instance in an PGRowOp
, allowing you to easily use the PostgreSQL row functions and operators with literal rows.
Source
# File lib/sequel/extensions/pg_row.rb 142 def sequel_auto_param_type(ds) 143 if db_type && all?{|v| nil == v || ds.send(:auto_param_type, v)} 144 s = String.new << "::" 145 ds.quote_schema_table_append(s, db_type) 146 s 147 end 148 end
Allow automatic parameterization if all values support it.
Source
# File lib/sequel/extensions/pg_row.rb 132 def sql_literal_append(ds, sql) 133 sql << 'ROW' 134 ds.literal_append(sql, to_a) 135 if db_type 136 sql << '::' 137 ds.quote_schema_table_append(sql, db_type) 138 end 139 end
Append SQL
fragment related to this object to the sql.