-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructuring
Database.Connection
to allow for database specific ty…
…pes. (#3632) - Added `databases`, `database`, `set_database`. - Added `schemas`, `schema`, `set_schema`. - Added `table_types`, - Added `tables`. - Moved the vast majority of the connection work into a lower level `JDBC_Connection` object. - `Connection` represents the standard API for database connections and provides a base JDBC implementation. - `SQLite_Connection` has the `Connection` API but with custom `databases` and `schemas` methods for SQLite. - `Postgres_Connection` has the `Connection` API but with custom `set_database`, `databases`, `set_schema` and `schemas` methods for Postgres. - Updated `Redshift` - no public API change.
- Loading branch information
1 parent
551100a
commit 2b425f8
Showing
27 changed files
with
1,038 additions
and
461 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
461 changes: 92 additions & 369 deletions
461
distribution/lib/Standard/Database/0.0.0-dev/src/Connection/Connection.enso
Large diffs are not rendered by default.
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
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
10 changes: 0 additions & 10 deletions
10
distribution/lib/Standard/Database/0.0.0-dev/src/Error.enso
This file was deleted.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
distribution/lib/Standard/Database/0.0.0-dev/src/Errors.enso
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,80 @@ | ||
from Standard.Base import all | ||
|
||
polyglot java import java.sql.SQLException | ||
|
||
## Indicates that a requested operation is not supported, for example because a | ||
particular database backend does not support it. | ||
type Unsupported_Database_Operation_Error | ||
Unsupported_Database_Operation_Error_Data message | ||
|
||
## UNSTABLE | ||
|
||
Convert the SQL error to a textual representation. | ||
to_text : Text | ||
to_text self = | ||
"Unsupported database operation: " + self.message | ||
|
||
## UNSTABLE | ||
|
||
Pretty print the error. | ||
to_display_text : Text | ||
to_display_text self = | ||
"Unsupported database operation: " + self.message | ||
|
||
type Sql_Error | ||
## UNSTABLE | ||
|
||
Indicates an error with executing a query, update or connecting to the | ||
database. | ||
|
||
Arguments: | ||
- java_exception: The underlying exception. | ||
- related_query (optional): A string representation of a query that this | ||
error is related to. | ||
Sql_Error_Data java_exception related_query=Nothing | ||
|
||
## UNSTABLE | ||
|
||
Convert the SQL error to a textual representation. | ||
to_text : Text | ||
to_text self = | ||
query = if self.related_query.is_nothing.not then " [Query was: " + self.related_query + "]" else "" | ||
"There was an SQL error: " + self.java_exception.getMessage.to_text + "." + query | ||
|
||
## UNSTABLE | ||
|
||
Pretty print the SQL error. | ||
to_display_text : Text | ||
to_display_text self = self.to_text | ||
|
||
## PRIVATE | ||
|
||
Throws an error as if a SQL Exception was thrown. | ||
throw_sql_error : Text -> Sql_Error | ||
throw_sql_error message = | ||
Error.throw (Sql_Error_Data (SQLException.new message)) | ||
|
||
type Sql_Timeout_Error | ||
## UNSTABLE | ||
|
||
Indicates that an operation has timed out. | ||
|
||
Arguments: | ||
- java_exception: The underlying exception. | ||
- related_query (optional): A string representation of a query that this | ||
error is related to. | ||
Sql_Timeout_Error_Data java_exception related_query=Nothing | ||
|
||
## UNSTABLE | ||
|
||
Convert the timeout error to a textual representation. | ||
to_text : Text | ||
to_text self = | ||
query = if self.related_query.is_nothing.not then " [Query was: " + query + "]" else "" | ||
"The SQL connection timed out: " + self.java_exception.getMessage + "." + query | ||
|
||
## UNSTABLE | ||
|
||
Pretty print the timeout error. | ||
to_display_text : Text | ||
to_display_text self = self.to_text |
Oops, something went wrong.