插入的二进制数据

插入的二进制数据

本文介绍了在“remote_ip"列上为“string"类型插入的二进制数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

stringtype on column ...插入的二进制数据是什么意思?

What is the meaning of Binary data inserted forstringtype on column ...?

在 SQLite 表中登录远程 ip 地址时,在调试控制台中有一条消息:

When loggin remote ip addresses in a SQLite table, there is a message in debug console:

Started GET "/test?name=abcde" for 127.0.0.1 at 2012-10-16 18:02:01 +0800
Processing by TestController#index as HTML
  Parameters: {"name"=>"abcde"}
   (0.1ms)  begin transaction
Binary data inserted for `string` type on column `query`
Binary data inserted for `string` type on column `remote_ip`
  SQL (0.6ms)  INSERT INTO "requests" ("controller", "query", "remote_ip") VALUES (?, ?, ?)  [["controller", "test"], ["query", "name=abcde"], ["remote_ip", "127.0.0.1"]]
   (2.5ms)  commit transaction

表定义为:

class CreateRequests < ActiveRecord::Migration
  def change
    create_table :requests do |t|
      t.string   :controller, :limit => 128
      t.string   :remote_ip,  :limit => 128
      t.string   :query,      :limit => 2048
    end
  end
end

配置:

OS X Lion
ruby 1.9.3p194 
Rails 3.2.8
sqlite3 (1.3.6)
sqlite3-ruby (1.3.2)

推荐答案

这意味着你的 Ruby 字符串被标记为一些非默认编码:
(参见 https://github.com/luislavena/sqlite3-ruby/issues/45)

It means that your Ruby strings are tagged with some non-default encoding:
(see https://github.com/luislavena/sqlite3-ruby/issues/45)

这篇关于在“remote_ip"列上为“string"类型插入的二进制数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!