Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top