这是一个哈希,其中 mysql 列与哈希的键相关,值与哈希的值相关
{:jobID=>"1", :checkoutArtificateFolder=>"/cmf/new/build/Artifacts/factory-config.xml"}
现在这是我的代码,我在这里将数据插入表中
def write_data
$db_obj = # a data base object
table_name = table_name
jobID = jobID
hash_data = hash_data
insert = "INSERT INTO #{table_name} ("
data = ""
hash_data.each do|key,value|
insert = "#{insert}" + " #{ key},"
data = "#{data}" + "'#{ value}',"
end
insert = insert.chop
data = data.chop
query = insert + ")" + "VALUES" + "(#{data})"
exec = $db_obj.prepare(query)
exec.execute
end
但在数据库中,这个值(“/cmf/new/build/Artifacts/factory-config.xml”)被转换成这个(“/cmf/new/build/Artifacts/factory-config.”)
谁能帮助我并告诉我为什么会发生这种情况以及我该如何纠正?