<commit_before><?php
// module/Dboss/view/query/index.phtml:

$form = $this->form;

$params = array(
    'action'            => 'index',
    'connection_string' => $this->connection_string,
);

$form->setAttribute('action', $this->url('query', $params));
$form->prepare();
?>

<form class="form-horizontal" id="query_form" method="post">
    <fieldset>
        <legend>Execute Query</legend>
        <div class="control-group">
            <div class="controls">
                <textarea name="sql" id="sql"><?php echo $form->get('sql')->getValue() ?></textarea>
            </div>
        </div>

        <hr>

        <div class="row">
            <div class="col-sm-3">
                <?php $value = $form->get('multiple_queries')->getValue() ?>
                <select name="multiple_queries" class="form-control">
                    <option value="1" <?php echo ($value == 1) ? 'selected="selected"' : ""?>>Run multiple queries</option>
                    <option value="0" <?php echo ($value == 0) ? 'selected="selected"' : ""?>>Run as a single query</option>
                </select>
            </div>
            <div class="col-sm-3">
                <?php $value = $form->get('run_in_transaction')->getValue() ?>
                <select name="run_in_transaction" class="form-control">
                    <option value="1" <?php echo ($value == 1) ? 'selected="selected"' : ""?>>Run queries in a transaction</option>
                    <option value="0" <?php echo ($value == 0) ? 'selected="selected"' : ""?>>Don't add a transaction</option>
                </select>
            </div>
        </div>
        <br>
        <div class="form-actions">
            <div class="row">
                <div class="col-sm-1 col-md-1">
                    <input name="run_submit" type="submit" value="Run" class="btn btn-primary">
                </div>
                <div class="col-sm-11 col-md-11">
                    <div class="input-group">
                        <input
                            type="text" name="query_name"
                            id="query_name"
                            class="form-control"
                            placeholder="Name your query to be saved for later"
                            value="<?php echo $form->get('query_name')->getValue() ?>"
                        >
                        <span class="input-group-btn">
                            <button name="save_query" id="save_query" value="Save" class="btn btn-default" type="submit">Save</button>
                        </span>
                    </div>
                </div>
            </div>
            <span style="color: #999">Press F5 or SHIFT + ENTER will also Run</span>
        </div>
    </fieldset>
</form>

<?php $query_num = 0; ?>
<?php foreach ($results as $result): ?>

<?php $query_num++ ?>
<?php $count = count($result); ?>

<section id="statement_<?php echo $query_num ?>">
    <h4>
        <strong><?php echo $count; ?></strong> record(s) in *unknown*
        <strong> <?php //echo round($this->logger->queries[$query_num]['executionMS'], 3) ?></strong> seconds
        <small> <?php echo substr($result->getResource()->queryString, 0, 100); ?></small>
    </h4>
    <hr>
    <div class="row">
        <?php if ($count > 0): ?>
        <div style="overflow-x: auto;">
            <table class="table table-condensed table-striped">
                <thead>
                <tr>
                    <?php for ($index = 0; $index < $result->getResource()->columnCount(); $index++): ?>
                        <?php $meta = $result->getResource()->getColumnMeta($index) ?>
                        <th><?php echo $meta['name'] ?></th>
                    <?php endfor ?>
                </tr>
                </thead>
                <tbody>
                <?php while ($row = $result->getResource()->fetch(\PDO::FETCH_NUM)): ?>
                <tr>
                    <?php foreach ($row as $value): ?>
                        <td>
                            <pre class="query-result">
                            <?php echo ($value === null ? "<em>NULL</em>" : $value) ?>
                            </pre>
                        </td>
                    <?php endforeach ?>
                </tr>
                <?php endwhile ?>
                </tbody>
            </table>
        </div>
        <?php endif ?>
    </div>
</section>
<?php endforeach ?>



<?php foreach ($errors as $error): ?>
    <br><commit_msg>Fixed <pre> formatting Ticket: Purpose of Change: Description of Change: Tags:<commit_after><?php
// module/Dboss/view/query/index.phtml:

$form = $this->form;

