新手请教:刚更新了0.3.1版本,以前正常的程序现在运行期间报错了 #46
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#46
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
刚更新了0.3.1版本,以前是0.2.3,以前正常的程序现在运行期间报错了,写了一个最简单的测试程序也报同样的错误,大家有遇到过吗?请指教,多谢。
最简代码:
运行后报的错误为:
数据库:mysql 5.1.63
编译环境:windows 7 64位
GO版本:1.1.2
自己跟踪发现是下面这个函数里报的错:
func (session *Session) row2Bean(rows *sql.Rows, fields []string, fieldsCount int, bean interface{})
字段是字符串类型就会报错,
fieldType.Kind()
rawValueType.Kind()
这两个的类型不一致,导致会到 bytes2Value 里处理,然后出错。
能否将你的数据库结构贴一下?我测试了你的代码是正常的。
这个代码中在?和charset之间的空格应去掉。
另NewEngine返回的第二个参数err应检查是否不为nil
能否将你的数据库结构贴一下?我测试了你的代码是正常的。
这个代码中在?和charset之间的空格应去掉。
另NewEngine返回的第二个参数err应检查是否不为nil
能否将你的数据库结构贴一下?我测试了你的代码是正常的。
这个代码中在?和charset之间的空格应去掉。
另NewEngine返回的第二个参数err应检查是否不为nil
谢谢lunny回复,真实代码里没有没有空格,数据连接没有问题,我测过,如果只返回一个整数字段时是没有问题的,
表结构如下:
CREATE TABLE IF NOT EXISTS
User
(Id
bigint(20) NOT NULL AUTO_INCREMENT,UserName
varchar(255) DEFAULT NULL,FullName
varchar(255) DEFAULT NULL,Created
datetime DEFAULT NULL,PRIMARY KEY (
Id
)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
lunny是否理解有误,我是说,数据库的连接是正常的,如果结果集只返回一个整数字段时是没有问题的,如果有string字段时,查询依然报错。
type User struct {
Id int32
UserName string
}
再更新下看看好了没有?你用的是SameMapper?
已更新,解决了,多谢,用的是SameMapper。