Exemple #1
0
//AttrGetName retrieves the name of the parent's attribute identified by key
func (env *Environment) AttrGetName(parent unsafe.Pointer, parentType, key int,
	errText string) ([]byte, error) {
	var (
		nameLen C.ub4
		status  C.sword
	)
	if CTrace {
		ctrace("OCIAttrGetName", parent, C.ub4(parentType),
			C.ub4(key), env.errorHandle,
			&status, &nameLen)
	}
	name := C.AttrGetName(parent, C.ub4(parentType),
		C.ub4(key), env.errorHandle,
		&status, &nameLen)
	if err := env.CheckStatus(status, errText); err != nil {
		Log.Error("AttrGetName", "attr", key, "error", err)
		return nil, err
	}
	result := C.GoBytes(unsafe.Pointer(name), C.int(nameLen))
	return result, nil
}
Exemple #2
0
func (env *Environment) AttrGetName(parent unsafe.Pointer, parentType, key int,
	errText string) ([]byte, error) {
	var (
		name_len C.ub4
		status   C.sword
	)
	if CTrace {
		ctrace("OCIAttrGetName", parent, C.ub4(parentType),
			C.ub4(key), env.errorHandle,
			&status, &name_len)
	}
	name := C.AttrGetName(parent, C.ub4(parentType),
		C.ub4(key), env.errorHandle,
		&status, &name_len)
	if err := env.CheckStatus(status, errText); err != nil {
		// log.Printf("error getting char attr: %s", err)
		return nil, err
	}
	// log.Printf("name_len=%d name=%v", name_len, name)
	result := C.GoBytes(unsafe.Pointer(name), C.int(name_len))
	// log.Printf("dst=%s = %v", result, result)
	return result, nil
}