scala - Null parameter in Anorm -


For example, I create a function which results only by id and / or email (parsing result Not interested in this question):

  def getFullUser (userId: option [tall] = none, email: option [string] = any No) {DB.withConnection {implied c => Val userRow = SQL (select "* FROM t_users WHERE id = COALESCE ({userId}, ID) and email = COALESCE ({email}, email)" ") .on ('userId - & gt; userId' & Gt; Email) .apply () Head}}  

When I call it userId = none , or email = any it

  Crashes with org.postgresql.util.PSQLException: Error: The parameter could not determine the data type of $ 1  

Is there any way to press Zero Parameter in a prepared statement?


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -