# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab