Changeset: a1d24f190c8b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a1d24f190c8b
Modified Files:
        clients/R/MonetDB.R/NEWS
        clients/R/MonetDB.R/R/dbi.R
Branch: embedded
Log Message:

Patch to record sql statements to a file


diffs (35 lines):

diff --git a/clients/R/MonetDB.R/NEWS b/clients/R/MonetDB.R/NEWS
--- a/clients/R/MonetDB.R/NEWS
+++ b/clients/R/MonetDB.R/NEWS
@@ -1,5 +1,7 @@
 1.0.1
 - added isIdCurrent for improved compatibility with RSQLite
+- new option monetdb.log.query allows export of dbSendQuery statements to file
+
 
 1.0.0
 - Added support for esoteric data types such as MONTH_INTERVAL (Thanks, Roman)
diff --git a/clients/R/MonetDB.R/R/dbi.R b/clients/R/MonetDB.R/R/dbi.R
--- a/clients/R/MonetDB.R/R/dbi.R
+++ b/clients/R/MonetDB.R/R/dbi.R
@@ -260,9 +260,8 @@ setMethod("dbSendQuery", signature(conn=
   conn@connenv$exception <- list()
   env <- NULL
   if (getOption("monetdb.debug.query", F))  message("QQ: '", statement, "'")
-  # make the progress bar wait for querylog.define
-  # if (getOption("monetdb.profile", T))  .profiler_arm()
-
+  if(!is.null(log_file <- getOption("monetdb.log.query", NULL)))
+    cat(statement, file = log_file, sep = "\n", append = TRUE)
   # the actual request
   resp <- NA
   tryCatch({
@@ -342,6 +341,8 @@ setMethod("dbSendQuery", signature(conn=
   } 
   env <- NULL
   if (getOption("monetdb.debug.query", F)) message("QQ: '", statement, "'")
+  if(!is.null(log_file <- getOption("monetdb.log.query", NULL)))
+    cat(statement, file = log_file, sep = "\n", append = TRUE)
   startt <- Sys.time()
   resp <- MonetDBLite::monetdb_embedded_query(conn@connenv$conn, statement, 
notreally)
   takent <- round(as.numeric(Sys.time() - startt), 2)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to