[#5626] Add DSL.name(Collection<String>)

This commit is contained in:
lukaseder 2016-10-31 11:30:55 +01:00
parent eee2643454
commit 76f378b35b

View File

@ -7011,6 +7011,33 @@ public class DSL {
return new NameImpl(qualifiedName);
}
/**
* Create a new SQL identifier using a qualified name.
* <p>
* Use this method to construct syntax-safe, SQL-injection-safe SQL
* identifiers for use in plain SQL where {@link QueryPart} objects are
* accepted. For instance, this can be used with any of these methods:
* <ul>
* <li> {@link #field(String, QueryPart...)}</li>
* <li> {@link #field(String, Class, QueryPart...)}</li>
* <li> {@link #field(String, DataType, QueryPart...)}</li>
* </ul>
* <p>
* An example: <code><pre>
* // This qualified name here
* name("book", "title");
*
* // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set
* [book].[title]
* </pre></code>
*
* @param qualifiedName The SQL identifier's qualified name parts
* @return A {@link QueryPart} that will render the SQL identifier
*/
public static Name name(Collection<String> qualifiedName) {
return new NameImpl(qualifiedName.toArray(Tools.EMPTY_STRING));
}
// -------------------------------------------------------------------------
// XXX QueryPart composition
// -------------------------------------------------------------------------