src/pl/tcl/pltcl.c
static int
pltcl_subtransaction(ClientData cdata, Tcl_Interp *interp,
					 int objc, Tcl_Obj *const objv[])
{
	MemoryContext oldcontext = CurrentMemoryContext;
	ResourceOwner oldowner = CurrentResourceOwner;
	int			retcode;

	if (objc != 2)
	{
		Tcl_WrongNumArgs(interp, 1, objv, "command");
		return TCL_ERROR;
	}

	/*
	 * Note: we don't use pltcl_subtrans_begin and friends here because we
	 * don't want the error handling in pltcl_subtrans_abort.  But otherwise
	 * the processing should be about the same as in those functions.
	 */
	BeginInternalSubTransaction(NULL);
	MemoryContextSwitchTo(oldcontext);

	retcode = Tcl_EvalObjEx(interp, objv[1], 0);

	if (retcode == TCL_ERROR)
	{
		/* Rollback the subtransaction */
		RollbackAndReleaseCurrentSubTransaction();
	}
	else
	{
		/* Commit the subtransaction */
		ReleaseCurrentSubTransaction();
	}

	/* In either case, restore previous memory context and resource owner */
	MemoryContextSwitchTo(oldcontext);
	CurrentResourceOwner = oldowner;

	return retcode;
}
/**********************************************************************
 * pltcl_subtransaction()	- Execute some Tcl code in a subtransaction
 *
 * The subtransaction is aborted if the Tcl code fragment returns TCL_ERROR,
 * otherwise it's subcommitted.
 **********************************************************************/
pltcl_subtransaction()       - Execute some Tcl code in a subtransaction
The subtransaction is aborted if the Tcl code fragment returns TCL_ERROR,
otherwise it's subcommitted.
pltcl_subtransaction () - Execute some Tcl code in a subtransaction The subtransaction is aborted if the Tcl code fragment returns TCL_ERROR otherwise it ' s subcommitted .
static int
pltcl_subtransaction(ClientData cdata, Tcl_Interp *interp,
					 int objc, Tcl_Obj *const objv[])
{
	MemoryContext oldcontext = CurrentMemoryContext;
	ResourceOwner oldowner = CurrentResourceOwner;
	int			retcode;
	if (objc != 2)
	{
		Tcl_WrongNumArgs(interp, 1, objv, "command");
		return TCL_ERROR;
	}
	BeginInternalSubTransaction(NULL);
	MemoryContextSwitchTo(oldcontext);
	retcode = Tcl_EvalObjEx(interp, objv[1], 0);
	if (retcode == TCL_ERROR)
	{
		RollbackAndReleaseCurrentSubTransaction();
	}
	else
	{
		ReleaseCurrentSubTransaction();
	}
	MemoryContextSwitchTo(oldcontext);
	CurrentResourceOwner = oldowner;
	return retcode;
}
static int pltcl_subtransaction ( ClientData cdata , Tcl_Interp * interp , int objc , Tcl_Obj * const objv [ ] ) { MemoryContext oldcontext = CurrentMemoryContext ; ResourceOwner oldowner = CurrentResourceOwner ; int retcode ; if ( objc != 2 ) { Tcl_WrongNumArgs ( interp , 1 , objv , " " ) ; return TCL_ERROR ; } BeginInternalSubTransaction ( NULL ) ; MemoryContextSwitchTo ( oldcontext ) ; retcode = Tcl_EvalObjEx ( interp , objv [ 1 ] , 0 ) ; if ( retcode == TCL_ERROR ) { RollbackAndReleaseCurrentSubTransaction ( ) ; } else { ReleaseCurrentSubTransaction ( ) ; } MemoryContextSwitchTo ( oldcontext ) ; CurrentResourceOwner = oldowner ; return retcode ; }
pltcl_subtransaction()       - Execute some Tcl code in a subtransaction
 The subtransaction is aborted if the Tcl code fragment returns TCL_ERROR,
 otherwise it's subcommitted.
pltcl_subtransaction () - Execute some Tcl code in a subtransaction The subtransaction is aborted if the Tcl code fragment returns TCL_ERROR otherwise it ' s subcommitted .
/*
	 * Note: we don't use pltcl_subtrans_begin and friends here because we
	 * don't want the error handling in pltcl_subtrans_abort.  But otherwise
	 * the processing should be about the same as in those functions.
	 */ /* Rollback the subtransaction */ /* Commit the subtransaction */ /* In either case, restore previous memory context and resource owner */