src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt

changeset 207
479dd7993ef9
parent 203
7d5b16379768
child 215
028792eda9b7
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Mon Aug 02 15:13:04 2021 +0200
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Mon Aug 02 17:04:17 2021 +0200
     1.3 @@ -658,6 +658,12 @@
     1.4              queryAll { it.extractIssueComment() }
     1.5          }
     1.6  
     1.7 +    override fun findComment(id: Int): IssueComment? =
     1.8 +        withStatement("select * from lpit_issue_comment left join lpit_user using (userid) where commentid = ?") {
     1.9 +            setInt(1, id)
    1.10 +            querySingle { it.extractIssueComment() }
    1.11 +        }
    1.12 +
    1.13      override fun insertComment(issueComment: IssueComment) {
    1.14          useStatement("update lpit_issue set updated = now() where issueid = ?") { updateIssueDate ->
    1.15              withStatement("insert into lpit_issue_comment (issueid, comment, userid) values (?, ? ,?)") {
    1.16 @@ -672,5 +678,19 @@
    1.17              }
    1.18          }
    1.19      }
    1.20 +
    1.21 +    override fun updateComment(issueComment: IssueComment) {
    1.22 +        useStatement("update lpit_issue set updated = now() where issueid = ?") { updateIssueDate ->
    1.23 +            withStatement("update lpit_issue_comment set comment = ?, updatecount = updatecount + 1, updated = now() where commentid = ?") {
    1.24 +                with(issueComment) {
    1.25 +                    updateIssueDate.setInt(1, issueid)
    1.26 +                    setStringSafe(1, comment)
    1.27 +                    setInt(2, id)
    1.28 +                }
    1.29 +                executeUpdate()
    1.30 +                updateIssueDate.executeUpdate()
    1.31 +            }
    1.32 +        }
    1.33 +    }
    1.34  //</editor-fold>
    1.35  }
    1.36 \ No newline at end of file

mercurial