Description Usage Arguments Note Author(s) See Also Examples
Executes an SQL query expecting no output through an "odb" connection.
1 2 |
odb |
An |
sqlQueries |
Single or multiple character vector, with queries to be executed ordered in distinct elements. ";" query separation should not be used. |
onError |
Single character vector, defining how to handle SQL errors (using |
progress |
Single character vector, the type of progression to print when multiple queries are to be executed (See |
To query databases built with OpenOffice or LibreOffice, it may be necessary to quote table and/or column names in sqlQueries
, as the default behavior of the HSQL engine is to convert unquoted table and column names to uppercases.
Sylvain Mareschal
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # New empty .odb file
odbFile <- tempfile(fileext=".odb")
odb.create(odbFile, overwrite="do")
odb <- odb.open(odbFile)
# New table
odb.write(odb, "CREATE TABLE fruits (name VARCHAR(6) PRIMARY KEY)")
odb.insert(odb, "fruits", c("banana", "pear", "peach"))
print(odb.tables(odb))
# Manual insert
odb.write(odb, "INSERT INTO fruits VALUES('apple')")
print(odb.read(odb, "SELECT * FROM fruits"))
# Remove table
odb.write(odb, "DROP TABLE fruits")
print(odb.tables(odb))
# Writes to the file and closes the connection
odb.close(odb, write=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.