options("width"=110)
tmp <- packageDescription( basename(getwd()) )
cat("#", tmp$Title)

Status

Project Status: WIP. cran checks Codecov

filelist.R   <- list.files("R", recursive = TRUE, pattern="\\.R$", ignore.case = TRUE, full.names = TRUE)
filelist.tests   <- list.files("tests", recursive = TRUE, pattern="\\.R$", ignore.case = TRUE, full.names = TRUE)
filelist.cpp <- list.files("src", recursive = TRUE, pattern="\\.cpp$", ignore.case = TRUE, full.names = TRUE)
lines.R      <- unlist(lapply(filelist.R, readLines))
lines.tests  <- unlist(lapply(filelist.tests, readLines))
lines.cpp    <- unlist(lapply(filelist.cpp, readLines))
length.R     <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.R,  value = TRUE, invert = TRUE))
length.tests <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.tests,  value = TRUE, invert = TRUE))
length.cpp   <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.cpp,  value = TRUE, invert = TRUE))

Zeilen R code: r length.R, Zeilen Test code: r length.tests

Packet Info

Version

source_files <- 
  grep(
    "/R/|/src/|/tests/",
    list.files(recursive = TRUE, full.names = TRUE), 
    value = TRUE
  )
last_change <- 
  as.character(
    format(max(file.info(source_files)$mtime), tz="UTC")
  )
cat(tmp$Version, "(",last_change,")")

Beschreibung

cat(tmp$Description)

Lizenz

cat(tmp$License, "<br>")
cat(tmp$Author)

Installation

Aktuelle Entwicklerversion auf Github:

devtools::install_github("chrisnice89/rdao")

Dokumentation

Für weiterführende Informationen und konkrete Anwendungen: Framework

Klassen

SqlConnection : Steuert Verbindung und ist Basis des SqlCommands

SqlCommand : Interface für CRUD Operationen

SqlResult : Ergebnis einer Abfrage

IDiamonds : Interface zur Geschäftslogik (exemplarisch)

Diamond : Business entity (exemplarisch)


Anwendung

Laden benötigter Pakete

# packages
library(RSQLite)
library(R6)
library(rdao)

Erstellen einer neuen Verbindung

# erstellen einer factory
f<-connectionFactory()

# Auswahl der Datenquelle und erforderliche Arguemnte übergeben
b<-f$dbFile("/Users/cnitz/Dev/R/rdao/db files external/Diamonds.db")

# Optionale Verbindungsparameter einstellen
b$addCredentials(username = "Admin",password = "SesameOpen")

# Verbindung erstellen
cnn<-b$build()

Generics

# Abfrage erstellen
library(rdao)
f<-connectionFactory()
b<-f$dbFile("/Users/cnitz/Dev/R/rdao/db files external/Diamonds.db")
cnn<-b$build()

result<-cnn$createQuery(sql = "Select carat,color FROM diamonds LIMIT 10")$fetch()
result$countRows()

m<-result$toMatrix()
m(i = 1,j=1)
m(2)
m(1,1:2)

result$setCarat(0.66)
result$row(1)$setCarat(0.99)
m(,1:2)
print(result)

result2<-cnn$createQuery(sql = "Select cut, price, depth FROM diamonds LIMIT 10")$fetch()
# Generic
print(result)
print(result2)


ChrisNice89/rdao documentation built on Aug. 26, 2022, 10:14 a.m.