From ffc2dd0f3c6a2add7670050fc37f8a948548783d Mon Sep 17 00:00:00 2001 From: strangeqargo <“strangeqargo@gmail.com”> Date: Thu, 5 May 2016 02:40:44 +0300 Subject: [PATCH] doing --- scripts/ddl2cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/scripts/ddl2cpp b/scripts/ddl2cpp index 7b354d63..e9aa4ac1 100755 --- a/scripts/ddl2cpp +++ b/scripts/ddl2cpp @@ -81,15 +81,16 @@ if len(sys.argv) < (4): firstPositional = 1 timestampWarning = True -failOnParse = True - +failOnParse = False +warnOnParse = True +parseError = "parsing error, possible reason: can't parse default value for a field" optionalArgs = { # if -some-key is present, it will set variable someKey to True # if -no-some-key is present, it will set variable someKey to False 'timestamp-warning', # timeStampWarning = True # '-no-time-stamp-warning' # timeStampWarning = False 'fail-on-parse' # failOnParse = True - # 'no-fail-on-parse' # failOnParse = False + 'warn-on-parse' # warnOnParse = True } @@ -97,18 +98,27 @@ if len(sys.argv) >= 4: for arg in sys.argv: noArg = arg.replace('-no-', '') - + print (noArg) if arg in optionalArgs: + print ("AAAA") + print (noArg) setArgumentBool(arg, True) firstPositional += 1 elif noArg in optionalArgs: + print ("BBBB") setArgumentBool(noArg, False) firstPositional += 1 + else: + print ("abcd") + print(arg) + + -#sys.exit(0) pathToDdl = sys.argv[firstPositional] pathToHeader = sys.argv[firstPositional + 1] + '.h' namespace = sys.argv[firstPositional + 2] +print (pathToDdl) +sys.exit(0) INCLUDE = 'sqlpp11' NAMESPACE = 'sqlpp' @@ -173,17 +183,20 @@ if failOnParse: try: tableCreations = ddl.parseFile(pathToDdl) except ParseException as e: - print("parsing error, possible reason: can't parse default value for a field") + print(parseError) sys.exit() else: ddl = ZeroOrMore(Suppress(SkipTo(createTable, False)) + createTable) ddl.ignore(ddlComment) tableCreations = ddl.parseFile(pathToDdl) + +if warnOnParse: + print(parseError) + + # PROCESS DDL - - header = open(pathToHeader, 'w') print('// generated by ' + ' '.join(sys.argv), file=header) print('#ifndef '+get_include_guard_name(namespace, pathToHeader), file=header)