This is a tool that adds linebreaks and indentation to SQL source code.
Licensed under LGPL. Full license is available in file 'LICENSE', which you should have received with the program
fsqlf simply goes through provided input text, and tries to recognise a predefined set of keywords. If a keyword is recognized it adds spacing around it using settings in the configuration file (and to some level settings from CLI/GUI).
My use case is formatting generated SQL code - make something readable out of one long line of SQL code
Current list of implemented capabilities:
(see TODO list what is planned for future)
The following list actually should be sufficient. Look into 'makefile' for compilation instructions
Stuff that I got installed:
If you use Linux and have installed the same programs as I have (see section 2.1), then you can use the make file
# make all # Compile source for LINUX and WINDOWS. Excutables can be found in 'bin/' directory: 'fsqlf', 'fsqlf.exe', 'gui_wx_basic', 'gui_wx_basic.exe' # make test # Compile and run program on test file 'test.sql' and print output to console # make zip # Create zip archive with executables and source code binaries (for publishing) # make clean # Remove all files created with other make commands
# bin/fsqlf.exe # read from stdin, write to stdout # bin/fsqlf.exe input_file # read from file, write to stdout # bin/fsqlf.exe input_file output_file # use files for reading and writing # bin/fsqlf.exe --help # info on more options
Usage in Linux is equivalent, just without the extension '.exe' Formatting configuration can be changed in 'formatting.conf'
Go to directory 'bin/' (this is needed so 'wx_fsqlf.exe' would be started in the same folder where 'fsqlf.exe' is located) In Windows execute 'wx_fsqlf.exe' In Linux execute 'wx_fsqlf'
When it starts, just fill your code into the formatter window and press 'Format' Formating configuration can be changed in 'formatting.conf'
Most recent source code can be found at sourceforge. Project site address http://sourceforge.net/projects/fsqlf/ Source can also be forked at github https://github.com/dnsmkl/fsqlf
I use Debian, so I describe what I did. Your system probably is different, but maybe this will at least give you an idea in which direction to go.
Install WxWidgets (http://wiki.wxwidgets.org/Installing_and_configuring_under_Ubuntu)
#!/bin/bash # apt-get install libwxbase3.0-dev libwxgtk3.0-dev # cd /usr/include # ls | grep wx # ln -sv wx-3.0/wx wx
Install mingw (cross) compiler
#!/bin/bash # apt-get install mingw-w64
Download wxWidgets source from http://www.wxwidgets.org/
(some forums mention that sources provided by ubuntu/debian are not good,
after experiment it appeared that
apt-get source libwxbase3.0-dev,
doesn't contain several (external?) source files used by makefile e.g. png.c)
Build wxWidgets with mingw
#!/bin/bash # ./configure --prefix=/usr/i686-w64-mingw32 --host=i686-w64-mingw32 --build=`./config.guess` --enable-unicode --disable-shared # make # make install # cd /usr/i686-w64-mingw32/include # ln -sv wx-3.0/wx wx
This was done by following instructions found in http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux with a little adjustment by after reading http://forums.codeblocks.org/index.php?topic=7988.msg%msg_id% and http://old.nabble.com/mingwm10.dll-ts8920679.html