summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Uppercasing reserved words #86HEADmasterErik Andersson2019-03-131-0/+8
|
* Add Indent Level as an arg for format method of Sqlformatter #88Erik Andersson2019-03-131-2/+2
|
* Merge pull request #79 from stof/patch-3origin/masterorigin/HEADJeremy Dorn2015-08-301-1/+1
|\ | | | | Switch Travis to the stable HHVM version
| * Switch Travis to the stable HHVM versionChristophe Coevoet2015-05-201-1/+1
|/
* Add support for named parameters (e.g. ":name"), treats them the same as ↵Jeremy Dorn2015-03-301-3/+3
| | | | variables (e.g. "@name"). Fixes #74
* Merge pull request #65 from glensc/cli-bin2Jeremy Dorn2014-07-281-4/+26
|\ | | | | Add color detection to bin/sql-formatter
| * update paths in non-cli helpElan Ruusamäe2014-06-061-3/+4
| |
| * autodetect colorsElan Ruusamäe2014-06-061-1/+22
| | | | | | | | | | so we can redirect output to file and it will not be colored while outputing to terminal it would be colored
* | Merge pull request #66 from Nyholm/patch-1Jeremy Dorn2014-07-081-0/+2
|\ \ | |/ |/| Added HHVM to travis.yml
| * Added HHVM to travis.ymlTobias Nyholm2014-07-081-0/+2
|/
* Merge pull request #46 from rajibahmed/masterJeremy Dorn2014-06-052-1/+20
|\ | | | | Add bin/sql-formatter console script
| * Add codes to sql-script removing require_once.Rajib Ahmed2013-06-271-1/+15
| |
| * Add sql-formatter executable by reusing cli.phpRajib Ahmed2013-06-272-1/+6
| | | | | | | | | | | | Fixed bin dir issue Fixed path
* | Add proper formatting for square bracket quoted strings (SQL Server style).Jeremy2014-04-167-15/+34
| | | | | | | | For #63
* | Merge pull request #63 from drakej/masterJeremy Dorn2014-04-161-3/+3
|\ \ | | | | | | Added EXEC as a reserved word, add square brackets as boundary characters.
| * | Fixed formattingJonathan Drake2014-04-161-1/+1
| | |
| * | Added brackets as token boundariesJonathan Drake2014-04-161-1/+1
| | |
| * | Added EXEC as a reserved wordJonathan Drake2014-04-161-2/+2
|/ /
* | Merge pull request #61 from h4cc/patch-1Jeremy Dorn2014-03-151-0/+2
|\ \ | | | | | | Added PHP 5.5 and 5.6 to travis.
| * | Added PHP 5.5 and 5.6 to travis.Julius Beckmann2014-03-151-0/+2
|/ /
* | Merge pull request #58 from domnikl/masterJeremy Dorn2014-01-222-1/+20
|\ \ | | | | | | Prevent warnings in highlightToken with binary data
| * | cleaner solution to highlight binary dataDominik Liebler2014-01-222-1/+20
| | | | | | | | | | | | and added new test highlightBinaryData to test for this case
| * | Prevent warnings in highlightTokenDominik Liebler2014-01-211-1/+1
|/ /
* | Fix PHP notice for queries that start with a boundary character.v1.2.17Jeremy Dorn2014-01-121-2/+2
| | | | | | | | This was caused by a missing isset check. Fixes #57
* | Fix formatting of negative numbers (fixes #49).v1.2.16Jeremy Dorn2013-11-277-17/+116
| | | | | | | | Improve phpunit code coverage.
* | Bump minor version number.Jeremy Dorn2013-11-271-1/+1
| |
* | Merge branch 'master' of https://github.com/augusteiner/sql-formatter into ↵Jeremy Dorn2013-11-271-5/+5
|\ \ | | | | | | | | | | | | | | | | | | augusteiner-master Conflicts: lib/SqlFormatter.php
| * | Corrected class name pass for closures.José Augusto de Araújo Nascimento2013-11-261-6/+6
| | |
* | | Optimized speed of initializing reserved words list.Michal Brašna2013-11-261-15/+4
|/ /
* | Increase PhpUnit code coverage.Jeremy Dorn2013-09-188-237/+853
| | | | | | | | | | | | Fix undefined variable $clause_limit notice. A couple PSR fixes. Bump version number.
* | Update pull #52 - // Checks if we are out of the limit clauseLairson Alencar2013-09-161-2/+2
| |
* | Update pull #52Lairson Alencar2013-09-161-0/+5
| |
* | #34 - Added formatting to SQL LIMITLairson Alencar2013-09-161-5/+17
| | | | | | | | The Formatting was added as suggested by leeoniya (issue #34).
* | A few PSR code fixes.Jeremy Dorn2013-09-021-5/+7
| |
* | Add highlighting support for binary/hex numbers and user-defined variables.Jeremy Dorn2013-09-024-20/+70
| | | | | | | | | | | | Add ":" to the boundary list (fixes ":=" assignment operator). Standardize whitespace around "if" clauses in the php code. Now there is always a space after "if" and before "(". Fixes #50
* | Made compress remove extra whitespace from reserved words. Fixes #51Jeremy Dorn2013-09-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ```sql LEFT OUTER JOIN ``` becomes ```sql LEFT OUTER JOIN ```
* | Bump version numberJeremy Dorn2013-07-111-1/+1
| |
* | Formatting and naming changes in order to merge @adityagoyal pull request.Jeremy Dorn2013-07-112-240/+195
| |
* | Merge branch 'master' of https://github.com/adityagoyal/sql-formatter into ↵Jeremy Dorn2013-07-102-14/+73
|\ \ | | | | | | | | | adityagoyal-master
| * | removeCommentsadityagoyal2013-07-061-1/+1
| | |
| * | Revert "test case"adityagoyal2013-07-061-1/+1
| | | | | | | | | | | | This reverts commit 3f39d54f21236e9afdf0e53f759c430d0fae9365.
| * | test caseadityagoyal2013-07-061-1/+1
| | |
| * | test caseadityagoyal2013-07-061-1/+1
| | |
| * | removed remove_blank_line method as suggested and calling format method to ↵adityagoyal2013-07-061-11/+1
| | | | | | | | | | | | | | | | | | | | | format after removing comments. removed remove_blank_line method as suggested and calling format method to format after removing comments.
| * | highlight mysql functions.adityagoyal2013-07-051-2/+71
| | | | | | | | | | | | | | | Added methods to highlight mysql functions.Removed now() ,count from reserved keyword.They are a part of mysql functions.
* | | Merge branch 'master' of https://github.com/adityagoyal/sql-formatter into ↵Jeremy Dorn2013-07-012-7/+26
|\ \ \ | |/ / | | / | |/ |/| adityagoyal-master
| * Added LEFT OUTER JOIN, RIGHT OUTER JOIN in newline reserved keys.Removed XOR.adityagoyal2013-06-301-0/+5
| | | | | | | | | | | | Added LEFT OUTER JOIN, RIGHT OUTER JOIN in newline reserved keys.Removed XOR. Added LEFT OUTER JOIN and RIGHT OUTER JOIN example for windows.
| * removed XOR as it was there in reserved newline.Added LEFT OUTER JOIN and ↵adityagoyal2013-06-301-2/+2
| | | | | | | | | | | | | | RIGHT OUTER JOIN in newline. removed XOR as it was there in reserved newline.Added LEFT OUTER JOIN and RIGHT OUTER JOIN in newline.
| * removed extra parenthesis and indented code by replacing tab with spaces.adityagoyal2013-06-301-16/+16
| | | | | | | | | | removed extra parenthesis and indented code by replacing tab with spaces.
| * added reserved keys for sql formatteradityagoyal2013-06-301-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added many reserved keywords of mysql. ( SQL_SMALL_RESULT , GEMINI,GEMINI_SPIN_RETRIES,MASTER_LOG_POS,MASTER_PASSWORD,MASTER_PORT,MASTER_USER,MATCH ,MAX_CONNECTIONS_PER_HOUR,MAX_QUERIES_PER_HOUR,MAX_ROWS,MAX_UPDATES_PER_HOUR,MAX_USER_C ONNECTIONS,RAID0,RAID_CHUNKS,RAID_CHUNKSIZE,RAID_TYPE, 'SQL_AUTO_IS_NULL', 'SQL_BIG_RESULT', 'SQL_BIG_SELECTS', 'SQL_BIG_TABLES', 'SQL_BUFFER_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_LOG_BIN', 'SQL_LOG_OFF', 'SQL_LOG_UPDATE', 'SQL_LOW_PRIORITY_UPDATES', 'SQL_MAX_JOIN_SIZE', 'SQL_QUOTE_SHOW_CREATE', 'SQL_SAFE_UPDATES', 'SQL_SELECT_LIMIT', 'SQL_SLAVE_SKIP_COUNTER', 'SQL_SMALL_RESULT', 'SQL_W STRIPED,true,'XOR')
| * removed new line between queriesadityagoyal2013-06-291-1/+12
| | | | | | | | | | Added a method remove_blank_lines(String) that checks for blank new line and removes it.
* | Added missing mysql 'CHARACTER SET' keywordStéphane Klein2013-06-241-1/+1
|/
* Added new compress method. Fixes #41Jeremy Dorn2013-06-126-6/+459
| | | | | Added test cases for CLI mode and compress method. Bumped patch version.
* Changed license to MIT to simplify inclusion in other libraries.v1.2.9jdorn2013-04-263-3/+24
|
* Improving block comment formatting. Fixes #37Jeremy Dorn2013-03-313-3/+5
|
* Fixing bug with comment formatting. Fixes #36Jeremy Dorn2013-03-313-15/+21
|
* Improved formatting of inline parentheses. Fixes #32Jeremy Dorn2013-03-205-366/+197
| | | | | Added "IFNULL" as a reserved word. Changed "NOW" to "NOW()" in the reserved word list so it can be used within inline parentheses.
* Changing example cli script to work with Unix pipes and command line arguments.Jeremy Dorn2013-03-151-1/+14
|
* Merge branch 'master' of https://github.com/jdorn/sql-formatterJeremy Dorn2013-03-145-123/+662
|\ | | | | | | | | Conflicts: lib/SqlFormatter.php
| * Splitting special reserved words into "top level reserved" and "newline ↵Jeremy Dorn2013-03-115-128/+667
| | | | | | | | | | | | | | reserved". Now, JOIN keywords and logical operators (AND, OR, etc.) have a new line before them. Fixes #30 Also adding the composer.lock file to VSC.
* | Adding support for CLI syntax highlighting. Fixes #33Jeremy Dorn2013-03-144-17/+95
|/
* Fixed formatting bug with multiple boundary characters (e.g. ">=", "<>", ↵Jeremy Dorn2013-03-076-24/+39
| | | | | | etc.). Fixes #29 Improved code coverage in unit tests. Now everything is covered except the infinite loop catching code which I don't know how to test.
* Fixing utf-8 encoding bug with PHP 5.3. Fixes #27Jeremy Dorn2013-03-073-5/+5
|
* Adding PHPUnit as a dev dependency.Jeremy Dorn2013-03-062-0/+5
|
* replace 'static' keyword by 'self' to be compatible with php 5.2Franck Magnan2013-03-061-3/+3
|
* fixed formattingFranck Magnan2013-03-051-3/+3
|
* remove option from output method and use attribute insteadFranck Magnan2013-03-051-12/+13
|
* adding option to deactivate preformatted textFranck Magnan2013-03-051-4/+23
|
* Fixed bug when formatting "SELECT#comment" without a space before "#".Jeremy Dorn2013-03-0310-5937/+2039
| | | | Added PHPUnit tests and .travis integration.
* Fixing bug with parsing long strings. PCRE was seg faulting. Fixes #25Jeremy Dorn2013-02-211-1/+1
|
* Using class constants for token types and token components now.Jeremy Dorn2013-02-101-61/+78
| | | | Resulted in a ~35% reduction in memory use and a slight decrease in performance.
* Improving splitQuery method. Fixes #22Jeremy Dorn2013-02-103-18/+35
|
* Making it easier to customize appearance.Jeremy Dorn2013-01-172-4137/+4138
| | | | | | Now, you can set whatever html attributes you want for each token type. Previously you could only set the value of the style attribute. You can also now set the html attributes for the containing pre tag. These changes make it easy to use classes instead of styles for example.
* Fixed bug with unterminated strings.Jeremy Dorn2013-01-081-27/+28
| | | | | Changed behavior when a parse error is encountered. It use to throw an exception, but now it just returns the remaining string as a single token. Split highlighting logic for backtick quote and other quotes to make the code cleaner.
* Fixed formatting bug when 2 special reserved words immediately followed each ↵Jeremy Dorn2012-12-294-7586/+1413
| | | | | | | | other. Added set operators to special reserved list (UNION, UNION ALL, EXCEPT, and INTERSECT). Updated test sql list to reduce the number of similar queries and better reflect real world usecases. Improved output of the regression test to make debugging easier.
* Removing "INSERT INTO" as a special reserved word. It looks better if ↵Jeremy Dorn2012-12-272-285/+197
| | | | formatted as a regular reserved word.
* Small bug fix and version bump.Jeremy Dorn2012-12-271-2/+2
|
* Fixing formatting bug when a special reserved word has multiple whitespace ↵Jeremy Dorn2012-12-271-3/+9
| | | | characters in the middle (e.g. "Group By").
* Fixed a couple formatting bugs. Added a few more optimizations.Jeremy Dorn2012-12-252-1450/+397
| | | | | | | | | | | | Specifically: - Fixed double newlines that were appearing in some cases - Improved algorithm for inline parentheses. Now "decimal(7,2)" and "(table.column) will be inline - Fixed formatting bug with "ON UPDATE CURRENT_TIMESTAMP" - Fixed bug with numbers followed immediately by quotes (e.g. 1"test") - Reduced calls to highlightToken() - Used if blocks instead of switch statement when deciding how to highlight token - Used single quoted strings when possible to avoid parsing overhead
* Fixed lots of formatting bugs and inconsistencies. Rewrote the format ↵Jeremy Dorn2012-12-242-7291/+4746
| | | | method to better handle indentation.
* Major refactoring of code to improve performance. Now using primarily ↵Jeremy Dorn2012-12-233-143/+12621
| | | | | | | regular expressions instead of loops. 2x performance increase. Found and fixed a minor bug in the process. "1.00" was being counted as 3 separate tokens ("1", ".", and "00") instead of a single number token. Added a simple regression testing script.
* Cleaned up documentation, improved performance test script and sample queries.Jeremy Dorn2012-12-234-94/+3711
|
* Implemented caching during tokenization. Added a script for testing ↵v1.2.0Jeremy Dorn2012-12-224-8/+162
| | | | performance. Bumped the dev version number.
* Merge pull request #18 from stloyd/masterJeremy Dorn2012-12-221-81/+99
|\ | | | | Some code readability cleanup and additional micro-optimizations
| * Some code readability cleanup and additional micro-optimizationsJoseph Bielawski2012-12-191-81/+99
|/
* Another optimization. Was performing an array merge for every format, ↵Jeremy Dorn2012-12-181-9/+14
| | | | changed it to only do it once.
* Merge pull request #16 from stloyd/patch-1Jeremy Dorn2012-12-181-16/+14
|\ | | | | Update lib/SqlFormatter.php
| * Update lib/SqlFormatter.phpJoseph Bielawski2012-12-181-16/+14
|/ | | Introduce some micro-optimizations
* Merge pull request #13 from stof/patch-2Jeremy Dorn2012-11-171-1/+1
|\ | | | | | | Fixed the branch alias for master
| * Fixed the branch alias for masterChristophe Coevoet2012-11-171-1/+1
|/
* Fixing several bugs.Jeremy Dorn2012-11-121-2/+6
| | | | | | An exception was being thrown when the last line of a query was a comment (without trailing \n). A PHP notice was being thrown when the last character in a query was a '('. A PHP notice was being thrown when the last part of a query was a '(' followed by a string or punctuation and missing the closing ')'.
* Version bump.v1.1.0Jeremy Dorn2012-11-111-2/+3
|
* Fixed bug that was marking "from" a reserved word in "select mytable.from"Jeremy Dorn2012-11-021-16/+23
|
* Adding more punctuation to the word boundary list.Jeremy Dorn2012-10-311-1/+1
|
* Fixing bug that was adding a space between a function name and the opening ↵Jeremy Dorn2012-10-311-4/+9
| | | | | | parentheses. Now, it will only add a space if there was whitespace there originally. Adding "NOW" as a reserved word.
* Small code style changes from pull request.Jeremy Dorn2012-10-121-3/+2
|
* UNIX mode restored (Fffuuuu).Mathieu Chabanon2012-10-121-2/+8
|
* Restructuring code to make it more maintainable.v1.0.1Jeremy Dorn2012-10-042-196/+324
| | | | | Adding parameter to SqlFormatter::format() to disable syntax highlighting. Making the code compatible with PHP 5.2 by getting rid of an anonymous function.
* Merge pull request #3 from stof/patch-1Jeremy Dorn2012-09-131-1/+1
|\ | | | | Changed the composer autoloading to use the classmap
| * Changed the composer autoloading to use the classmapChristophe Coevoet2012-09-141-1/+1
|/ | | | Using the ``files`` type is requiring the file on each request, even when it is not needed, instead of using the PHP autoloading.