Exemplo n.º 1
0
func fbErrorCheckWarn(isc_status *[20]C.ISC_STATUS) error {
	var code C.short = C.short(C.isc_sqlcode(&isc_status[0]))
	if code != 0 {
		var buf [1024]C.ISC_SCHAR
		C.isc_sql_interprete(code, &buf[0], 1024)
		var msg bytes.Buffer
		for i := 0; buf[i] != 0; i++ {
			msg.WriteByte(uint8(buf[i]))
		}
		return &Error{int(code), msg.String()}
	}
	return nil
}
Exemplo n.º 2
0
func fbErrorCheck(isc_status *[20]C.ISC_STATUS) error {
	if isc_status[0] == 1 && isc_status[1] != 0 {
		var msg [1024]C.ISC_SCHAR
		var code C.short = C.short(C.isc_sqlcode(&isc_status[0]))

		C.isc_sql_interprete(code, &msg[0], 1024)
		var buf bytes.Buffer
		for i := 0; msg[i] != 0; i++ {
			buf.WriteByte(uint8(msg[i]))
		}
		buf.WriteString("\n")
		buf.WriteString(fbErrorMsg(&isc_status[0]))

		return &Error{int(code), buf.String()}
	}
	return nil
}