-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String literal to long #80
Comments
Are you using parameterized statements? Using the UTF-8 charset (or UNICODE_FSS) can cause the implementation to allocate 3 bytes per character, which can surprise you if Firebird thinks it's dealing with a VARCHAR, which is limited to 32K. |
I'm using the |
@choallin I'm using modified version of ActiveRecord::Relation.update_all in my fork to make attributes work; require 'active_record/relation'
ActiveRecord::Relation.class_eval do
prepend(RelationExtensions = Module.new do
def update_all(updates)
raise ArgumentError, "Empty list of attributes to change" if updates.blank?
stmt = Arel::UpdateManager.new
stmt.table(table)
value_binds = []
arel_values = []
if !updates.empty? && !updates.first.nil? && !updates.first.is_a?(String)
updates.each do |column, value|
value_binds.push ActiveRecord::Relation::QueryAttribute.new(column, value, @klass.type_for_attribute(column))
arel_values.push Arel::Nodes::Assignment.new(Arel::Nodes::UnqualifiedColumn.new(Arel::Attributes::Attribute.new(table, column)), Arel::Nodes::BindParam.new)
end
stmt.ast.values = arel_values
else
stmt.set Arel.sql(@klass.send(:sanitize_sql_for_assignment, updates))
end
if has_join_values?
@klass.connection.join_to_update(stmt, arel, arel_attribute(primary_key))
else
stmt.key = arel_attribute(primary_key)
stmt.take(arel.limit)
stmt.order(*arel.orders)
stmt.wheres = arel.constraints
end
@klass.connection.update stmt, "SQL", value_binds + bound_attributes
end
end)
end |
I have a table that saves various input from users. In one column we write a giant json string produced by a step by step wizard. This column is defined as a blob sub_type 1 with the utf-8 charset.
Now I when I want to save the last step I get this error:
When I manually make a string concat in the middle of the string (with "||" ) the statement works. According to a comment from my Stackoverflow question this could be fixed here
The text was updated successfully, but these errors were encountered: