Skip to content

Commit 838379f

Browse files
Oracle compliant ALTER TABLE ADD/MODIFY deparser (#1163)
* javadoc-fixes * fix check-style error : assignment to parameter not allowed * import for javadoc reference * javadoc - add description to parameter "fqn" (fix warning) * remove doclint=none, but exclude package with exclude package with generated sources (javacc/jjtree) from javadoc * Implement Oracle Hints for INSERT, UPDATE, MERGE, DELETE * Correct CreateIndex TailOptions Add a Test Case for CreateIndex TailOptions * Add WHERE expression to MergeInsert Add test case for MergeInsert WHERE expression * Fix Issue #1156: ALTER TABLE ADD FOREIGN KEY with schema reference Add a specific test case * Fix Issue #1157: Oracle does not accept COLUMN keyword in ALTER TABLE ADD/MODIFY Correct the test cases accepting a non existing COLUMN keyword Add a specific test cases * Fix Issue #1164 UNIQUE after PRIMARY KEY Add test case for UNIQUE after PRIMARY KEY * Switch of warnings for un-fixble method namings * Switch of warnings for un-fixble method namings * Activate PMD and define our own ruleset * Execute PMD before building/testing in order to fail early * Fix 63 PMD warnings * Activate rule "PMD.CyclomaticComplexity" in order to simulate the Codazy checks Apply @SuppressWarnings({"PMD.CyclomaticComplexity"}) where this rule throws an unavoidable warning (especially for toString() and deparse()) * Activate rule , "PMD.ExcessiveMethodLength" in order to simulate the Codazy checks Apply @SuppressWarnings({"PMD.ExcessiveMethodLength"}) where this rule throws an unavoidable warning (especially for toString() and deparse()) Refactor an ENUM name * Refactor an ENUM name and reflect this also in the JavaCC Parser definition file Co-authored-by: gitmotte <www@synbee.at>
1 parent 08cfd29 commit 838379f

File tree

13 files changed

+104
-73
lines changed

13 files changed

+104
-73
lines changed

pom.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
<id>attach-javadocs</id>
255255
<configuration>
256256
<additionalparam>${javadoc.opts}</additionalparam>
257-
<doclint>none</doclint>
257+
<excludePackageNames>net.sf.jsqlparser.parser</excludePackageNames>
258258
</configuration>
259259
<goals>
260260
<goal>jar</goal>
@@ -327,11 +327,12 @@
327327
<plugin>
328328
<groupId>org.apache.maven.plugins</groupId>
329329
<artifactId>maven-javadoc-plugin</artifactId>
330-
<version>3.1.0</version>
330+
<version>3.1.1</version>
331331
<configuration>
332332
<useStandardDocletOptions>true</useStandardDocletOptions>
333333
<maxmemory>800m</maxmemory>
334-
<doclint>none</doclint>
334+
<doclint>all, -missing</doclint>
335+
<excludePackageNames>net.sf.jsqlparser.parser</excludePackageNames>
335336
</configuration>
336337
</plugin>
337338
<plugin>
@@ -397,6 +398,8 @@
397398
</plugins>
398399
</build>
399400
</profile>
401+
402+
<!--
400403
<profile>
401404
<id>doclint-java8-disable</id>
402405
<activation>
@@ -406,6 +409,7 @@
406409
<javadoc.opts>-Xdoclint:none</javadoc.opts>
407410
</properties>
408411
</profile>
412+
-->
409413
<profile>
410414
<id>check.sources</id>
411415
<activation>

src/main/java/net/sf/jsqlparser/expression/CaseExpression.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@
2020
/**
2121
* CASE/WHEN expression.
2222
*
23-
* Syntax: <code><pre>
23+
* Syntax: <pre><code>
2424
* CASE
2525
* WHEN condition THEN expression
2626
* [WHEN condition THEN expression]...
2727
* [ELSE expression]
2828
* END
29-
* </pre></code>
29+
* </code></pre>
3030
*
31-
* <br/>
32-
* or <br/>
33-
* <br/>
31+
* <br>
32+
* or <br>
33+
* <br>
3434
*
35-
* <code><pre>
35+
* <pre><code>
3636
* CASE expression
3737
* WHEN condition THEN expression
3838
* [WHEN condition THEN expression]...
3939
* [ELSE expression]
4040
* END
41-
* </pre></code>
41+
* </code></pre>
4242
*
4343
*/
4444
public class CaseExpression extends ASTNodeAccessImpl implements Expression {

src/main/java/net/sf/jsqlparser/expression/DateValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public DateValue(Date value) {
3131
/**
3232
* A Date in the form {d 'yyyy-mm-dd'}
3333
*
34-
* @param value
34+
* @param value The text presentation of the Date to be parsed.
3535
*/
3636
public DateValue(String value) {
3737
this(Date.valueOf(value.substring(1, value.length() - 1)));

src/main/java/net/sf/jsqlparser/expression/Function.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public boolean isIgnoreNulls() {
7171
* This is at the moment only necessary for AnalyticExpression initialization and not for normal
7272
* functions. Therefore there is no deparsing for it for normal functions.
7373
*
74-
* @param ignoreNulls
7574
*/
7675
public void setIgnoreNulls(boolean ignoreNulls) {
7776
this.ignoreNulls = ignoreNulls;

src/main/java/net/sf/jsqlparser/expression/JdbcParameter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
1313

1414
/**
15-
* A '?' in a statement or a ?<number> e.g. ?4
15+
* A '?' in a statement or a ?&lt;number&gt; e.g. ?4
1616
*/
1717
public class JdbcParameter extends ASTNodeAccessImpl implements Expression {
1818

src/main/java/net/sf/jsqlparser/parser/SimpleCharStream.java

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ protected void FillBuff() throws IOException {
149149

150150
/**
151151
* Start.
152+
* @return the character read
153+
* @throws IOException
152154
*/
153155
public char BeginToken() throws IOException {
154156
tokenBegin = -1;
@@ -202,6 +204,8 @@ private char readChar(int pos) {
202204

203205
/**
204206
* Read a character.
207+
* @return the character read
208+
* @throws IOException
205209
*/
206210
public char readChar() throws IOException {
207211
if (inBuf > 0) {
@@ -227,54 +231,57 @@ public char readChar() throws IOException {
227231
return c;
228232
}
229233

230-
@Deprecated
234+
231235
/**
236+
* @return the column
232237
* @deprecated @see #getEndColumn
233238
*/
234-
239+
@Deprecated
235240
public int getColumn() {
236241
return bufcolumn[bufpos];
237242
}
238243

239-
@Deprecated
244+
240245
/**
246+
* @return the line
241247
* @deprecated @see #getEndLine
242248
*/
243-
249+
@Deprecated
244250
public int getLine() {
245251
return bufline[bufpos];
246252
}
247253

248254
/**
249-
* Get token end column number.
255+
* @return get token end column number.
250256
*/
251257
public int getEndColumn() {
252258
return bufcolumn[bufpos];
253259
}
254260

255261
/**
256-
* Get token end line number.
262+
* @return get token end line number.
257263
*/
258264
public int getEndLine() {
259265
return bufline[bufpos];
260266
}
261267

262268
/**
263-
* Get token beginning column number.
269+
* @return get token beginning column number.
264270
*/
265271
public int getBeginColumn() {
266272
return bufcolumn[tokenBegin];
267273
}
268274

269275
/**
270-
* Get token beginning line number.
276+
* @return get token beginning line number.
271277
*/
272278
public int getBeginLine() {
273279
return bufline[tokenBegin];
274280
}
275281

276282
/**
277283
* Backup a number of characters.
284+
* @param amount
278285
*/
279286
public void backup(int amount) {
280287

@@ -286,7 +293,11 @@ public void backup(int amount) {
286293
}
287294

288295
/**
289-
* Constructor.
296+
* Constructor
297+
* @param dstream
298+
* @param startline
299+
* @param startcolumn
300+
* @param buffersize
290301
*/
291302
public SimpleCharStream(Provider dstream, int startline,
292303
int startcolumn, int buffersize) {
@@ -309,22 +320,30 @@ public SimpleCharStream(Provider dstream, int startline,
309320
}
310321

311322
/**
312-
* Constructor.
323+
* Constructor
324+
* @param dstream
325+
* @param startline
326+
* @param startcolumn
313327
*/
314328
public SimpleCharStream(Provider dstream, int startline,
315329
int startcolumn) {
316330
this(dstream, startline, startcolumn, 4096);
317331
}
318332

319333
/**
320-
* Constructor.
334+
* Constructor
335+
* @param dstream
321336
*/
322337
public SimpleCharStream(Provider dstream) {
323338
this(dstream, 1, 1, 4096);
324339
}
325340

326341
/**
327342
* Reinitialise.
343+
* @param dstream
344+
* @param startline
345+
* @param startcolumn
346+
* @param buffersize
328347
*/
329348
public void ReInit(Provider dstream, int startline,
330349
int startcolumn, int buffersize) {
@@ -352,21 +371,25 @@ public void ReInit(Provider dstream, int startline,
352371

353372
/**
354373
* Reinitialise.
374+
* @param dstream
375+
* @param startline
376+
* @param startcolumn
355377
*/
356378
public void ReInit(Provider dstream, int startline,
357379
int startcolumn) {
358380
ReInit(dstream, startline, startcolumn, 4096);
359381
}
360382

361-
/**
362-
* Reinitialise.
363-
*/
383+
/**
384+
* Reinitialise.
385+
* @param dstream
386+
*/
364387
public void ReInit(Provider dstream) {
365388
ReInit(dstream, 1, 1, 4096);
366389
}
367390

368391
/**
369-
* Get token literal value.
392+
* @return get token literal value.
370393
*/
371394
public String GetImage() {
372395
if (isStringProvider) {
@@ -388,7 +411,8 @@ public String GetImage() {
388411
}
389412

390413
/**
391-
* Get the suffix.
414+
* @param len
415+
* @return get the suffix.
392416
*/
393417
public char[] GetSuffix(int len) {
394418

@@ -426,9 +450,11 @@ public void Done() {
426450

427451
/**
428452
* Method to adjust line and column numbers for the start of a token.
453+
* @param newLine
454+
* @param newCol
429455
*/
430-
@SuppressWarnings("checkstyle:parameterassignment")
431456
public void adjustBeginLineColumn(int newLine, int newCol) {
457+
int nl = newLine;
432458
int start = tokenBegin;
433459
int len;
434460

@@ -445,22 +471,22 @@ public void adjustBeginLineColumn(int newLine, int newCol) {
445471
int columnDiff = 0;
446472

447473
while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) {
448-
bufline[j] = newLine;
474+
bufline[j] = nl;
449475
nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
450476
bufcolumn[j] = newCol + columnDiff;
451477
columnDiff = nextColDiff;
452478
i++;
453479
}
454480

455481
if (i < len) {
456-
bufline[j] = newLine++;
482+
bufline[j] = nl++;
457483
bufcolumn[j] = newCol + columnDiff;
458484

459485
while (i++ < len) {
460486
if (bufline[j = start % bufsize] != bufline[++start % bufsize]) {
461-
bufline[j] = newLine++;
487+
bufline[j] = nl++;
462488
} else {
463-
bufline[j] = newLine;
489+
bufline[j] = nl;
464490
}
465491
}
466492
}

src/main/java/net/sf/jsqlparser/parser/feature/Feature.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import net.sf.jsqlparser.statement.create.procedure.CreateProcedure;
3434
import net.sf.jsqlparser.statement.create.schema.CreateSchema;
3535
import net.sf.jsqlparser.statement.create.sequence.CreateSequence;
36+
import net.sf.jsqlparser.statement.create.synonym.CreateSynonym;
3637
import net.sf.jsqlparser.statement.create.table.CreateTable;
3738
import net.sf.jsqlparser.statement.create.view.AlterView;
3839
import net.sf.jsqlparser.statement.create.view.CreateView;

src/main/java/net/sf/jsqlparser/schema/Column.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ public Column(String columnName) {
4343
* Retrieve the information regarding the {@code Table} this {@code Column} does
4444
* belong to, if any can be inferred.
4545
* <p>
46-
- * The inference is based only on local information, and not on the whole SQL command.
47-
- * For example, consider the following query:
48-
- * <blockquote><pre>
49-
- * SELECT x FROM Foo
50-
- * </pre></blockquote>
51-
- * Given the {@code Column} called {@code x}, this method would return {@code null},
52-
- * and not the info about the table {@code Foo}.
53-
- * On the other hand, consider:
54-
- * <blockquote><pre>
55-
- * SELECT t.x FROM Foo t
56-
- * </pre></blockquote>
57-
- * Here, we will get a {@code Table} object for a table called {@code t}.
58-
- * But because the inference is local, such object will not know that {@code t} is
59-
- * just an alias for {@code Foo}.
46+
* The inference is based only on local information, and not on the whole SQL command.
47+
* For example, consider the following query:
48+
* <blockquote><pre>
49+
* SELECT x FROM Foo
50+
* </pre></blockquote>
51+
* Given the {@code Column} called {@code x}, this method would return {@code null},
52+
* and not the info about the table {@code Foo}.
53+
* On the other hand, consider:
54+
* <blockquote><pre>
55+
* SELECT t.x FROM Foo t
56+
* </pre></blockquote>
57+
* Here, we will get a {@code Table} object for a table called {@code t}.
58+
* But because the inference is local, such object will not know that {@code t} is
59+
* just an alias for {@code Foo}.
6060
*
61-
- * @return an instance of {@link net.sf.jsqlparser.schema.Table} representing the
62-
- * table this column does belong to, if it can be inferred. Can be {@code null}.
61+
* @return an instance of {@link net.sf.jsqlparser.schema.Table} representing the
62+
* table this column does belong to, if it can be inferred. Can be {@code null}.
6363
*/
6464
public Table getTable() {
6565
return table;

0 commit comments

Comments
 (0)