\name{updateDBTable} \alias{updateDBTable} \title{Updating information in a database table} \description{ \code{updateDBTable} this function is, as the name already says, a wrapper method for the SQL UPDATE command. So information in a database table can be updated with this function, or missing data in a table row can be inserted. Also references can be updated. } \usage{ updateDBTable(con=NULL, name=NULL, set.col=NULL, where.col=NULL, new.values=NULL, old.values=NULL, condition="=", references=NULL, no.transaction=FALSE) } \arguments{ \item{con}{A connection object (create it with the dbConnect.PgSQL.conn function from the package RdbiPgSQL)} \item{name}{The table name} \item{set.col}{The column(s) that should be updated in the table. This argument can be omitted, if it is the same as the column names in a matrix or data.frame submitted as new.values.} \item{where.col}{The column(s) that can be used to search for the rows to update. This argument can also be omitted, if it is the same as the column names in the data.frame or matrix submitted as old.values argument.} \item{new.values}{The new value(s) that should be inserted in the table (or with wich old values should be updated).} \item{old.values}{The old values on which the function can perform a query to specify the rows that should be updated. In the case a references attribute is submitted, this matrix (or vector, or matrix) should contain a column, that contains values that are the same as those in the referenced table, to wich the specific row in the table to be updated should be linked (referenced) to.} \item{condition}{With this argument, the type of comparison can be specified, the default value is "=", but all other regular SQL queries can be used. To find the row to be updated the question will be asked, so in the default case: = is asked.} \item{references}{a list, or a single object of the type AutoReference, that represents the references to other tables, so that foreign keys can be updated/generated. Such a AutoReference object has to contain the name of the table to be updated, the referenced table, the name of the column in the argument and the column name in the referenced table. So the row to be inserted will be linked to the row in the referenced table, where the value in the attribute of the \code{AutoReference} object is the same as the value in the according column, that is specified in the attribute of the \code{AutoReference} object, of the argument.} \item{no.transaction}{if the whole call should not be performed into a TRANSACTION, so if any error occurrs during the processing of the function, the database will not be touched. The default value is FALSE, so the function is quite robust.} } \details{ For the people that know already a little bit of SQL, this function does nothing else as sending the query UPDATE SET = WHERE . It does this for a data.frame, matrix or single values submitted. So a whole table can be updated, some of the fields in a table or only one value. With the \code{reference} attribute also references to other tables can be updated. To do this, one or more columns (depending on the number of references to other tables) have to be inserted in the attribute, so that the function can update the reference upon the value in this column. } \references{} \author{Johannes Rainer} \seealso{ \code{\link{AutoReference-class}}, \code{\link{createDBTable}} } \examples{ } \keyword{data}