lib/sequel/adapters/shared/mysql.rb in sequel-4.2.0 vs lib/sequel/adapters/shared/mysql.rb in sequel-4.3.0
- old
+ new
@@ -562,10 +562,11 @@
EXPLAIN = 'EXPLAIN '.freeze
EXPLAIN_EXTENDED = 'EXPLAIN EXTENDED '.freeze
BACKSLASH_RE = /\\/.freeze
QUAD_BACKSLASH = "\\\\\\\\".freeze
BLOB_START = "0x".freeze
+ EMPTY_BLOB = "''".freeze
HSTAR = "H*".freeze
include Sequel::Dataset::Replace
# MySQL specific syntax for LIKE/REGEXP searches, as well as
@@ -871,10 +872,14 @@
alias delete_limit_sql limit_sql
alias update_limit_sql limit_sql
# MySQL uses a preceding X for hex escaping strings
def literal_blob_append(sql, v)
- sql << BLOB_START << v.unpack(HSTAR).first
+ if v.empty?
+ sql << EMPTY_BLOB
+ else
+ sql << BLOB_START << v.unpack(HSTAR).first
+ end
end
# Use 0 for false on MySQL
def literal_false
BOOL_FALSE