本文整理汇总了PHP中SqlFormatter::compress方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlFormatter::compress方法的具体用法?PHP SqlFormatter::compress怎么用?PHP SqlFormatter::compress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlFormatter
的用法示例。
在下文中一共展示了SqlFormatter::compress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUnionAll
/**
* Method to test union().
*
* @return void
*
* @covers Windwalker\Query\Query::union
*/
public function testUnionAll()
{
$query = $this->getQuery();
$query->unionAll($this->getQuery()->select('*')->from('foo')->where('a = b')->order('id'))->union($this->getQuery()->select('*')->from('foo')->where('a = b')->order('id'));
$sql = '( SELECT * FROM foo WHERE a = b ORDER BY id) UNION ALL ( SELECT * FROM foo WHERE a = b ORDER BY id)';
$this->assertEquals(\SqlFormatter::compress($sql), \SqlFormatter::compress($query));
}
示例2: foreach
<tr>
<th>Original</th>
<th>Compressed</th>
</tr>
<?php
foreach ($statements as $sql) {
?>
<tr>
<td>
<pre><?php
echo $sql;
?>
</pre>
</td>
<td><pre><?php
echo SqlFormatter::compress($sql);
?>
</pre></td>
</tr>
<?php
}
?>
</table>
<h1>Splitting SQL Strings Into Individual Queries</h1>
<div>
Usage:
<pre>
<?php
示例3: testReplace
/**
* Method to test replace().
*
* @return void
*
* @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::replace
*/
public function testReplace()
{
$expected = "REPLACE INTO {$this->qn}foo{$this->qn} (a,b) VALUES (c, d, e), (f, g, h)";
$actual = PostgresqlQueryBuilder::replace('foo', array('a', 'b'), array('c, d, e', 'f, g, h'));
$this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual));
}
示例4: testCompress
/**
* @dataProvider compressData
*/
function testCompress($sql, $html)
{
$this->assertEquals(trim($html), trim(SqlFormatter::compress($sql)));
}
示例5: print_sql
function print_sql($query)
{
if ($GLOBALS['cli']) {
print_vars($query);
} else {
if (class_exists('SqlFormatter')) {
// Hide it under a "database icon" popup.
#echo overlib_link('#', '<i class="oicon-databases"> </i>', SqlFormatter::highlight($query));
$query = SqlFormatter::compress($query);
echo '<p>', SqlFormatter::highlight($query), '</p>';
} else {
print_vars($query);
}
}
}