←Select platform

Is this page helpful?

In this page

NewLineBeforeWhereClause Property

Summary

Gets or sets a value indicating whether to include a line break before WHERE clauses in the formatted SQL result.

Syntax

C#
C++/CLI
public bool NewLineBeforeWhereClause { get; set; } 
public:  
   property bool NewLineBeforeWhereClause 
   { 
      bool get() 
      void set(bool value) 
   } 

Property Value

true to include a line break before WHERE clauses; otherwise, false.

Example

C#
Copied to clipboard
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

Target Platforms

See Also

FormatSqlOptions Class

FormatSqlOptions Members

Leadtools.Dicom.Common.Extensions Namespace

Help Version 22.0.2023.1.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Common Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.