-
Notifications
You must be signed in to change notification settings - Fork 1
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
11 changed files
with
223 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
connector: postgre | ||
name: testing | ||
username: development |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.activeorm.database; | ||
|
||
import org.activeorm.database.configuration.PostgreSQLDatabaseConfiguration; | ||
import org.activeorm.database.sql.DefaultSQLProducer; | ||
import org.activeorm.database.sql.PostgreSQLProducer; | ||
|
||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.SQLException; | ||
|
||
/** | ||
* Created by Francis on 8/05/16. | ||
* Project Active-ORM. | ||
* | ||
* A PostgreSQL {@link Database} implementation. | ||
*/ | ||
public class PostgreSQLDatabase extends Database { | ||
|
||
/** | ||
* Constructs a new {@link PostgreSQLDatabase}. | ||
*/ | ||
public PostgreSQLDatabase(final PostgreSQLDatabaseConfiguration configuration) { | ||
super(configuration, new PostgreSQLProducer()); | ||
} | ||
|
||
public Connection connect() { | ||
try { | ||
connection = DriverManager.getConnection("jdbc:postgresql://" + configuration.address + "/" + configuration.name, configuration.username, configuration.password); | ||
} catch (SQLException e) { | ||
e.printStackTrace(); | ||
} | ||
return connection; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/org/activeorm/database/configuration/PostgreSQLDatabaseConfiguration.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,20 @@ | ||
package org.activeorm.database.configuration; | ||
|
||
/** | ||
* Created by Francis on 8/05/16. | ||
* Project Active-ORM. | ||
*/ | ||
public class PostgreSQLDatabaseConfiguration extends DatabaseConfiguration { | ||
|
||
/** | ||
* Constructs a new {@link DatabaseConfiguration} | ||
* | ||
* @param name the name of the database | ||
* @param address the address of the database | ||
* @param username the username to connect to the database | ||
* @param password the password to connect to the database | ||
*/ | ||
public PostgreSQLDatabaseConfiguration(final String name, final String address, final String username, final String password) { | ||
super(name, address, username, password); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.activeorm.database.sql; | ||
|
||
/** | ||
* Created by Francis on 8/05/16. | ||
* Project Active-ORM. | ||
*/ | ||
public class PostgreSQLProducer extends DefaultSQLProducer { | ||
|
||
public PostgreSQLProducer() { | ||
delimiter = "\""; | ||
} | ||
} |
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
Oops, something went wrong.