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

changeset 207
479dd7993ef9
parent 203
7d5b16379768
child 215
028792eda9b7
equal deleted inserted replaced
206:fe4de34822a5 207:479dd7993ef9
656 withStatement("select * from lpit_issue_comment left join lpit_user using (userid) where issueid = ? order by created") { 656 withStatement("select * from lpit_issue_comment left join lpit_user using (userid) where issueid = ? order by created") {
657 setInt(1, issue.id) 657 setInt(1, issue.id)
658 queryAll { it.extractIssueComment() } 658 queryAll { it.extractIssueComment() }
659 } 659 }
660 660
661 override fun findComment(id: Int): IssueComment? =
662 withStatement("select * from lpit_issue_comment left join lpit_user using (userid) where commentid = ?") {
663 setInt(1, id)
664 querySingle { it.extractIssueComment() }
665 }
666
661 override fun insertComment(issueComment: IssueComment) { 667 override fun insertComment(issueComment: IssueComment) {
662 useStatement("update lpit_issue set updated = now() where issueid = ?") { updateIssueDate -> 668 useStatement("update lpit_issue set updated = now() where issueid = ?") { updateIssueDate ->
663 withStatement("insert into lpit_issue_comment (issueid, comment, userid) values (?, ? ,?)") { 669 withStatement("insert into lpit_issue_comment (issueid, comment, userid) values (?, ? ,?)") {
664 with(issueComment) { 670 with(issueComment) {
665 updateIssueDate.setInt(1, issueid) 671 updateIssueDate.setInt(1, issueid)
670 executeUpdate() 676 executeUpdate()
671 updateIssueDate.executeUpdate() 677 updateIssueDate.executeUpdate()
672 } 678 }
673 } 679 }
674 } 680 }
681
682 override fun updateComment(issueComment: IssueComment) {
683 useStatement("update lpit_issue set updated = now() where issueid = ?") { updateIssueDate ->
684 withStatement("update lpit_issue_comment set comment = ?, updatecount = updatecount + 1, updated = now() where commentid = ?") {
685 with(issueComment) {
686 updateIssueDate.setInt(1, issueid)
687 setStringSafe(1, comment)
688 setInt(2, id)
689 }
690 executeUpdate()
691 updateIssueDate.executeUpdate()
692 }
693 }
694 }
675 //</editor-fold> 695 //</editor-fold>
676 } 696 }

mercurial