예제 #1
0
func addOrUpdataPlateResultToDb(r *PlateResultToDb) (err error) {
	db, err1 := nfdb.GetConn()
	if err1 != nil {
		return err1
	}

	row, err2 := db.Query("select nf_save_plate_result ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)", r.Serial, r.Bid, r.Nid, r.ParkStatus, r.ProvinceCode, r.ProvinceChar, r.CityCode, r.PlateNo, r.PlateLiteral, r.PlateImgUnique, r.PlateImgHistory)

	defer row.Close()
	if err2 != nil {
		return err2
	}
	//stmt, err2 := db.Prepare("select nf_save_plate_result ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)")
	//if err2 != nil {
	//	jlog.Error("db prepare stmt error: ", err2)
	//	return err2
	//}
	//_, err3 := stmt.Exec(r.Serial, r.Bid, r.Nid, r.ParkStatus, r.ProvinceCode, r.ProvinceChar, r.CityCode, r.PlateNo, r.PlateLiteral, r.PlateImgUnique, r.PlateImgHistory)
	//vvv22, err22 := result.LastInsertId()
	//vvv33, err33 := result.RowsAffected()
	//jlog.Debug(vvv22, err22, vvv33, err33)
	//if err3 != nil {
	//	jlog.Error("db exec stmt error: ", err3)
	//	return err3
	//}
	return nil
}
예제 #2
0
func queryAngleParamByDeviceSerial(serial string) (params []angleParamDb, err error) {
	db, err1 := nfdb.GetConn()
	if err != nil {
		return nil, err1
	}

	rows, err2 := db.Query("select * from tbl_jfcp_angle_param where device_serial = $1 order by bid, nid ", serial)
	if err2 != nil {
		return nil, err2
	}

	params = make([]angleParamDb, 0, 10)
	for rows.Next() {
		var ss angleParamDb
		err = rows.Scan(&ss.Id, &ss.DeviceSerial, &ss.RefMapBlockId, &ss.Bid, &ss.Bangle, &ss.Nid, &ss.Nangle, &ss.CropX, &ss.CropY, &ss.CropW, &ss.CropH, &ss.Remark)
		params = append(params, ss)
	}
	defer rows.Close()
	return params, nil
}