Skip to content

Commit

Permalink
fix: issue JSQLParser#1791
Browse files Browse the repository at this point in the history
- Allow `START` keyword as table `CreateParameter`
  • Loading branch information
manticore-projects committed May 15, 2023
1 parent 8fb9110 commit 88d1b62
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 160 deletions.
42 changes: 21 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ plugins {
}

def getVersion = { boolean considerSnapshot ->
def major = 0
def minor = 0
def patch = 0
def build = 0
def commit = ""
def snapshot =""
Integer major = 0
Integer minor = 0
Integer patch = null
Integer build = null
def commit = null
def snapshot = ""
new ByteArrayOutputStream().withStream { os ->
exec {
workingDir "$projectDir"
def result = exec {
args = [
"--no-pager"
, "describe"
Expand All @@ -41,24 +40,25 @@ def getVersion = { boolean considerSnapshot ->
standardOutput = os
}
def versionStr = os.toString().trim()
def matcher = versionStr =~ /jsqlparser-(\d*)\.(\d*)(-(\d*)-([a-zA-Z\d]*))?/
matcher.find()

major = matcher[0][1]
minor = matcher[0][2]
if (matcher[0].size > 2) {
build = matcher[0][4]
commit = matcher[0][5]
def pattern = /(?<major>\d*)\.(?<minor>\d*)(\.(?<patch>\d*))?(-(?<build>\d*)-(?<commit>[a-zA-Z\d]*))?/
def matcher = versionStr =~ pattern
if (matcher.find()) {
major = matcher.group('major') as Integer
minor = matcher.group('minor') as Integer
patch = matcher.group('patch') as Integer
build = matcher.group('build') as Integer
commit = matcher.group('commit')
}

if (considerSnapshot && ( versionStr.endsWith('SNAPSHOT') || build>0) ) {
if (considerSnapshot && ( versionStr.endsWith('SNAPSHOT') || build!=null) ) {
minor++
patch = 0
snapshot = "-SNAPSHOT"
if (patch!=null) patch = 0
snapshot = "-SNAPSHOT"
}
println("Derived Version: $versionStr --> ${major}.${minor}.${patch}${snapshot}")
}
return "${major}.${minor}${snapshot}"
return patch!=null
? "${major}.${minor}.${patch}${snapshot}"
: "${major}.${minor}${snapshot}";
}
version = getVersion(true)
group = 'com.github.jsqlparser'
Expand Down
2 changes: 2 additions & 0 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -5446,6 +5446,8 @@ List<String> CreateParameter():
|
tk=<K_BINARY> { param.add(tk.image); }
|
tk=<K_START> { param.add(tk.image); }
|
(tk=<K_CHARACTER> tk2=<K_SET>) { param.add(tk.image); param.add(tk2.image);}
|
(<K_ARRAY_LITERAL> exp=ArrayConstructor(true)) { param.add(exp.toString()); }
Expand Down
Loading

0 comments on commit 88d1b62

Please sign in to comment.