summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/SqlFormatter.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/SqlFormatter.php b/lib/SqlFormatter.php
index 5e4b8a4..6696961 100644
--- a/lib/SqlFormatter.php
+++ b/lib/SqlFormatter.php
@@ -139,6 +139,9 @@ class SqlFormatter
// This flag tells us if queries need to be enclosed in <pre> tags
public static $use_pre = true;
+
+ // This flag determines if keywords should be uppercased
+ public static $uppercase = true;
// This flag tells us if SqlFormatted has been initialized
protected static $init;
@@ -684,6 +687,11 @@ class SqlFormatter
}
}
+ // Uppercase reserved words
+ if(self::$uppercase && in_array($token[self::TOKEN_TYPE],array(self::TOKEN_TYPE_RESERVED,self::TOKEN_TYPE_RESERVED_NEWLINE,self::TOKEN_TYPE_RESERVED_TOPLEVEL))) {
+ $highlighted = strtoupper($highlighted);
+ }
+
// If the token shouldn't have a space before it
if ($token[self::TOKEN_VALUE] === '.' || $token[self::TOKEN_VALUE] === ',' || $token[self::TOKEN_VALUE] === ';') {
$return = rtrim($return, ' ');