Exemplo n.º 1
0
// FileExists returns a boolean indicating if the BFIILE lob exists.
func (lv *ExternalLobVar) FileExists() (bool, error) {
	var (
		err  error
		flag C.boolean
	)
	if err = lv.Verify(); err != nil {
		return false, errgo.Mask(

			// Py_BEGIN_ALLOW_THREADS
			err)
	}

	if CTrace {
		ctrace("OCILobFileExists(conn=%p, lob=%x, &flag=%p",
			lv.lobVar.connection.handle, lv.getHandleBytes(), &flag)
	}
	if err = lv.lobVar.environment.CheckStatus(
		C.OCILobFileExists(lv.lobVar.connection.handle,
			lv.lobVar.environment.errorHandle,
			lv.getHandle(), &flag),
		"LobFileExists",
	); err != nil {
		return false, errgo.Mask(

			// Py_END_ALLOW_THREADS
			err)
	}

	return flag == C.TRUE, nil
}
Exemplo n.º 2
0
// FileExists returns a boolean indicating if the BFIILE lob exists.
func (lv *ExternalLobVar) FileExists() (bool, error) {
	var (
		err  error
		flag C.boolean
	)
	if err = lv.Verify(); err != nil {
		return false, err
	}
	// Py_BEGIN_ALLOW_THREADS
	if err = lv.lobVar.environment.CheckStatus(
		C.OCILobFileExists(lv.lobVar.connection.handle,
			lv.lobVar.environment.errorHandle,
			(*C.OCILobLocator)(unsafe.Pointer(&lv.lobVar.dataBytes[lv.pos*lv.lobVar.size])),
			&flag), "LobFileExists"); err != nil {
		return false, err
	}
	// Py_END_ALLOW_THREADS

	return flag == C.TRUE, nil
}