[Bioc-devel] Error during wrapup, what does this mean?

Seth Falcon sfalcon at fhcrc.org
Fri May 20 16:24:53 CEST 2005


"Dipl.-Ing. Johannes Rainer" <johannes.rainer at tugraz.at> writes:

> hi, it's again me, but i found the problem...
> as i am working with database connections and if an error occurs in a 
> function call i want to roll back the whole stuff that has been written 
> into a database, i thought to be smart and defined with
>
>> options(error=expression(.rollItBack(Con)))

I thought that was what had happened, but I didn't want to show off my
ESP so early in the morning ;-)

> now i want to ask how i can define a global variable from within a
> function.

You can use "<<-" and can also use assign.  You could also use
environments to pass information around since they do not get copied.

options(error=expression(.rollItBack(dbParams$con)))
dbParams <- new.env(parent=NULL)

dbParams[["user"]] <- "jo"
dbParams[["url"]] <- "blah"
doSomething(dbparams, query)


HTH,

+ seth



More information about the Bioc-devel mailing list