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. /// </summary> /// <param name="command">The command.</param> /// <param name="clause">The 'VALUES' clause.</param> /// <returns>The command.</returns> public static APSqlInsertCommand values(this APSqlInsertCommand command, APSqlValuesClause clause) { command.ValuesClause = clause; return(command); }
/// <summary> /// SQL 'VALUES' clause extensions. /// </summary> /// <param name="command">The command.</param> /// <param name="clause">The 'VALUES' clause.</param> /// <returns>The command.</returns> public static APSqlUpdateCommand values(this APSqlUpdateCommand command, APSqlValuesClause clause) { command.ValuesClause = clause; return command; }
private void WriteValues(ParserWriter writer, APSqlValuesClause clause, SqlCommand 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 = 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, OracleCommand 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 = "v_" + writer.GetSuitableParameterName(phrase.ParamName); writer.Write(":" + paramName); AddParameter(dbCmd, paramName, phrase.Value, ParameterDirection.Input); } phrase = phrase.Next as APSqlSetPhrase; } } }