开发者

Squeryl Query containing greaterThanEqual (gte) or lessThanEqual (lte) give wrong/no results

开发者 https://www.devze.com 2023-03-12 14:39 出处:网络
I\'m trying to do a simple query with squeryl. however it doesn\'t work! the code compiles but the query returns no results, but it should! the same query in blank SQL works perfectly. SELECT * FROM t

I'm trying to do a simple query with squeryl. however it doesn't work! the code compiles but the query returns no results, but it should! the same query in blank SQL works perfectly. SELECT * FROM tablename WHERE position <= 83172924

val qryResult = from(DBName.tablename)(t => where(t.position === 83172924) select (t)) //works! but not what i want
val qryResult = from(DBName.tablename)(t => where(t.position <= 83172924) select (t)) //compile OK, no results
val qryResult = from(DBName.tablename)(t => where(t.position lte 83172924) select (t)) //compile ERROR

object DBName extends Schema {
  val tablename = table[FOO]("tablename")
}

class FOO(var position: Int) {
  def this() = this (0)
}

开发者_如何转开发according to http://max-l.github.com/Squeryl/functions.html it should work?!

any help is appreciated.


This should have given you a deprecation warning :

qryResult = from(DBName.tablename)(t => where(t.position <= 83172924) select (t))

There's a deprecated implicit conversion that is causing trouble, see this

https://groups.google.com/forum/#!searchin/squeryl/implicit$20boolean/squeryl/pSUzNDA4Bq4/oHmqS16yD_0J

I just removed it from master branch.

This one should work :

qryResult = from(DBName.tablename)(t => where(t.position lte 83172924) select (t))

I just tried it and it compiles and runs correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消