[英]sqlite3 connector in python
This doesn't work: I don't get any element. 这行不通:我没有任何元素。
k0 is float numpy, dk is int: k0是浮点数numpy,dk是整数:
(k0, dk)
(<class 'numpy.float64'>, <class 'int'>)
(20.083143869749225, 6)
- -
get_close_rods = "select xmid, ymid, angle from datos where experiment_id=? "
get_close_rods+= "and file_id=? and ymid between ? and ? and xmid between ? and ? and angle between ? and ? "
get_close_rods+= "and major/minor between ? and ? order by ((xmid-?)*(xmid-?)+(ymid-?)*(ymid-?))*angle"
#get_close_rods+= "order by ((xmid-?)*(xmid-?)+(ymid-?)*(ymid-?))*angle"
args = (str(experiment_id_), str(file_ids[index+1]), str(pos0[1]-dd),
str(pos0[1]+dd), str(pos0[0]-dd), str(pos0[0]+dd),
str(angle-dangle), str(angle+dangle), str(k0-dk), str(k0+dk),
str(pos0[0]), str(pos0[0]), str(pos0[1]), str(pos0[1]))
cursor2.execute(get_close_rods, args)
str(k0-dk), str(k0+dk) str(k0-dk),str(k0 + dk)
It doesn't work either: 它也不起作用:
get_close_rods = "select xmid, ymid, angle, from datos where experiment_id=? "
get_close_rods+= "and file_id=? and ymid between ? and ? and xmid between ? and ? and angle between ? and ? "
get_close_rods+= "and major/minor between ? and ? order by ((xmid-?)*(xmid-?)+(ymid-?)*(ymid-?))*angle"
#get_close_rods+= "order by ((xmid-?)*(xmid-?)+(ymid-?)*(ymid-?))*angle"
args = (str(experiment_id_), str(file_ids[index+1]), str(pos0[1]-dd),
str(pos0[1]+dd), str(pos0[0]-dd), str(pos0[0]+dd),
str(angle-dangle), str(angle+dangle), str(15), str(25),
str(pos0[0]), str(pos0[0]), str(pos0[1]), str(pos0[1]))
cursor2.execute(get_close_rods, args)
str(15), str(25) str(15),str(25)
Doesn't work either if I put str(float(15)), str(float(25)) . 如果我放入str(float(15)),str(float(25))也不起作用。
It doesn't show any error when I use that query. 当我使用该查询时,它没有显示任何错误。
But this works: 但这有效:
get_close_rods = "select xmid, ymid, angle, from datos where experiment_id=? "
get_close_rods+= "and file_id=? and ymid between ? and ? and xmid between ? and ? and angle between ? and ? "
#get_close_rods+= "and major/minor between ? and ? order by ((xmid-?)*(xmid-?)+(ymid-?)*(ymid-?))*angle"
#get_close_rods+= "order by ((xmid-?)*(xmid-?)+(ymid-?)*(ymid-?))*angle"
get_close_rods+= "and major/minor between 15 and 25 order by ((xmid-?)*(xmid-?)+(ymid-?)*(ymid-?))*angle"
args = (str(experiment_id_), str(file_ids[index+1]), str(pos0[1]-dd),
str(pos0[1]+dd), str(pos0[0]-dd), str(pos0[0]+dd),
str(angle-dangle), str(angle+dangle), #str(15), str(25),
str(pos0[0]), str(pos0[0]), str(pos0[1]), str(pos0[1]))
cursor2.execute(get_close_rods, args)
#str(15), str(25) #str(15),str(25)
Using directly values fixed it: 直接使用值对其进行修复:
args = (..., 15, 25, ...)
or: 要么:
args = (..., k0-dk, k0+dk, ...)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.