dbQuoteIdentifier-DatabaseConnectorConnection-character-method: Quote identifiers

Description Usage Arguments Value See Also

Description

Call this method to generate a string that is suitable for use in a query as a column or table name, to make sure that you generate valid SQL and protect against SQL injection attacks. The inverse operation is dbUnquoteIdentifier().

\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbQuoteIdentifier")}

Usage

1
2
## S4 method for signature 'DatabaseConnectorConnection,character'
dbQuoteIdentifier(conn, x, ...)

Arguments

conn

A DBIConnection object, as returned by dbConnect().

x

A character vector, SQL or Id object to quote as identifier.

...

Other arguments passed on to methods.

Value

dbQuoteIdentifier() returns an object that can be coerced to character, of the same length as the input. For an empty character vector this function returns a length-0 object. The names of the input argument are preserved in the output. When passing the returned object again to dbQuoteIdentifier() as x argument, it is returned unchanged. Passing objects of class SQL should also return them unchanged. (For backends it may be most convenient to return SQL objects to achieve this behavior, but this is not required.)

An error is raised if the input contains NA, but not for an empty string.

See Also

Other DBIResult generics: DBIResult-class, dbBind(), dbClearResult(), dbColumnInfo(), dbFetch(), dbGetInfo(), dbGetRowCount(), dbGetRowsAffected(), dbGetStatement(), dbHasCompleted(), dbIsReadOnly(), dbIsValid(), dbQuoteLiteral(), dbQuoteString(), dbUnquoteIdentifier()


DatabaseConnector documentation built on Nov. 18, 2021, 5:08 p.m.