ora
ora copied to clipboard
something is wrong with *ora.Rset
When I deal with *ora.Rset, for switch vtype := row[j].(type)
, I found that neither time.Time
nor string
, it's value is unpredictable, which is not right and dangerous.
My code appears like:
case *ora.Rset:
procRset := &(*(interfaceOutArr[i].(*ora.Rset)))
if procRset.IsOpen() {
rmapArr := make([]interface{}, 0)
for procRset.Next() {
rmap := make(map[string]interface{})
cols := procRset.Columns
row := procRset.Row
for j := 0; j < len(row); j++ {
clo := cols[j].Name
switch vtype := row[j].(type) {
case ora.OCINum:
_ = vtype
va_n := (row[j].(ora.OCINum)).String1()
fl_64, err_ := strconv.ParseFloat(va_n, 64)
if err_ != nil {
log.Error("strconv.ParseFloat(float_str.(string),64) occurs error:", err_.Error())
return nil, err_
}
rmap[clo] = fl_64
case time.Time:
rmap[clo] = time.Unix((row[j].(time.Time)).Unix(), 0).Format("20060102 15:04:05")
case string:
log.Debug("in case string, "+ clo + "=", row[j])
if "" == row[j] {
rmap[clo] = nil
} else {
rmap[clo] = row[j]
}
default:
rmap[clo] = row[j]
}
log.Debug("type of ", clo, " is ", reflect.TypeOf(row[j]))
}
rmapArr = append(rmapArr, rmap)
}
val.Value = rmapArr
if err := procRset.Err(); err != nil {
log.Error("procRset.Err occurs error:", err)
}
log.Debug("procRset.Len()=", procRset.Len())
}
Here is my log:
time="2018-05-16T17:07:31+08:00" level=debug msg="produce returns"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, ORDER_ID=dd42f254576111e8a8d4000c2960b07d"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of ORDER_ID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, FRONT_IMG_ID=f29a3c6b9ccc4e848ad1ce9a38d3f62f"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of FRONT_IMG_ID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, ID_CODE=610124199306122758 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of ID_CODE is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, REAL_NAME=曹*星 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of REAL_NAME is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, UP_REAL_NAME=曹*星 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of UP_REAL_NAME is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, GENDER=男 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of GENDER is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, ETHNIC=汉 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of ETHNIC is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, ADDR=西安市周至县楼观镇下丢
time="2018-05-16T17:07:31+08:00" level=debug msg="type of ADDR is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, ISSUE_AUTHORITY=汉 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of ISSUE_AUTHORITY is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, VALID_PERIOD=男*星 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of VALID_PERIOD is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, BACK_IMG_ID=曹*星 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of BACK_IMG_ID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, HAND_IMG_ID=曹*星306122758 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of HAND_IMG_ID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, MASK_IMG_ID=610124*******22758 "
time="2018-05-16T17:07:31+08:00" level=debug msg="type of MASK_IMG_ID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, TRANSACTION_ID=c9fd73ec4f1712e0f8a93c8830b41b44"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of TRANSACTION_ID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of FRONT_TIME is time.Time"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of BACK_TIME is time.Time"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of HAND_TIME is <nil>"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of MASK_TIME is <nil>"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, FRONT_RESULT=OCR识别服务处理成功"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of FRONT_RESULT is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, BACK_RESULT="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of BACK_RESULT is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, HAND_RESULT="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of HAND_RESULT is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, HAND_SIMILARITY="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of HAND_SIMILARITY is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, MASK_RESULT="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of MASK_RESULT is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, MASK_SIMILARITY="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of MASK_SIMILARITY is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, HAND_MESSAGE="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of HAND_MESSAGE is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, MASK_MESSAGE="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of MASK_MESSAGE is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, IS_VALID=1"
time="2018-05-16T17:07:31+08:00" level=debug msg="type of IS_VALID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, AGREEMENT_ID="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of AGREEMENT_ID is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, SIGNATURE="
time="2018-05-16T17:07:31+08:00" level=debug msg="type of SIGNATURE is string"
time="2018-05-16T17:07:31+08:00" level=debug msg="procRset.Len()=1"
As you can see, it garbled, unknown code is in there, for instance, time="2018-05-16T17:07:31+08:00" level=debug msg="in case string, HAND_IMG_ID=曹*星306122758 "
Besides, some columns have values indeed while *ora.Rset
gives me nil
, this is wrong.
This error doesn't occur every time, but it occurs unpredictable.
For further log information, please refer to attachment, pay attention to #######
notes.
something is wrong.log
compair.log
Please try gopkg.in/goracle.v2, that is simpler, and should not have such concurrency data race issues.