Exception: ActiveRecord::StatementInvalid
- Inherits:
-
AdapterError
- Object
- StandardError
- ActiveRecordError
- AdapterError
- ActiveRecord::StatementInvalid
- Defined in:
- activerecord/lib/active_record/errors.rb
Overview
Superclass for all database execution errors.
Wraps the underlying database error as cause.
Direct Known Subclasses
CheckViolation, DatabaseAlreadyExists, ExclusionViolation, LockWaitTimeout, MismatchedForeignKey, NoDatabaseError, NotNullViolation, PreparedStatementCacheExpired, QueryAborted, RangeError, TransactionRollbackError, ValueTooLong, WrappedDatabaseException
Instance Attribute Summary collapse
-
#binds ⇒ Object
readonly
Returns the value of attribute binds.
-
#sql ⇒ Object
readonly
Returns the value of attribute sql.
Attributes inherited from AdapterError
Instance Method Summary collapse
-
#initialize(message = nil, sql: nil, binds: nil, connection_pool: nil) ⇒ StatementInvalid
constructor
A new instance of StatementInvalid.
- #set_query(sql, binds) ⇒ Object
Constructor Details
#initialize(message = nil, sql: nil, binds: nil, connection_pool: nil) ⇒ StatementInvalid
Returns a new instance of StatementInvalid.
210 211 212 213 214 |
# File 'activerecord/lib/active_record/errors.rb', line 210 def initialize( = nil, sql: nil, binds: nil, connection_pool: nil) super( || $!&., connection_pool: connection_pool) @sql = sql @binds = binds end |
Instance Attribute Details
#binds ⇒ Object (readonly)
Returns the value of attribute binds.
216 217 218 |
# File 'activerecord/lib/active_record/errors.rb', line 216 def binds @binds end |
#sql ⇒ Object (readonly)
Returns the value of attribute sql.
216 217 218 |
# File 'activerecord/lib/active_record/errors.rb', line 216 def sql @sql end |
Instance Method Details
#set_query(sql, binds) ⇒ Object
218 219 220 221 222 223 224 225 |
# File 'activerecord/lib/active_record/errors.rb', line 218 def set_query(sql, binds) unless @sql @sql = sql @binds = binds end self end |