r-dbi / odbc

Connect to ODBC databases (using the DBI interface)
https://odbc.r-dbi.org/
Other
392 stars 107 forks source link

Feature/db2 temp tables #823

Closed detule closed 4 months ago

detule commented 5 months ago

This is an attempt at finishing off https://github.com/r-dbi/odbc/pull/461

More detail on temporary tables in DB2 here.

> conn@info
$dbname
[1] "SAMPLE"

$dbms.name
[1] "DB2/LINUXX8664"

$db.version
[1] "11.05.0800"
...
$drivername
[1] "libdb2.a"

$odbcdriver.version
[1] "03.51"
....

DBI::dbExecute(conn, sqlCreateTable(conn, "testtbl", df, temporary = TRUE))
[1] -1
DBI::dbExecute(conn, sqlCreateTable(conn, "testtbl2", df, temporary = TRUE))
[1] -1
dbExistsTable(conn, name = "testtbl")
[1] TRUE
dbExistsTable(conn, name = "testtbl", schema_name = "SESSION")
[1] TRUE
dbExistsTable(conn, name = "testtbl2")
[1] TRUE
dbExistsTable(conn, name = "testtblnothere")
[1] FALSE
dbListTables(conn, schema_name="SESSION")
[1] "testtbl2" "testtbl"