Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/SqlFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,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 = false;

// This flag tells us if SqlFormatted has been initialized
protected static $init;

Expand Down Expand Up @@ -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, ' ');
Expand Down