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:
Methods
Public Class
Public Instance
Included modules
- Sequel::SQL::AliasMethods
Attributes
Public Class methods
subclass(db_type)
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.
[show source]
# File lib/sequel/extensions/pg_row.rb 114 def self.subclass(db_type) 115 Class.new(self) do 116 @db_type = db_type 117 end 118 end
Public Instance methods
db_type()
Return the instance’s database type, or the class’s database type if the instance has not overridden it.
[show source]
# File lib/sequel/extensions/pg_row.rb 126 def db_type 127 @db_type || self.class.db_type 128 end
op()
Wrap the PGRow::ArrayRow
instance in an PGRowOp
, allowing you to easily use the PostgreSQL row functions and operators with literal rows.
[show source]
# File lib/sequel/extensions/pg_row_ops.rb 168 def op 169 Sequel.pg_row_op(self) 170 end
sequel_auto_param_type(ds)
Allow automatic parameterization if all values support it.
[show source]
# File lib/sequel/extensions/pg_row.rb 141 def sequel_auto_param_type(ds) 142 if db_type && all?{|v| nil == v || ds.send(:auto_param_type, v)} 143 s = String.new << "::" 144 ds.quote_schema_table_append(s, db_type) 145 s 146 end 147 end
sql_literal_append(ds, sql)
Append SQL
fragment related to this object to the sql.
[show source]
# File lib/sequel/extensions/pg_row.rb 131 def sql_literal_append(ds, sql) 132 sql << 'ROW' 133 ds.literal_append(sql, to_a) 134 if db_type 135 sql << '::' 136 ds.quote_schema_table_append(sql, db_type) 137 end 138 end