Feature: Insert-IF-NOT-EXIST #1521

Open
opened 2020-02-18 22:01:40 +00:00 by 6543 · 3 comments
Contributor

an insert function witch only insert if entry not exist

sqlite: fmt.Sprintf("INSERT INTO issue_watch(user_id,issue_id,mode) SELECT %d,%d,%d WHERE NOT EXISTS(SELECT 1 FROM issue_watch WHERE user_id = %d AND issue_id = %d);", userID, issueID, mode, userID, issueID)

why not: xorm.InsertUniqe(obj,condition)

an insert function witch only insert if entry not exist sqlite: `fmt.Sprintf("INSERT INTO issue_watch(user_id,issue_id,mode) SELECT %d,%d,%d WHERE NOT EXISTS(SELECT 1 FROM issue_watch WHERE user_id = %d AND issue_id = %d);", userID, issueID, mode, userID, issueID)` why not: `xorm.InsertUniqe(obj,condition)`
Owner

Maybe you mean InsertSelect? I think it has been implemented.

Maybe you mean `InsertSelect`? I think it has been implemented.
Author
Contributor

Maybe you mean InsertSelect

perhaps ...

I think it has been implemented

cant find it any

> Maybe you mean `InsertSelect` perhaps ... > I think it has been implemented cant find it any
Owner

Sorry. That's a feature of builder not xorm. See https://gitea.com/xorm/builder/src/branch/master/builder_insert_test.go#L46 .

Sorry. That's a feature of builder not xorm. See https://gitea.com/xorm/builder/src/branch/master/builder_insert_test.go#L46 .
lunny added the
kind
proposal
label 2020-02-21 03:48:25 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1521
No description provided.