新手问题 关于 MySQL 的执行结果输出

netuser · April 09, 2015 · Last by king1990_cool replied at April 09, 2015 · 1742 hits

用 ruby 做了个很简单的 HTTP 与 MYSQL 之间的中间件,要判断数据是否存在,我的语句是这样

select 1 from table where column = '1' limit 1

这句的输出结果如果存在就是 1,不存在是空 可是怎么感觉这么麻烦 开始用 activerecord,感觉太庞大了 于是用 mysql2 是这样的

res = conn.query("select 1 from table where column = '1' limit 1)

然后 res.first? 有点搞不懂了

为什么要做这样的中间件?

你可以去看一下这里面的 https://github.com/brianmario/mysql2 res 出来的是一个 array

You need to Sign in before reply, if you don't have an account, please Sign up first.