StmtSet | R Documentation |
SET statement.
SET statement.
This class represents a SQL SET statement, used in UPDATE queries to set
field values. It can hold one or more field/value pairs.
The factory function make_set()
can be used to create
a SET statement more easily.
sqlq::Statement
-> StmtSet
new()
Initializer.
StmtSet$new()
Nothing.
add_field()
Add a field/value pair.
StmtSet$add_field(field, value)
field
The field, as an ExprField instance.
value
The value to set, as an Expr instance.
Nothing.
getTokens()
Generates the list of tokens representing this statement.
StmtSet$getTokens()
A list of Token objects.
clone()
The objects of this class are cloneable with this method.
StmtSet$clone(deep = FALSE)
deep
Whether to make a deep clone.
make_set()
# Create a SET statement with a single field/value pair:
set_stmt <- StmtSet$new()
set_stmt$add_field(ExprField$new("price"), ExprValue$new(9.50))
# Use the created SET statement inside an UPDATE query:
query <- QueryUpdate$new(StmtUpdate$new("books"), set = set_stmt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.