-
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.
- Loading branch information
Showing
8 changed files
with
77 additions
and
5 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
25 changes: 22 additions & 3 deletions
25
distribution/std-lib/Database/src/Connection/Database.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 |
---|---|---|
@@ -1,11 +1,30 @@ | ||
from Base import all | ||
import Database.Connection.Connection | ||
from Database.Connection.Connection import all | ||
|
||
connect : Text -> Nothing | Text -> Nothing | Text -> JDBC_Connection | ||
## UNSTABLE | ||
|
||
Tries to connect to the database under a provided URL. | ||
|
||
Currently only SQLite databases are supported. | ||
## TODO [RW] finalize Postgres support | ||
|
||
Arguments: | ||
- url: the URL to connect to, starting with `jdbc:...`. | ||
- user: (optional) an username for authentication. | ||
- password: (optional) a password for authentication. | ||
connect : Text -> Nothing | Text -> Nothing | Text -> JDBC_Connection ! Sql_Error | ||
connect url user=Nothing password=Nothing = | ||
Connection.create_jdbc_connection url user password | ||
|
||
open_sqlite_file : File -> Connection | ||
## UNSTABLE | ||
|
||
Connects to an SQLite database in a file on the filesystem. | ||
|
||
It is an alternative to `connect` that resolves a path to the database file. | ||
|
||
Arguments: | ||
- file: the path to the database. | ||
open_sqlite_file : File -> JDBC_Connection ! Sql_Error | ||
open_sqlite_file file = | ||
url = "jdbc:sqlite:" + file.absolute.path | ||
here.connect url |
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