Skip to content

Commit 48514d5

Browse files
committed
Misc review changes
1 parent a35a3a0 commit 48514d5

31 files changed

+203
-95
lines changed

src/docs/asciidoc/release_notes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ we recommend to always use `null` for `catalog`
561561
* `FirebirdConnection`/`FBConnection`
562562
** Added method `String getSearchPath()` to obtain the search path as reported by `RBB$GET_CONTEXT('SYSTEM', 'SEARCH_PATH')`, or `null` if schemas are not supported
563563
** Added method `List<String> getSearchPatList()` to obtain the search path as a list of unquoted object names, or empty list if schemas are not supported
564-
** Added methods `setSearchPath(String)` and `setSearchPathList(String...)/(List<String>)` where added to set the search path;
564+
** Added methods `setSearchPath(String)` and `setSearchPathList(String...)/(List<String>)` to set the search path;
565565
these methods throw `SQLFeatureNotSupportedException` if schemas are not supported.
566566
* `StatisticsManager`
567567
** `getTableStatistics`

src/main/org/firebirdsql/gds/AbstractVersion.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/**
1212
* Abstract version for {@code major.minor} version information.
1313
*
14+
* @author Mark Rotteveel
1415
* @since 7
1516
*/
1617
public abstract class AbstractVersion implements Comparable<AbstractVersion>, Serializable {

src/main/org/firebirdsql/gds/ServiceRequestBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ public interface ServiceRequestBuffer extends ParameterBuffer {
252252
/**
253253
* Repeatable buffer item for a table name for operation {@link #STATS_DATA_PAGES}.
254254
* <p>
255-
* For backwards compatibility, it can also be used as a flag, with a space separated list of table names in buffer
256-
* item {@link SpbItems#isc_spb_command_line}.
255+
* For backwards compatibility, it can also be used as an options flag, with a space separated list of table names
256+
* in buffer item {@link SpbItems#isc_spb_command_line}.
257257
* </p>
258258
*/
259259
int STATS_TABLE = ISCConstants.isc_spb_sts_table;

src/main/org/firebirdsql/gds/ng/OdsVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ private OdsVersion(int major, int minor) {
4141
*/
4242
public static OdsVersion of(int major, int minor) {
4343
if ((major & 0xFFFF) != major || (minor & 0xFFFF) != minor) {
44-
throw new IllegalArgumentException("Implementation limit for major or minor exceeded");
44+
throw new IllegalArgumentException(
45+
"Implementation limit for major or minor exceeded (must be between 0 and 65535)");
4546
}
4647
return ODS_VERSION_CACHE.computeIfAbsent(key(major, minor), ignored -> new OdsVersion(major, minor));
4748
}

src/main/org/firebirdsql/gds/ng/fields/FieldDescriptor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public final class FieldDescriptor {
7373
public FieldDescriptor(int position, DatatypeCoder datatypeCoder,
7474
int type, int subType, int scale, int length,
7575
String fieldName, String tableAlias,
76-
String originalName, String originalSchema, String originalTableName, String ownerName) {
76+
String originalName, String originalSchema, String originalTableName,
77+
String ownerName) {
7778
this.position = position;
7879
this.datatypeCoder = datatypeCoderForType(datatypeCoder, type, subType, scale);
7980
this.type = type;

src/main/org/firebirdsql/jaybird/parser/ObjectReferenceExtractor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* the parser again.
2222
* </p>
2323
*
24+
* @author Mark Rotteveel
2425
* @since 7
2526
*/
2627
public final class ObjectReferenceExtractor implements TokenVisitor {
@@ -62,9 +63,9 @@ public void visitToken(Token token, VisitorRegistrar visitorRegistrar) {
6263
identifiers.add(new Identifier(oldIdentifier.name(), identifierScope));
6364
this.previousTokenWasScopeSpecifierValue = true;
6465
} else {
65-
// End of identifier chain, we're no longer interested
66+
// End of identifier chain, we're no longer interested.
6667
// This is unexpected, but we're assuming future implementation of % as remainder or modular division
67-
// or some other kind of operator which would end the identifier chain
68+
// or some other kind of operator which would end the identifier chain.
6869
visitorRegistrar.removeVisitor(this);
6970
return;
7071
}
@@ -98,9 +99,8 @@ private boolean isScopeSpecifier(Token token) {
9899
}
99100

100101
private boolean isScopeSpecifierValue(Token token) {
101-
// SCHEMA is a reserved word, PACKAGE is not
102-
return token instanceof GenericToken && token.equalsIgnoreCase("PACKAGE")
103-
|| token instanceof ReservedToken && token.equalsIgnoreCase("SCHEMA");
102+
// NOTE: SCHEMA is a reserved word, PACKAGE is not
103+
return token.equalsIgnoreCase("PACKAGE") || token.equalsIgnoreCase("SCHEMA");
104104
}
105105

106106
@Override

src/main/org/firebirdsql/jaybird/parser/SearchPathExtractor.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
* This visitor is written for the needs of {@link SearchPathHelper#parseSearchPath(String)}, and
1616
* may not be generally usable.
1717
* </p>
18+
*
19+
* @author Mark Rotteveel
20+
* @since 7
1821
*/
1922
public final class SearchPathExtractor implements TokenVisitor {
2023

@@ -37,7 +40,8 @@ private void extractIdentifier(Token token, VisitorRegistrar visitorRegistrar) {
3740
if (token instanceof QuotedIdentifierToken quotedIdentifier) {
3841
identifiers.add(quotedIdentifier.name());
3942
} else if (token instanceof GenericToken identifier && identifier.isValidIdentifier()) {
40-
// Firebird returns the search path with quoted identifiers, but this offers extra flexibility if needed
43+
// Firebird returns the search path with quoted identifiers, but this way we can also parse unquoted
44+
// values (e.g. user-provided)
4145
identifiers.add(identifier.text().toUpperCase(Locale.ROOT));
4246
} else {
4347
// Unexpected token, end parsing
@@ -68,7 +72,7 @@ public void complete(VisitorRegistrar visitorRegistrar) {
6872
}
6973

7074
/**
71-
* The extract search path list, or empty if not parsed or if the parsed text was not a valid search path list.
75+
* The extracted search path list, or empty if not parsed or if the parsed text was not a valid search path list.
7276
*
7377
* @return immutable list of unquoted search path entries
7478
*/

src/main/org/firebirdsql/jaybird/parser/StatementIdentification.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public LocalStatementType getStatementType() {
4343
* It reports the name normalized to its metadata storage representation.
4444
* </p>
4545
*
46-
* @return Schema, {@code null} if the table was not qualified, or for {@code SELECT} and other non-DML statements
46+
* @return schema, {@code null} if the table was not qualified, or for {@code SELECT} and other non-DML statements
47+
* @since 7
4748
*/
4849
public @Nullable String getSchema() {
4950
return schema;
@@ -55,7 +56,7 @@ public LocalStatementType getStatementType() {
5556
* It reports the name normalized to its metadata storage representation.
5657
* </p>
5758
*
58-
* @return Table name, {@code null} for {@code SELECT} and other non-DML statements
59+
* @return table name, {@code null} for {@code SELECT} and other non-DML statements
5960
*/
6061
public @Nullable String getTableName() {
6162
return tableName;
@@ -78,13 +79,10 @@ public boolean returningClauseDetected() {
7879
*/
7980
private static @Nullable String normalizeObjectName(@Nullable Token objectToken) {
8081
if (objectToken == null) return null;
81-
String objectName = objectToken.text().trim();
82-
if (objectName.length() > 2
83-
&& objectName.charAt(0) == '"'
84-
&& objectName.charAt(objectName.length() - 1) == '"') {
85-
return objectName.substring(1, objectName.length() - 1).replace("\"\"", "\"");
82+
if (objectToken instanceof QuotedIdentifierToken quotedIdentifier) {
83+
return quotedIdentifier.name();
8684
}
87-
return objectName.toUpperCase(Locale.ROOT);
85+
return objectToken.text().toUpperCase(Locale.ROOT);
8886
}
8987

9088
}

src/main/org/firebirdsql/jaybird/parser/UnexpectedTokenException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* it from methods that a user calls to obtain the result of a token visitor.
1616
* </p>
1717
*
18+
* @author Mark Rotteveel
1819
* @since 7
1920
*/
2021
public class UnexpectedTokenException extends IllegalStateException {

src/main/org/firebirdsql/jaybird/props/DatabaseConnectionProperties.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ default void setMaxBlobCacheSize(int maxBlobCacheSize) {
827827
/**
828828
* @return the initial search path of the connection, {@code null} if the server default search path is used
829829
* @see #setSearchPath(String)
830+
* @since 7
830831
*/
831832
default String getSearchPath() {
832833
return getProperty(PropertyNames.searchPath);
@@ -845,6 +846,7 @@ default String getSearchPath() {
845846
*
846847
* @param searchPath
847848
* list of comma-separated schema names
849+
* @since 7
848850
*/
849851
default void setSearchPath(String searchPath) {
850852
setProperty(PropertyNames.searchPath, searchPath);

0 commit comments

Comments
 (0)