4

Binary data inserted for字符串的含义是type on column ...什么?

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

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)
4

1 回答 1

4

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

于 2012-10-16T11:08:23.847 回答