diff --git a/lib/SqlFormatter.php b/lib/SqlFormatter.php index 49e1d2f..0f4b37c 100644 --- a/lib/SqlFormatter.php +++ b/lib/SqlFormatter.php @@ -140,6 +140,9 @@ class SqlFormatter // This flag tells us if queries need to be enclosed in
tags
public static $use_pre = true;
+ // This flag determines if keywords should be uppercased
+ public static $uppercase = false;
+
// This flag tells us if SqlFormatted has been initialized
protected static $init;
@@ -684,6 +687,13 @@ public static function format($string, $highlight=true)
}
}
+ // 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, ' ');