SQLines Report Reference

SQLines allows you to generate customized assessment and conversion reports.

The concept is similar to ASP or PHP scripts. A report file is a file of any type (HTML, XML, text etc) that contains SQLines report elements surrounded by the delimiters <?= and ?>.

During the report generation SQLines replaces the code within <?= … ?> with the actual report data, leaving the outside content as is (for example, outer HTML tags - titles, tables etc)

For example:

<h1>Assessment Report - <?= source(); ?> to <?= target(); ?> Migration</h1>
  <b>Company: </b><?= option("company"); ?><br>
  <b>Application: </b><?= option("application_name"); ?> 
<h2>Summary</h2>
 <b>Total Number of Files: </b><?= $files.count; ?>, <?= $files.totalSize; ?>, <?= $files.totalLines; line(s) ?>

Language

In a SQLines report, you can use any valid SQLines language constructions and syntax including $if, $foreach statements, variable declarations, built-in functions and expressions.

For more information on SQLines language, see SQLines Conversion Language Reference

Comments

To comment embedded SQLines code, use -- for single line or /* */ for multi-line comments.

SQLines code comments must be used within <?= … ?> embedded code delimiters. The generated report does not contain code comments.

If you want to specify comments outside the code blocks, use the comment syntax appropriate for the resulting report file, for example, <!-- ... --> for HTML or XML file comments. The generated report contains comments of this type.

For example:

<!-- HTML comment -->

<?= /* SQLines embedded code comment */ ?>

$files Variable

$files variable contains information about the source files. The following properties are available:

  • count - the total number of the source files
  • totalSize - the total size of the all source files in bytes
  • totalSizeStr - the total size of the all source files in bytes (if the size in less than 1 MB), otherwise in megabytes, includes bytes or Mb string
  • totalLines - the total number of lines of code in the all source files
  • totalTime - the total conversion/assessment time in seconds

Examples:

Report template Sample output
<?= $files.count; ?> files 51 files
<?= $files.totalSize; ?> bytes 1258500 bytes
<?= $files.totalSizeStr; ?> 1.2 Mb
<?= $files.totalLines; ?> lines 345693 lines
<?= $files.totalTime; ?> sec 3 sec

$files variable contains an array of values, and besides summary information, you can also obtain details for each file:

  • $files[current] - the full file name
  • $files[current].index - the index of the file in the array (starts from 1)
  • $files[current].relativeName - relative file name to the path specified by -source option
  • $files[current].size - the file size
  • $files[current].lines - the total number of lines in the file
  • $files[current].time - the processing time

For example:

<?= $foreach($files) {
 <tr>
   <td>$files[current].index;</td>
   <td>$files[current].relativeName;</td>
   <td>$files[current].size;</td>
   <td>$files[current].lines;</td>
   <td>$files[current].time;  sec</td>
   </tr> } 
 ?>

$filesExt Variable

$filesExt is an array variable that contains summary information about the source file extensions. The following properties are available:

  • $filesExt[current] - extension name (.sql i.e.)
  • $filesExt[current].index - the index of an item in the array (starts from 1)
  • $filesExt[current].addCalls - the total number of source files with this extension
  • $filesExt[current].size - the total size in bytes of files with this extension
  • $filesExt[current].lines - the total number of lines in the files with this extension
  • $filesExt[current].time - the processing time of the files with this extension

For example:

<tr>
   <th>#</th><th>Extension</th><th>Files</th><th>Size</th><th>Lines</th><th>Time</th>
 </tr> 
<?= $foreach($filesExt) {
 <tr>
   <td>$filesExt[current].index;</td>
   <td>$filesExt[current];</td>
   <td>$filesExt[current].addCalls;</td>
   <td>$filesExt[current].size;</td>
   <td>$filesExt[current].lines;</td>
   <td>$filesExt[current].time; sec</td>
   </tr> } 
 ?>

Sample output:

# Extension Files Size Lines Time
1 .sql 106 1871918 40922 3 sec
2 .txt 76 575845 10402 3 sec