function testRemoveComments()
 {
     $expected = SqlFormatter::format("SELECT\n * FROM\n MyTable", false);
     $sql = "/* this is a comment */SELECT#This is another comment\n * FROM-- One final comment\n MyTable";
     $actual = SqlFormatter::removeComments($sql);
     $this->assertEquals($expected, $actual);
 }
Example #2
0
</div>
<table>
    <tr>
        <th>Original</th>
        <th>Comments Removed</th>
    </tr>
    <?php 
foreach ($comment_statements as $sql) {
    ?>
    <tr>
        <td>
            <pre><?php 
    echo SqlFormatter::highlight($sql);
    ?>
</pre>
        </td>
        <td>
            <pre><?php 
    echo SqlFormatter::highlight(SqlFormatter::removeComments($sql));
    ?>
</pre>
        </td>
    </tr>
    <?php 
}
?>
</table>

</body>
</html>