Displaying 4 results from an estimated 4 matches for "dbbegintransact".
2012 Mar 27
1
RSqlite UPDATE command problem
...1 US 52
2 UK 36
3 Canada 74
4 Australia 10
5 NewZealand 98
So, say, I want to change the value for NewZealand to '21' from '98'
I've tried something like this:
sql<-"UPDATE testtable SET vals=21 WHERE countries='NewZealand'"
dbBeginTransaction(con)
dbGetPreparedQuery(con,sql) <========== I get an error here
dbCommit(con)
using a different example for an INSERT command using a data frame 'data',
this construct is accepted:
dbGetPreparedQuery(con,sql,bind.data=data)
What do I need to do differently to use the UPDATE comman...
2011 Jan 14
3
RSQLite - How to express(or save) a dataframe as an output?
...#39;** Initializing','')
drv <- dbDriver("SQLite", shared.cache = TRUE)
con <- dbConnect(drv, dbname = "temp.db",
loadable.extensions=TRUE)
on.exit(dbUnloadDriver(drv))
on.exit(dbDisconnect(con))
write('** Save output', '')
dbBeginTransaction(con)
dbGetPreparedQuery(con, "INSERT INTO output(df) VALUES (?)", data.frame(output))
dbCommit(con)
>
dbGetPreparedQuery(con,
"INSERT INTO output(df) VALUES (?)",
data.frame(output))
# ---------------------------...
2012 Mar 17
0
tryCatch interferes with traceback(), debugger(), dump.frames()....
...tch, but tryCatch seems to obscure important things I
need for debugging.
For example, say I am working with an SQLite database, and have written
this function:
debugThisFunction <- function(dbfile) {
require(RSQLite)
drv <- SQLite()
conn <- dbConnect(drv, dbfile)
tryCatch({
dbBeginTransaction(conn)
tryCatch({
for (i in 1:10) {
somethingWhichCrashesSometimes()
}
}, error = function(e) {dbRollback(conn); stop(e)})
dbCommit(conn)
}, finally=dbDisconnect(conn))
}
somethingWhichCrashesSometimes <- function() {
v <- runif(1)
y <- runif(v*1...
2010 Nov 15
5
How to Read a Large CSV into a Database with R
Hi, I'm working in R 2.11.1 x64 on Windows x86_64-pc-mingw32. I'm trying to
insert a very large CSV file into a SQLite database. I'm pretty new to
working with databases in R, so I apologize if I'm overlooking something
obvious here.
I'm trying to work with the American Community Survey data, which is two
1.3GB csv files. I have enough RAM to read one of them into memory,