private void WriteValues(ParserWriter writer, APSqlValuesClause clause, OracleCommand dbCmd) { if (clause != null && clause.Next != null) { writer.WriteLine(); writer.WriteDirect("VALUES"); APSqlSetPhrase phrase = clause.Next; bool isFirst = true; writer.Write('('); while (phrase != null) { if (!isFirst) { writer.Write(','); } else { isFirst = false; } if (!TryWriteValue(writer, phrase.Value)) { string paramName = "v_" + writer.GetSuitableParameterName(phrase.ParamName); writer.Write(":" + paramName); AddParameter(dbCmd, paramName, phrase.Value, ParameterDirection.Input); } phrase = phrase.Next as APSqlSetPhrase; } writer.Write(')'); } }
private void WriteInsert(ParserWriter writer, APSqlInsertCommand command, APSqlValuesClause clause) { writer.WriteDirect("INSERT INTO"); writer.Write(command.TableDef.TableName); if (clause != null && clause.Next != null) { APSqlSetPhrase phrase = clause.Next; bool isFirst = true; writer.Write("("); while (phrase != null) { if (!isFirst) { writer.Write(','); } else { isFirst = false; } writer.Write(phrase.AssignmentExpr.SelectExpr); phrase = phrase.Next as APSqlSetPhrase; } writer.Write(")"); } }
private void WriteSet(ParserWriter writer, APSqlValuesClause clause, SqlCommand dbCmd) { if (clause != null && clause.Next != null) { writer.WriteLine(); writer.WriteDirect("SET"); APSqlSetPhrase phrase = clause.Next; bool isFirst = true; while (phrase != null) { if (!isFirst) { writer.Write(','); } else { isFirst = false; } writer.Write(phrase.AssignmentExpr.SelectExpr); writer.Write("="); if (!TryWriteValue(writer, phrase.Value)) { string paramName = writer.GetSuitableParameterName(phrase.ParamName); writer.Write("@" + paramName); AddParameter(dbCmd, paramName, phrase.Value, ParameterDirection.Input); } phrase = phrase.Next as APSqlSetPhrase; } } }
/// <summary> /// SQL 'VALUES' clause extensions. Add new 'SET' in clause. /// </summary> /// <param name="command">The command.</param> /// <param name="phrases">The 'SET' phrases.</param> /// <returns>The command.</returns> public static APSqlInsertCommand set(this APSqlInsertCommand command, params APSqlSetPhrase[] phrases) { if (command.ValuesClause == null || command.ValuesClause.Next == null) { command.ValuesClause = new APSqlValuesClause(phrases); } else { APSqlSetPhrase exist = command.ValuesClause.Last as APSqlSetPhrase; exist.SetNext(phrases); } return(command); }
/// <summary> /// SQL 'VALUES' clause extensions. Add new 'SET' in clause. /// </summary> /// <param name="command">The command.</param> /// <param name="phrase">The 'SET' phrase.</param> /// <returns>The command.</returns> public static APSqlUpdateCommand set(this APSqlUpdateCommand command, APSqlSetPhrase phrase) { if (command.ValuesClause == null || command.ValuesClause.Next == null) { command.ValuesClause = new APSqlValuesClause(phrase); } else { APSqlSetPhrase exist = command.ValuesClause.Last as APSqlSetPhrase; exist.SetNext(phrase); } return(command); }
/// <summary> /// SQL 'VALUES' clause extensions. Add new 'SET' in clause. /// </summary> /// <param name="command">The command.</param> /// <param name="phrase">The 'SET' phrase.</param> /// <returns>The command.</returns> public static APSqlUpdateCommand set(this APSqlUpdateCommand command, APSqlSetPhrase phrase) { if (command.ValuesClause == null || command.ValuesClause.Next == null) { command.ValuesClause = new APSqlValuesClause(phrase); } else { APSqlSetPhrase exist = command.ValuesClause.Last as APSqlSetPhrase; exist.SetNext(phrase); } return command; }
/// <summary> /// SQL 'VALUES' clause extensions. /// </summary> /// <param name="command">The command.</param> /// <param name="phrase">The 'SET' phrase</param> /// <returns>The command.</returns> public static APSqlInsertCommand values(this APSqlInsertCommand command, APSqlSetPhrase phrase) { command.ValuesClause = new APSqlValuesClause(phrase); return(command); }
/// <summary> /// SQL 'VALUES' clause extensions. /// </summary> /// <param name="command">The command.</param> /// <param name="phrase">The 'SET' phrase</param> /// <returns>The command.</returns> public static APSqlUpdateCommand values(this APSqlUpdateCommand command, APSqlSetPhrase phrase) { command.ValuesClause = new APSqlValuesClause(phrase); return command; }
/// <summary> /// Create a new 'SET' clause with one 'SET' phrase. /// </summary> /// <param name="phrase">'SET' phrase.</param> public APSqlValuesClause(APSqlSetPhrase phrase) { SetNext(phrase); }
/// <summary> /// Create a new 'SET' clause with one 'SET' phrase. /// </summary> /// <param name="phrase">'SET' phrase.</param> public APSqlValuesClause(APSqlSetPhrase phrase) { SetNext(phrase); }