18 using System.Collections.Generic;
24 namespace Deveel.Data.Sql.Statements {
27 : this(tableNames, false) {
31 if (tableNames == null)
32 throw new ArgumentNullException(
"tableNames");
33 if (tableNames.Length == 0)
34 throw new ArgumentException(
"The table name list cannot be empty",
"tableNames");
36 if (tableNames.Any(String.IsNullOrEmpty))
37 throw new ArgumentException(
"One of the specified table names is null.");
39 TableNames = tableNames;
44 : this(tableName, false) {
48 : this(new[] {tableName}, ifExists) {
51 public string[] TableNames {
get;
private set; }
53 public bool IfExists {
get; set; }
56 var tableNameList = TableNames.ToList();
57 var dropTables =
new List<string>();
59 foreach (var tableName
in tableNameList) {
60 if (dropTables.Contains(tableName, StringComparer.OrdinalIgnoreCase))
64 dropTables.Add(tableName);
67 var resolvedTableNames = dropTables.Select(context.
Query.ResolveTableName);
69 return new Prepared(resolvedTableNames.ToArray(), IfExists);
77 TableNames = tableNames;
88 public bool IfExists {
get;
private set; }
91 data.
SetValue(
"TableNames", TableNames);
An exception that happens during the SqlStatement.Prepare(IExpressionPreparer, IQueryContext).
DropTableStatement(string[] tableNames)
DropTableStatement(string tableName, bool ifExists)
void SetValue(string key, Type type, object value)
Describes the name of an object within a database.
Prepared(ObjectData data)
Represents the foundation class of SQL statements to be executed.
DropTableStatement(string tableName)
override void ExecuteStatement(ExecutionContext context)
override void GetData(SerializeData data)
Prepared(ObjectName[] tableNames, bool ifExists)
bool GetBoolean(string key)
object GetValue(string key)
IStatement Prepare(IRequest request)
DropTableStatement(string[] tableNames, bool ifExists)