NewLineBeforeHavingClause Property (original) (raw)
Summary
Gets or sets a value indicating whether to include a line break before HAVING
clauses in the formatted SQL result.
Syntax
public bool NewLineBeforeHavingClause { get; set; }
public:
property bool NewLineBeforeHavingClause
{
bool get()
void set(bool value)
}
Property Value
true to include a line break before HAVING
clauses; otherwise, false.
Example
using Leadtools.Dicom;
using Leadtools.Dicom.Common;
using Leadtools.Dicom.Common.Extensions;
using Leadtools;
using Leadtools.Dicom.Common.Linq.BasicDirectory;
using Leadtools.Dicom.Common.DataTypes;
using Leadtools.Codecs;
public static void FormatSqlExample()
{
// unformatted SQL
string sql =
$"SELECT Patient.PatientID FROM Instance " +
$"INNER " +
$"JOIN Series on Instance.SeriesInstanceUID " +
$"= Series.SeriesInstanceUID INNER JOIN Study on Series.StudyInstanceUID = " +
$"Study.StudyInstanceUID INNER JOIN Patient on Study.PatientID = Patient.PatientID WHERE " +
$"Patient.PatientID Like '%1%' ORDER BY PatientID";
Formatters.FormatSqlOptions options = new Formatters.FormatSqlOptions();
options.NewLineBeforeFromClause = true;
options.NewLineBeforeGroupByClause = true;
options.NewLineBeforeHavingClause = true;
options.NewLineBeforeJoinClause = true;
options.NewLineBeforeOrderByClause = true;
options.NewLineBeforeWhereClause = true;
string formattedSql = Formatters.FormatSql(sql, options);
// This is the result:
//
// SELECT Patient.PatientID
// FROM Instance
// INNER JOIN Series on Instance.SeriesInstanceUID = Series.SeriesInstanceUID
// INNER JOIN Study on Series.StudyInstanceUID = Study.StudyInstanceUID
// INNER JOIN Patient on Study.PatientID = Patient.PatientID
// WHERE Patient.PatientID Like '%1%'
// ORDER BY PatientID
Console.WriteLine(formattedSql);
}
Requirements
See Also
Leadtools.Dicom.Common.Extensions Namespace
Leadtools.Dicom.Common Assembly