$params = array(
    'action'            => 'index',
    'connection_string' => $this->connection_string,
);

$form->setAttribute('action', $this->url('query', $params));
$form->prepare();
?>

<form class="form-horizontal" id="query_form" method="post">
    <fieldset>
        <legend>Execute Query</legend>
        <div class="control-group">
            <div class="controls">
                <textarea name="sql" id="sql"><?php echo $form->get('sql')->getValue() ?></textarea>
            </div>
        </div>

        <hr>

        <div class="row">
            <div class="col-sm-3">
                <?php $value = $form->get('multiple_queries')->getValue() ?>
                <select name="multiple_queries" class="form-control">
                    <option value="1" <?php echo ($value == 1) ? 'selected="selected"' : ""?>>Run multiple queries</option>
                    <option value="0" <?php echo ($value == 0) ? 'selected="selected"' : ""?>>Run as a single query</option>
                </select>
            </div>
            <div class="col-sm-3">
                <?php $value = $form->get('run_in_transaction')->getValue() ?>
                <select name="run_in_transaction" class="form-control">
                    <option value="1" <?php echo ($value == 1) ? 'selected="selected"' : ""?>>Run queries in a transaction</option>
                    <option value="0" <?php echo ($value == 0) ? 'selected="selected"' : ""?>>Don't add a transaction</option>
                </select>
            </div>
        </div>
        <br>
        <div class="form-actions">
            <div class="row">
                <div class="col-sm-1 col-md-1">
                    <input name="run_submit" type="submit" value="Run" class="btn btn-primary">
                </div>
                <div class="col-sm-11 col-md-11">
                    <div class="input-group">
                        <input
                            type="text" name="query_name"
                            id="query_name"
                            class="form-control"
                            placeholder="Name your query to be saved for later"
                            value="<?php echo $form->get('query_name')->getValue() ?>"
                        >
                        <span class="input-group-btn">
                            <button name="save_query" id="save_query" value="Save" class="btn btn-default" type="submit">Save</button>
                        </span>
                    </div>
                </div>
            </div>
            <span style="color: #999">Press F5 or SHIFT + ENTER will also Run</span>
        </div>
    </fieldset>
</form>

<?php $query_num = 0; ?>
<?php foreach ($results as $result): ?>

<?php $query_num++ ?>
<?php $count = count($result); ?>

<section id="statement_<?php echo $query_num ?>">
    <h4>
        <strong><?php echo $count; ?></strong> record(s) in *unknown*
        <strong> <?php //echo round($this->logger->queries[$query_num]['execution'], 3) ?></strong> seconds
        <small> <?php echo substr($result->getResource()->queryString, 0, 100); ?></small>
    </h4>
    <hr>
    <div class="row">
        <?php if ($count > 0): ?>
        <div style="overflow-x: auto;">
            <table class="table table-condensed table-striped">
                <thead>
                <tr>
                    <?php for ($index = 0; $index < $result->getResource()->columnCount(); $index++): ?>
                        <?php $meta = $result->getResource()->getColumnMeta($index) ?>
                        <th><?php echo $meta['name'] ?></th>
                    <?php endfor ?>
                </tr>
                </thead>
                <tbody>
                <?php while ($row = $result->getResource()->fetch(\PDO::FETCH_NUM)): ?>
                <tr>
                    <?php foreach ($row as $value): ?>
                        <td>
<pre class="query-result">
<?php echo ($value === null ? "<em>NULL</em>" : $value) ?>
</pre>
                        </td>
                    <?php endforeach ?>
                </tr>
                <?php endwhile ?>
                </tbody>
            </table>
        </div>
        <?php endif ?>
    </div>
</section>
<?php endforeach ?>



<?php foreach ($errors as $error): ?>
    <br>
{'fraction_non_alphanumeric': 0.17863947102992267, 'fraction_numerical': 0.0067241958982405025, 'mean_word_length': 1.597962154294032, 'pattern_counts': {'":': 0, '<': 234, '<?xml version=': 0, '>': 284, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5989143', 'n_tokens_mistral': 2555, 'n_tokens_neox': 2424, 'n_words': 569}