forked from dnsmkl/fsqlf
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TOOS-4434] Add CUBRID exclusive SQL grammer to Free SQL Formatter
**Purpose** - Modify to support CUBRID exclusive grammars. - Modify the makefile so that fsqlf only builds the CLI. **Changes** Add SQL statement - LIMIT - DIFFERENCE - USING INDEX - USING INDEX NONE - USE | FORCE | IGNORE INDEX Modify makefile - GUI, test, build archive, installation, CMake remove
- Loading branch information
Showing
37 changed files
with
4,339 additions
and
1,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "debuging.h" | ||
#include "../lib_fsqlf/kw/kw.h" | ||
#define YY_HEADER_EXPORT_START_CONDITIONS | ||
#include "../lib_fsqlf/formatter/lex.yy.h" | ||
|
||
|
||
int debug_level = DEBUGNONE ;//| DEBUGSTATES | DEBUGMATCHES; | ||
|
||
|
||
void debug_p() | ||
{ | ||
if (debug_level & DEBUGPARCOUNTS) { | ||
printf("\n\t*** %s ***\n", dump_paranthesis_counts()); | ||
} | ||
} | ||
|
||
|
||
void debug_match(char * debugstring) | ||
{ | ||
if (debug_level & DEBUGMATCHES) { | ||
printf("\n\t** %s **\n", debugstring); | ||
} | ||
} | ||
|
||
|
||
char *state_to_char(int state) | ||
{ | ||
char* state_str; | ||
switch (state) { | ||
case INITIAL: state_str="INITIAL" ; break; | ||
case stSELECT: state_str="stSELECT" ; break; | ||
case stFROM: state_str="stFROM" ; break; | ||
case stWHERE: state_str="stWHERE" ; break; | ||
case stON: state_str="stON" ; break; | ||
case stEXISTS: state_str="stEXISTS" ; break; | ||
case stLEFTP: state_str="stLEFTP" ; break; | ||
case stJOIN: state_str="stJOIN" ; break; | ||
case stCOMMA: state_str="stCOMMA" ; break; | ||
case stIN: state_str="stIN" ; break; | ||
case stINLIST: state_str="stINLIST" ; break; | ||
case stP_SUB: state_str="stP_SUB" ; break; | ||
case stCOMMENTML: state_str="stCOMMENTML" ; break; | ||
case stSTRING: state_str="stSTRING" ; break; | ||
case stFROM_LEFTP: state_str="stFROM_LEFTP" ; break; | ||
default: state_str="STATE NOT AVAILABLE"; | ||
} | ||
return state_str; | ||
} | ||
|
||
|
||
void debug_stchange(int newstate_int) | ||
{ | ||
char* currentstate = 0; | ||
char* newstate; | ||
|
||
// currentstate = state_to_char(YY_START); // FIXME: take YY_START param. | ||
newstate = state_to_char(newstate_int); | ||
|
||
if (debug_level & DEBUGSTATES) { | ||
printf("\n\t* %s->%s *\n", currentstate,newstate); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef debuging_h | ||
#define debuging_h | ||
|
||
|
||
#define DEBUGNONE (0) | ||
#define DEBUGSTATES (1) | ||
#define DEBUGMATCHES (2) | ||
#define DEBUGPARCOUNTS (4) | ||
|
||
|
||
extern int debug_level; | ||
|
||
|
||
void debug_p(); | ||
|
||
void debug_match(char * debugstring); | ||
|
||
char *state_to_char(int state); | ||
|
||
void debug_stchange(int newstate_int); | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
#include <lib_fsqlf.h> | ||
#include "../lib_fsqlf/conf_file/conf_file_read.h" // read_default_conf_file | ||
#include "../lib_fsqlf/kw/kwall_init.h" // init_all_settings | ||
#include "../lib_fsqlf/kw/kw.h" // init_all_settings | ||
#include "cli.h" // read_cli_options | ||
#include "../lib_fsqlf/formatter/lex.yy.h" // yyin, yyout | ||
|
||
|
||
int main(int argc, char **argv) | ||
{ | ||
// Initialise with STD I/O (later can be changed by command line options). | ||
FILE *fin, *fout; | ||
fin = stdin; | ||
fout = stdout; | ||
fsqlf_kwmap_t kwmap; | ||
yyin = stdin; | ||
yyout = stdout; | ||
|
||
fsqlf_kwmap_init(&kwmap); // Init default configs. | ||
fsqlf_kwmap_conffile_read_default(kwmap); // Read configs from file. | ||
read_cli_options(kwmap, argc, argv, &fin, &fout); // Read configs from command line. | ||
init_all_settings(&kw); // Init default configs. | ||
read_default_conf_file(&kw); // Read configs from file. | ||
read_cli_options(argc, argv, &kw, &yyin, &yyout); // Read configs from command line. | ||
|
||
fsqlf_format_file(kwmap, fin, fout); | ||
|
||
fsqlf_kwmap_destroy(kwmap); | ||
while (yylex() != 0) ; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef CONF_FILE_CONSTANTS_H | ||
#define CONF_FILE_CONSTANTS_H | ||
|
||
|
||
#ifndef FSQLF_CONFFILE_NAME | ||
#define FSQLF_CONFFILE_NAME "formatting.conf" | ||
#endif | ||
|
||
#ifndef FSQLF_CONFFILE_LINELENGTH | ||
#define FSQLF_CONFFILE_LINELENGTH (100) | ||
#endif | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.