Retrieve id from a table matching query

get.id(table, colnames, values, con, create = FALSE, dates = FALSE)

Arguments

table

name of table

colnames

names of one or more columns used in where clause

values

values to be queried in fields corresponding to colnames

con

database connection object,

create

logical: make a record if none found?

dates

logical: update created_at and updated_at timestamps? Used only if `create` is TRUE

Value

will numeric

Examples

# NOT RUN {
pftid <- get.id("pfts", "name", "salix", con)
pftid <- get.id("pfts", c("name", "modeltype_id"), c("ebifarm.salix", 1), con)
# }