本文整理匯總了Golang中github.com/flike/kingshard/mysql.Result.Status方法的典型用法代碼示例。如果您正苦於以下問題:Golang Result.Status方法的具體用法?Golang Result.Status怎麽用?Golang Result.Status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/flike/kingshard/mysql.Result
的用法示例。
在下文中一共展示了Result.Status方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handleOKPacket
func (c *Conn) handleOKPacket(data []byte) (*mysql.Result, error) {
var n int
var pos int = 1
r := new(mysql.Result)
r.AffectedRows, _, n = mysql.LengthEncodedInt(data[pos:])
pos += n
r.InsertId, _, n = mysql.LengthEncodedInt(data[pos:])
pos += n
if c.capability&mysql.CLIENT_PROTOCOL_41 > 0 {
r.Status = binary.LittleEndian.Uint16(data[pos:])
c.status = r.Status
pos += 2
//todo:strict_mode, check warnings as error
//Warnings := binary.LittleEndian.Uint16(data[pos:])
//pos += 2
} else if c.capability&mysql.CLIENT_TRANSACTIONS > 0 {
r.Status = binary.LittleEndian.Uint16(data[pos:])
c.status = r.Status
pos += 2
}
//info
return r, nil
}
示例2: mergeExecResult
func (c *ClientConn) mergeExecResult(rs []*mysql.Result) error {
r := new(mysql.Result)
for _, v := range rs {
r.Status |= v.Status
r.AffectedRows += v.AffectedRows
if r.InsertId == 0 {
r.InsertId = v.InsertId
} else if r.InsertId > v.InsertId {
//last insert id is first gen id for multi row inserted
//see http://dev.mysql.com/doc/refman/5.6/en/information-functions.html#function_last-insert-id
r.InsertId = v.InsertId
}
}
if r.InsertId > 0 {
c.lastInsertId = int64(r.InsertId)
}
c.affectedRows = int64(r.AffectedRows)
return c.writeOK(r)
}
示例3: readResultRows
func (c *Conn) readResultRows(result *mysql.Result, isBinary bool) (err error) {
var data []byte
for {
data, err = c.readPacket()
if err != nil {
return
}
// EOF Packet
if c.isEOFPacket(data) {
if c.capability&mysql.CLIENT_PROTOCOL_41 > 0 {
//result.Warnings = binary.LittleEndian.Uint16(data[1:])
//todo add strict_mode, warning will be treat as error
result.Status = binary.LittleEndian.Uint16(data[3:])
c.status = result.Status
}
break
}
result.RowDatas = append(result.RowDatas, data)
}
result.Values = make([][]interface{}, len(result.RowDatas))
for i := range result.Values {
result.Values[i], err = result.RowDatas[i].Parse(result.Fields, isBinary)
if err != nil {
return err
}
}
return nil
}
示例4: readResultColumns
func (c *Conn) readResultColumns(result *mysql.Result) (err error) {
var i int = 0
var data []byte
for {
data, err = c.readPacket()
if err != nil {
return
}
// EOF Packet
if c.isEOFPacket(data) {
if c.capability&mysql.CLIENT_PROTOCOL_41 > 0 {
//result.Warnings = binary.LittleEndian.Uint16(data[1:])
//todo add strict_mode, warning will be treat as error
result.Status = binary.LittleEndian.Uint16(data[3:])
c.status = result.Status
}
if i != len(result.Fields) {
err = mysql.ErrMalformPacket
}
return
}
result.Fields[i], err = mysql.FieldData(data).Parse()
if err != nil {
return
}
result.FieldNames[string(result.Fields[i].Name)] = i
i++
}
}