-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b39cae2
commit 741887d
Showing
40 changed files
with
358 additions
and
170 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
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
55 changes: 0 additions & 55 deletions
55
src/main/java/com/exasol/adapter/dialects/bigquery/BigQueryIdentifier.java
This file was deleted.
Oops, something went wrong.
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
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
64 changes: 64 additions & 0 deletions
64
src/main/java/com/exasol/adapter/dialects/impala/ImpalaIdentifier.java
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,64 @@ | ||
package com.exasol.adapter.dialects.impala; | ||
|
||
import java.util.Objects; | ||
|
||
import com.exasol.db.Identifier; | ||
|
||
/** | ||
* Represents an identifier in the Impala database. | ||
*/ | ||
public class ImpalaIdentifier implements Identifier { | ||
private final String id; | ||
|
||
private ImpalaIdentifier(final String id) { | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* Get the quoted identifier as a {@link String}. | ||
* | ||
* @return quoted identifier | ||
*/ | ||
@Override | ||
public String quote() { | ||
return "`" + this.id + "`"; | ||
} | ||
|
||
/** | ||
* Create a new {@link ImpalaIdentifier}. | ||
* | ||
* @param id the identifier as {@link String} | ||
* @return new {@link ImpalaIdentifier} instance | ||
*/ | ||
public static ImpalaIdentifier of(final String id) { | ||
if (validate(id)) { | ||
return new ImpalaIdentifier(id); | ||
} else { | ||
throw new AssertionError("E-ID-6: Unable to create identifier \"" + id // | ||
+ "\" because it contains illegal characters." // | ||
+ " For information about valid identifiers, please refer to" // | ||
+ " https://docs.cloudera.com/documentation/enterprise/latest/topics/impala_identifiers.html"); | ||
} | ||
} | ||
|
||
private static boolean validate(final String id) { | ||
return !id.contains("`"); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof ImpalaIdentifier)) { | ||
return false; | ||
} | ||
final ImpalaIdentifier that = (ImpalaIdentifier) o; | ||
return Objects.equals(this.id, that.id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(this.id); | ||
} | ||
} |
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
64 changes: 64 additions & 0 deletions
64
src/main/java/com/exasol/adapter/dialects/oracle/OracleIdentifier.java
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,64 @@ | ||
package com.exasol.adapter.dialects.oracle; | ||
|
||
import java.util.Objects; | ||
|
||
import com.exasol.db.Identifier; | ||
|
||
/** | ||
* Represents an identifier in the Oracle database. | ||
*/ | ||
public class OracleIdentifier implements Identifier { | ||
private final String id; | ||
|
||
private OracleIdentifier(final String id) { | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* Get the quoted identifier as a {@link String}. | ||
* | ||
* @return quoted identifier | ||
*/ | ||
@Override | ||
public String quote() { | ||
return "\"" + this.id + "\""; | ||
} | ||
|
||
/** | ||
* Create a new {@link OracleIdentifier}. | ||
* | ||
* @param id the identifier as {@link String} | ||
* @return new {@link OracleIdentifier} instance | ||
*/ | ||
public static OracleIdentifier of(final String id) { | ||
if (validate(id)) { | ||
return new OracleIdentifier(id); | ||
} else { | ||
throw new AssertionError("E-ID-3: Unable to create identifier \"" + id // | ||
+ "\" because it contains illegal characters." // | ||
+ " For information about valid identifiers, please refer to" // | ||
+ " https://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm"); | ||
} | ||
} | ||
|
||
private static boolean validate(final String id) { | ||
return !id.contains("\""); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof OracleIdentifier)) { | ||
return false; | ||
} | ||
final OracleIdentifier that = (OracleIdentifier) o; | ||
return Objects.equals(this.id, that.id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(this.id); | ||
} | ||
} |
Oops, something went wrong.