PSQLException:列索引超出范围:2,列数:1

时间:2021-05-07 16:41:09

The following error occured when try to query a list of email with provided email,password. Actually the subscribers_table has 10 columns with column names of email and password.

当试图查询带有提供的电子邮件、密码的电子邮件列表时发生以下错误。实际上,subscribers_table有10列,其中包含电子邮件和密码的列名。

[PSQLException: The column index is out of range: 2, number of columns: 1.]

My LoginProcess Model code:

我的LoginProcess模型代码:

    case class LoginProcess(email:String,password:String)

    //error occured in this line
    implicit val getLoginProcessResult = GetResult(r => LoginProcess(r.nextString, r.nextString))

    def check_Login_Success_Query(email: String,password:String) = sql"select email from provisions_schema.subscribers_table where email = $email and password=$password ".as[LoginProcess]

    val login_Success_Query_List = check_Login_Success_Query(email_ip,password_ip).list

    println("login_Success_Query_List.length ->" +login_Success_Query_List.length)

1 个解决方案

#1


4  

You do this:

你这样做:

select email from provisions_schema.subscribers_table

And the model expects email and password. Add the password to your query

模型要求电子邮件和密码。将密码添加到查询中

#1


4  

You do this:

你这样做:

select email from provisions_schema.subscribers_table

And the model expects email and password. Add the password to your query

模型要求电子邮件和密码。将密码添加到查询中