←Select platform

FormatSqlOptions Class

Summary

Options that affect the result of the FormatSql.

Syntax

C#
C++/CLI
public class FormatSqlOptions 
public: 
   ref class FormatSqlOptions 

Example

C#
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 Members

Leadtools.Dicom.Common.Extensions Namespace

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 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.