Browse Source

Correcting some workflow positions. Changing sqlDropLast to sqlLastDrop to avoid errors with sqlDrop.

main
Costa 2 years ago
parent
commit
3b8a4c0657
3 changed files with 7 additions and 7 deletions
  1. +3
    -3
      Docs/sqlFunctions-doc.Rmd
  2. +1
    -1
      sqlFunctions.R
  3. +3
    -3
      workflow.R

+ 3
- 3
Docs/sqlFunctions-doc.Rmd

@ -18,7 +18,7 @@ knitr::opts_chunk$set(echo = TRUE)
Removes from Database the last (or the amount specified) entry.
### Usage
sqlDropLast(conn, tablename, droplast=1, dbtype=NULL)
sqlLastDrop(conn, tablename, droplast=1, dbtype=NULL)
### Arguments
Argument|Description
@ -37,12 +37,12 @@ Invisibly for success (and failures cause errors).
### Examples
```r
dta<-odbcConnect("test")
sqlDropLast(dta, "TableTest")
sqlLastDrop(dta, "TableTest")
```
### Function
```r
sqlDropLast<-function(conn, tablename, droplast=1,dbtype=NULL){
sqlLastDrop<-function(conn, tablename, droplast=1,dbtype=NULL){
if(sqlTables(conn) %>% filter(TABLE_NAME == "UMID") %>% nrow > 0){dbtype<-"UM"}
if(sqlTables(conn) %>% filter(TABLE_NAME == "OVID") %>% nrow > 0){dbtype<-"OV"}

+ 1
- 1
sqlFunctions.R

@ -1,6 +1,6 @@
require(RODBC)
sqlDropLast<-function(conn, tablename, droplast=1,dbtype=NULL){
sqlLastDrop<-function(conn, tablename, droplast=1,dbtype=NULL){
if(sqlTables(conn) %>% filter(TABLE_NAME == "UMID") %>% nrow > 0){dbtype<-"UM"}
if(sqlTables(conn) %>% filter(TABLE_NAME == "OVID") %>% nrow > 0){dbtype<-"OV"}

+ 3
- 3
workflow.R

@ -6,13 +6,13 @@ sqlInitialize()
## Asegurarse de que la variable file sea la que nos corresponde:
file
# Crear copia de seguridad
sqlBackUp()
# Inicializar conexión
dta<-odbcConnectAccess2007(access.file = file,
pwd = .rs.askForPassword("Enter password:"))
# Crear copia de seguridad
sqlBackUp()
## Importamos los NHC de las muestras nuevas
nhc.test<-read.xlsx("queryOV.xlsx", sheet = "NHC") %>% pull(NHC)

Loading…
Cancel
Save