Mysql 5.5 Ruby DBI 分段
段错误似乎是在关闭连接时出现的
begin
dbh = DBI.connect("DBI:Mysql:testdb:localhost", "user", "pass")
rows = dbh.do("INSERT IGNORE INTO `HS_pList` (projName, projSource, projLink, projHash, projLoc) Values ('" + dbh.escape_string(@name) + "','" + @source + "','" + @link + "','" + @hash + "','" + @loc + "')")
rescue DBI::DatabaseError => e
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
ensure
dbh.disconnect if dbh
end
;在插入字符串的末尾,但它没有改变任何东西。如果我所做的只是打开和关闭一个错误,我会得到同样的错误,有人知道为什么吗?所有变量都是为了构造字符串而设置的。
MySQL 5.5
红宝石 1.9.2p180
dbi 0.4.5
dbd-mysql 0.4.4
mysql 2.8.1 x86-mingw32
The Segfault appears to be on closing the connection
begin
dbh = DBI.connect("DBI:Mysql:testdb:localhost", "user", "pass")
rows = dbh.do("INSERT IGNORE INTO `HS_pList` (projName, projSource, projLink, projHash, projLoc) Values ('" + dbh.escape_string(@name) + "','" + @source + "','" + @link + "','" + @hash + "','" + @loc + "')")
rescue DBI::DatabaseError => e
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
ensure
dbh.disconnect if dbh
end
I had a ; at the end of the string for the insert but it did not change anything. I get the same error if all i am doing is opening and closing an error does any one have an Idea of why. All the variables are set for constructing the string.
mysql 5.5
ruby 1.9.2p180
dbi 0.4.5
dbd-mysql 0.4.4
mysql 2.8.1 x86-mingw32
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
弄清楚它是什么,我必须将 libmysql.dll 复制到 ruby bin,并且我还尝试复制 libmysqld.dll,现在它可以工作了,其中必须有正确的断开连接吗?
Figured out what it was I had to copy the libmysql.dll to the ruby bin and I also tried copying the libmysqld.dll and now it works must have the proper disconnects in that one?