use join select same name field may get wrong data #900

Closed
opened 2018-04-18 05:45:04 +00:00 by dushu1105 · 1 comment
dushu1105 commented 2018-04-18 05:45:04 +00:00 (Migrated from github.com)

see below code:
sometime data not as order as "tables.id,tables.name, cells.id, cells.name"; cells.name may put to tables name field, about 1 ro 2 times every 100 calls, I check source code and find Cols use map to save column's name, change to [] will make data correct.

type TTmp struct {
Id string
Name string
}

type CTmp struct {
Id string
Name string
}

type TableCells struct {
TTmp xorm:"extends"
CTmp xorm:"extends"
}

func (TableCells) TableName() string {
return "tables"
}

var u []TableCells

err := db.Join("INNER", "cells", "tables.id = cells.table_id").Cols("tables.id,tables.name, cells.id, cells.name").Limit(1).Find(&u)

see below code: sometime data not as order as "tables.id,tables.name, cells.id, cells.name"; cells.name may put to tables name field, about 1 ro 2 times every 100 calls, I check source code and find Cols use map to save column's name, change to [] will make data correct. type TTmp struct { Id string Name string } type CTmp struct { Id string Name string } type TableCells struct { TTmp `xorm:"extends"` CTmp `xorm:"extends"` } func (TableCells) TableName() string { return "tables" } var u []TableCells err := db.Join("INNER", "cells", "tables.id = cells.table_id").Cols("tables.id,tables.name, cells.id, cells.name").Limit(1).Find(&u)
dushu1105 commented 2018-04-18 06:20:14 +00:00 (Migrated from github.com)

I check in 0.6.3, but seems fixed in 0.6.6, then close it

I check in 0.6.3, but seems fixed in 0.6.6, then close it
Sign in to join this conversation.
No Milestone
No Assignees
1 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#900
No description provided.