Example #1
0
// IsOpen returns a boolean indicating if the lob is open or not.
func (lv *ExternalLobVar) IsOpen() (bool, error) {
	var (
		err    error
		isOpen C.boolean
	)
	if err = lv.Verify(); err != nil {
		return false, errgo.Mask(

			// Py_BEGIN_ALLOW_THREADS
			err)
	}

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

			// Py_END_ALLOW_THREADS
			err)
	}

	return isOpen == C.TRUE, nil
}
Example #2
0
// IsOpen returns a boolean indicating if the lob is open or not.
func (lv *ExternalLobVar) IsOpen() (bool, error) {
	var (
		err    error
		isOpen C.boolean
	)
	if err = lv.Verify(); err != nil {
		return false, err
	}
	// Py_BEGIN_ALLOW_THREADS
	if err = lv.lobVar.environment.CheckStatus(
		C.OCILobIsOpen(lv.lobVar.connection.handle,
			lv.lobVar.environment.errorHandle,
			(*C.OCILobLocator)(unsafe.Pointer(&lv.lobVar.dataBytes[lv.pos*lv.lobVar.size])),
			&isOpen),
		"LobIsOpen"); err != nil {
		return false, err
	}
	// Py_END_ALLOW_THREADS
	return isOpen == C.TRUE, nil
}