dmkaplan2000 / rh2 Goto Github PK
View Code? Open in Web Editor NEWR package containing DBI/RJDBC interface to h2 database
R package containing DBI/RJDBC interface to h2 database
Would be nice to handle such basic method as dbIsValid
library(RH2)
dbIsValid(dbConnect(H2(), "jdbc:h2:mem:"))
# Error in (function (classes, fdef, mtable) :
# unable to find an inherited method for function 'dbIsValid' for signature '"H2Connection"'
while
library(RSQLite)
dbIsValid(dbConnect(SQLite(), "sqlite.db"))
# [1] TRUE
DBI defines dbGetQuery as submit query+retrieve results and dbSendQuery just to submit query. RH2 seems to break that rule and here dbSendQuery expects to retrieve results anyway - which results error.
Can we get a consistency with DBI and be able to use dbSendQuery for any kind of submit queries? The one mentioned below (drop table) is just an example, the behavior is the same when using other submit queries, e.g. create sequence
.
library(RH2)
conn <- dbConnect(H2(), "jdbc:h2:mem:")
dbWriteTable(conn, "mytab", data.frame(a = 1:3, b = letters[1:3]))
# [1] TRUE
nrow(dbReadTable(conn, "mytab"))==3L
# [1] TRUE
dbSendQuery(conn, "drop table mytab;")
# Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", :
# Unable to retrieve JDBC result set for drop table mytab; (Method is only allowed for a query. Use execute or executeUpdate instead of executeQuery; SQL statement: drop table mytab; [90002-175])
library(RSQLite)
conn <- dbConnect(RSQLite::SQLite(), dbname = "sqlite.db")
dbWriteTable(conn, "mytab", data.frame(a = 1:3, b = letters[1:3]))
# [1] TRUE
nrow(dbReadTable(conn, "mytab"))==3L
# [1] TRUE
dbSendQuery(conn, "drop table mytab;")
# <SQLiteResult>
Hi,
Any chance for support boolean types? currently they are queried as character, see below.
library(RJDBC)
library(RH2)
con <- dbConnect(H2(), "jdbc:h2:~/test", "sa", "")
s <- 'create table tt("id" int primary key, "logical" BOOLEAN)'
dbSendUpdate(con, s)
dbSendUpdate(con, "insert into tt values(1, TRUE)")
str(dbGetQuery(con, "select * from tt"))
# 'data.frame': 1 obs. of 2 variables:
# $ id : num 1
# $ logical: chr "TRUE"
dbGetQuery(con, "select COLUMN_NAME, TYPE_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'tt'")
# COLUMN_NAME TYPE_NAME
#1 id INTEGER
#2 logical BOOLEAN
packageVersion("RH2")
# [1] ‘0.2.3’
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.