public SchemaBuilder DropTable(string name) { var deleteTable = new DropTableCommand(String.Concat(_formatPrefix(_featurePrefix), name)); Run(deleteTable); return(this); }
public SchemaBuilder DropTable(string name) { var deleteTable = new DropTableCommand(FormatTable(name)); Execute(_builder.CreateSql(deleteTable)); return(this); }
public virtual IEnumerable <string> Run(DropTableCommand command) { var builder = new StringBuilder(); builder.Append(_dialect.GetDropTableString(command.Name)); yield return(builder.ToString()); }
/// <summary> /// Drop table /// </summary> protected long Drop() { long iRows = 0L; using (this.Connection.OpenWrapper()) { DropTableCommand dropCommand = new DropTableCommand(this.Connection, this.TableDefinition); iRows = dropCommand.Execute(100); } return(iRows); }
public override void Visit(DropTableCommand command) { if (ExecuteCustomInterpreter(command)) { return; } var builder = new StringBuilder(); builder.Append(_dialect.GetDropTableString(PrefixTableName(command.Name))); _sqlStatements.Add(builder.ToString()); RunPendingStatements(); }
public SchemaBuilder DropTable(string name) { try { var deleteTable = new DropTableCommand(Prefix(name)); Execute(_builder.CreateSql(deleteTable)); } catch { if (ThrowOnError) { throw; } } return(this); }
public override void Visit(DropTableCommand command) { _output.WriteLine("Dropping table {0}", command.Name); }
public abstract void Visit(DropTableCommand command);
public void Visit(DropTableCommand command) { }
public override void Visit(DropTableCommand command) { _output.WriteLine("// Dropping table {0}", command.Name); _output.WriteLine("\t\t\tSchemaBuilder.DropTable(\"{0}\", command.Name);"); }
public object executeCommand(string strSql) { object objReturn = null; if (_logSql) { System.IO.File.AppendAllText(_database.strLogLoc, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ": " + strSql + System.Environment.NewLine); } strSql = strSql.RemoveNewlines(" ").BacktickQuotes(); // TODO: WHOA! Super kludge for single quote escapes. See "Grave accent" in idiosyncracies. // Sorry, I got tired of forgetting this. //if (!strSql.Trim().EndsWith(";")) //{ // throw new Exception("Unterminated command."); //} // TODO: This is assuming a single command. Add splits by semi-colon. strSql = strSql.TrimEnd(';'); string[] astrCmdTokens = strSql.StringToNonWhitespaceTokens2(); // TODO: We're almost always immediately doing this again in the executeStatements. // TODO: Want to ISqlCommand this stuff -- we need to have execute // methods that don't take strings but "command tokens". switch (astrCmdTokens[0].ToLower()) { case "insert": _insertCommand = new InsertCommand(_database); // TODO: This is too much repeat instantiation. Rethink that. objReturn = _insertCommand.executeInsert(strSql); break; case "select": if (strSql.ToLower().StartsWith("select max(")) { SelectMaxCommand selectMaxCmd = new SelectMaxCommand(_database); objReturn = selectMaxCmd.executeStatement(strSql); } else { _selectCommand = new SelectCommand(_database); objReturn = _selectCommand.executeStatement(strSql); } break; case "delete": _deleteCommand = new DeleteCommand(_database); _deleteCommand.executeStatement(strSql); objReturn = "DELETE executed."; // TODO: Add ret val of how many rows returned break; case "update": _updateCommand = new UpdateCommand(_database); _updateCommand.executeStatement(strSql); objReturn = "UPDATE executed."; // TODO: Add ret val of how many rows returned break; case "create": switch (astrCmdTokens[1].ToLower()) { case "table": _createTableCommand = new CreateTableCommand(_database); objReturn = _createTableCommand.executeStatement(strSql); break; case "index": CreateIndexCommand createIndexCommand = new CreateIndexCommand(_database); objReturn = createIndexCommand.executeStatement(strSql); break; } break; case "drop": DropTableCommand dropTableCommand = new DropTableCommand(_database); dropTableCommand.executeStatement(strSql); objReturn = @"Table dropped (or, if ""IF EXISTS"" was used, dropped iff found)."; // TODO: These are pretty sorry messages. Have the executeStatement return something more informative. break; default: throw new SyntaxException("Syntax error: Unhandled command type."); } return(objReturn); }