Sha256: 6586a91e982b97dd4c176cae66e0e537758f11b8c32b1def981f8807d30e21ec
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
class Upsert class Connection # @private class Mysql2_Client < Connection def execute(sql) Upsert.logger.debug { %{[upsert] #{sql}} } raw_connection.query sql end def quote_boolean(v) v ? 'TRUE' : 'FALSE' end def quote_string(v) SINGLE_QUOTE + raw_connection.escape(v) + SINGLE_QUOTE end # This doubles the size of the representation. def quote_binary(v) X_AND_SINGLE_QUOTE + v.unpack("H*")[0] + SINGLE_QUOTE end # put raw binary straight into sql # might work if we could get the encoding issues fixed when joining together the values for the sql # alias_method :quote_binary, :quote_string def quote_time(v) quote_string v.strftime(ISO8601_DATETIME) end def quote_ident(k) BACKTICK + raw_connection.escape(k.to_s) + BACKTICK end def quote_big_decimal(v) v.to_s('F') end def database_variable_get(k) sql = "SHOW VARIABLES LIKE '#{k}'" row = execute(sql).first case row when Array row[1] when Hash row['Value'] else raise "Don't know what to do if connection.query returns a #{row.class}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
upsert-1.0.2 | lib/upsert/connection/Mysql2_Client.rb |
upsert-0.5.0 | lib/upsert/connection/mysql2_client.rb |
upsert-0.4.0 | lib/upsert/connection/mysql2_client.rb |