Don’t alter subquery RETURN type

Don’t alter the RETURN type for CREATE / UPDATE / DELETE / RELATE / INSERT / UPSERT statements. Not only does this cause unexpected behaviour, but it also altered the statement from multiple goroutines, and therefore caused a data race.
This commit is contained in:
Tobie Morgan Hitchcock 2018-04-20 23:33:29 +01:00
parent 7afe14ab1a
commit d2a451345a
6 changed files with 0 additions and 12 deletions

View file

@ -76,8 +76,6 @@ func (e *executor) executeCreate(ctx context.Context, stm *sql.CreateStatement)
func (e *executor) fetchCreate(ctx context.Context, stm *sql.CreateStatement, doc *data.Doc) (interface{}, error) { func (e *executor) fetchCreate(ctx context.Context, stm *sql.CreateStatement, doc *data.Doc) (interface{}, error) {
stm.Echo = sql.AFTER
if doc != nil { if doc != nil {
vars := data.New() vars := data.New()
vars.Set(doc.Data(), varKeyParent) vars.Set(doc.Data(), varKeyParent)

View file

@ -75,8 +75,6 @@ func (e *executor) executeDelete(ctx context.Context, stm *sql.DeleteStatement)
func (e *executor) fetchDelete(ctx context.Context, stm *sql.DeleteStatement, doc *data.Doc) (interface{}, error) { func (e *executor) fetchDelete(ctx context.Context, stm *sql.DeleteStatement, doc *data.Doc) (interface{}, error) {
stm.Echo = sql.BEFORE
if doc != nil { if doc != nil {
vars := data.New() vars := data.New()
vars.Set(doc.Data(), varKeyParent) vars.Set(doc.Data(), varKeyParent)

View file

@ -54,8 +54,6 @@ func (e *executor) executeInsert(ctx context.Context, stm *sql.InsertStatement)
func (e *executor) fetchInsert(ctx context.Context, stm *sql.InsertStatement, doc *data.Doc) (interface{}, error) { func (e *executor) fetchInsert(ctx context.Context, stm *sql.InsertStatement, doc *data.Doc) (interface{}, error) {
stm.Echo = sql.AFTER
if doc != nil { if doc != nil {
vars := data.New() vars := data.New()
vars.Set(doc.Data(), varKeyParent) vars.Set(doc.Data(), varKeyParent)

View file

@ -68,8 +68,6 @@ func (e *executor) executeRelate(ctx context.Context, stm *sql.RelateStatement)
func (e *executor) fetchRelate(ctx context.Context, stm *sql.RelateStatement, doc *data.Doc) (interface{}, error) { func (e *executor) fetchRelate(ctx context.Context, stm *sql.RelateStatement, doc *data.Doc) (interface{}, error) {
stm.Echo = sql.AFTER
if doc != nil { if doc != nil {
vars := data.New() vars := data.New()
vars.Set(doc.Data(), varKeyParent) vars.Set(doc.Data(), varKeyParent)

View file

@ -75,8 +75,6 @@ func (e *executor) executeUpdate(ctx context.Context, stm *sql.UpdateStatement)
func (e *executor) fetchUpdate(ctx context.Context, stm *sql.UpdateStatement, doc *data.Doc) (interface{}, error) { func (e *executor) fetchUpdate(ctx context.Context, stm *sql.UpdateStatement, doc *data.Doc) (interface{}, error) {
stm.Echo = sql.AFTER
if doc != nil { if doc != nil {
vars := data.New() vars := data.New()
vars.Set(doc.Data(), varKeyParent) vars.Set(doc.Data(), varKeyParent)

View file

@ -54,8 +54,6 @@ func (e *executor) executeUpsert(ctx context.Context, stm *sql.UpsertStatement)
func (e *executor) fetchUpsert(ctx context.Context, stm *sql.UpsertStatement, doc *data.Doc) (interface{}, error) { func (e *executor) fetchUpsert(ctx context.Context, stm *sql.UpsertStatement, doc *data.Doc) (interface{}, error) {
stm.Echo = sql.AFTER
if doc != nil { if doc != nil {
vars := data.New() vars := data.New()
vars.Set(doc.Data(), varKeyParent) vars.Set(doc.Data(), varKeyParent)