包含 GreaterThanEqual (gte) 或 lessThanEqual (lte) 的 Squeryl 查询给出错误/无结果

发布于 2024-11-15 11:48:40 字数 808 浏览 2 评论 0原文

我正在尝试使用 squeryl 进行简单的查询。然而它不起作用!代码编译但查询没有返回结果,但它应该!空白 SQL 中的相同查询可以完美运行。 SELECT * FROM tablename WHERE 位置 <= 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)
}

根据 http: //max-l.github.com/Squeryl/functions.html 它应该可以工作吗?!

任何帮助表示赞赏。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春花秋月 2024-11-22 11:48:40

这应该会给您一个弃用警告:

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

有一个已弃用的隐式转换会导致问题,请参阅此

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

我刚刚将其从主分支中删除。

这个应该可以工作:

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

我刚刚尝试过,它可以正确编译并运行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文