【问题标题】:PSQLException: The column index is out of range: 2, number of columns: 1PSQLException:列索引超出范围:2,列数:1
【发布时间】:2023-03-25 10:28:02
【问题描述】:

尝试使用提供的电子邮件、密码查询电子邮件列表时发生以下错误。实际上 subscribers_table 有 10 列,列名分别为 emailpassword

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

我的 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)

【问题讨论】:

    标签: postgresql scala playframework playframework-2.0 slick


    【解决方案1】:

    你这样做:

    select email from provisions_schema.subscribers_table
    

    模型需要emailpassword。将密码添加到您的查询中

    【讨论】:

    • 否。添加“select email,password from ...”后出现同样的错误
    • 对不起,我在 where 条件参数中添加了单引号。删除单引号后它工作正常。
    猜你喜欢
    • 2019-10-06
    • 1970-01-01
    • 1970-01-01
    • 2020-05-22
    • 2015-03-13
    • 1970-01-01
    • 2015-02-13
    • 2013-12-24
    相关资源
    最近更新 更多