FAQ
Here are some questions that have a potential to become frequently asked.
-
I have plenty of time, I don't want to use any timeout for any of my queries. What can I do?
Declare implicit
Timeout
instance of infinite duration —io.rdbc.sapi.Timeout.Inf
.
-
How do I build SQL dynamically using
sql
interpolator?Use special
#$
prefix for the dynamic parts. See this paragraph for details.
-
How to pass
Timeout
explicitly toExecutableStatement
'sexecuteForKey
method? I keep getting compilation errors.executeForKey
method's declaration isdef executeForKey[K: ClassTag]()(implicit timeout: Timeout): Future[K]
Under the hood, this declaration really means this:
def executeForKey[K]()(implicit classTag: ClassTag[K], timeout: Timeout): Future[K]
So you can't really execute this method like this:
executeForKey[Int]()(timeout)
Instead, you have to do this:
executeForKey()(timeout, classOf[Int])
-
I'm executing insert statement and trying to get auto-generated key from the DB but nothing is returned. What am I doing wrong?
You probably forgot to set a
generatedKeyCols
statement option accordingly. See this paragraph for details.