Skip to content

Commit

Permalink
update DB functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrescino committed Sep 14, 2023
1 parent f04b8ba commit 5043dd5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/DBgetCSV.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DBgetCSV <- function(DBtable,

## Set options
opts <- options()
options(timeout = max(60000, getOption("timeout")))
options(timeout = max(80000, getOption("timeout")))
on.exit(options(opts))

# Stop if no arguments passed. No GUI available for this function
Expand Down
10 changes: 10 additions & 0 deletions R/DBgetEvalid.R
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,16 @@ DBgetEvalid <- function(states = NULL,
## Subset POP_EVAL/POP_EVAL_GRP by state and inventory type
# popevaltab <- POP_EVAL[POP_EVAL$EVAL_GRP_CN %in% POP_EVAL_GRPstcd$CN,]
popevalgrptab <- POP_EVAL_GRPstcd[POP_EVAL_GRPstcd$EVAL_GRP_Endyr %in% invtype.invyrs,]
if (nrow(popevalgrptab) == 0) {
if (nrow(POP_EVAL_GRPstcd) == 0) {
returnlst <- list(states=states, rslst=rslst,
evalidlist=evalidlist,
invtype=invtype, invyrtab=invyrtab,
invyrs=invyrs, evalType=evalTypelist,
FS_FIADB=FS_FIADB)
}
popevalgrptab <- POP_EVAL_GRPstcd
}
popevaltab <- POP_EVAL[POP_EVAL$EVAL_GRP_CN %in% popevalgrptab$CN,]
# popevaltab <- POP_EVAL[POP_EVAL$EVAL_GRP_CN %in% POP_EVAL_GRPstcd$CN &
# POP_EVAL$EVAL_TYP %in% evalTypelist[[state]],]
Expand Down
3 changes: 2 additions & 1 deletion R/DBgetSQLite.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ DBgetSQLite <- function (states = NULL,

## Set options
opts <- options()
options(timeout = max(1000000, getOption("timeout")))
options(timeout = max(100000, getOption("timeout")))
#options(download.file.method="libcurl", url.method="libcurl")
on.exit(options(opts))

## Set URL where data files are
Expand Down
4 changes: 2 additions & 2 deletions R/DBgetXY.R
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ DBgetXY <- function (states = NULL,
names(XYdf) <- toupper(names(XYdf))
xyflds <- names(XYdf)
}

## Check xy.uniqueid
xy.uniqueid <- pcheck.varchar(var2check=xy.uniqueid, varnm="xy.uniqueid",
gui=gui, checklst=xyflds, caption="UniqueID variable of xy",
Expand Down Expand Up @@ -690,7 +690,7 @@ DBgetXY <- function (states = NULL,
}

## Check for indices
if (evalCur || measCur) {
if (evalCur || measCur) {
chk <- checkidx(dbconn, plotnm, c("STATECD", "UNITCD", "COUNTYCD", "PLOT"))
if (is.null(chk)) {
message("to speed query... add an index to the plot table")
Expand Down
2 changes: 1 addition & 1 deletion R/spGetPlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ spGetPlots <- function(bnd = NULL,
if (!is.null(states)) {
states <- pcheck.states(states)
}

if (clipxy) {
###########################################################################
## Get XY
Expand Down

0 comments on commit 5043dd5

Please sign in to comment.