Package generalDatabase
Class DBSystem
java.lang.Object
generalDatabase.DBSystem
- Direct Known Subclasses:
BaseAccessSystem
,ServerBasedSystem
,SqliteSystem
,SQLServerSystem
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract String
browseDatabases
(Component parent) abstract String
browseDatabasesFX
(int type) Browse for databases using an FX dialog.abstract boolean
boolean
find out if it's possible to open the current databse with a host application (e.g.boolean
Check a database file exists on the system.boolean
checkDatabaseExists
(String dbName) void
closeConnection
(PamConnection connection) Close the database connectionabstract boolean
create()
Create a new databaseabstract PamCursor
createPamCursor
(EmptyTableDefinition tableDefinition) abstract boolean
exists()
final PamConnection
Open a new database connection with the default name.abstract PamConnection
getConnection
(String databaseName) Open new database connection with a specific nameabstract String
abstract SystemDialogPaneFX
Get the FX pane for the database systemabstract SystemDialogPanel
getDialogPanel
(Component parent) Get a database specific dialog panel to include in the database select dialog.Get a list of keywords which potentially may not be used for column names in an SQL statement.Get a shorter version of the currently open database name (e.g.abstract SQLTypes
Get the SQLTypes object which can be used to preform system specific formatting of SQL strings.abstract String
abstract boolean
boolean
Open the database with it's host application if available (e.g.
-
Constructor Details
-
DBSystem
public DBSystem()
-
-
Method Details
-
getSystemName
- Returns:
- The name of the database system
-
canCreate
public abstract boolean canCreate()- Returns:
- true if the system can create new databases.
-
getDatabaseName
- Returns:
- the name of the currently open database.
-
getShortDatabaseName
Get a shorter version of the currently open database name (e.g. without the file path name)- Returns:
- a shorter name
-
getSqlTypes
Get the SQLTypes object which can be used to preform system specific formatting of SQL strings.- Returns:
-
exists
public abstract boolean exists()- Returns:
- true if the database exists
-
create
public abstract boolean create()Create a new databaseThe underlying DBSystem will be responsible for any dialogs to chose database names, etc.
- Returns:
- true if successful.
-
getConnection
Open a new database connection with the default name. -
getConnection
Open new database connection with a specific name- Parameters:
databaseName
-- Returns:
-
closeConnection
Close the database connection- Parameters:
connection
-
-
browseDatabases
-
getDialogPanel
Get a database specific dialog panel to include in the database select dialog.- Parameters:
parent
- parent component- Returns:
- dialog panel
-
createPamCursor
-
hasDriver
public abstract boolean hasDriver()- Returns:
- true if the driver for this database system is available on this computer. the availability of database system will depend both on the OS and whether software are installed.
-
getKeywords
Get a list of keywords which potentially may not be used for column names in an SQL statement. In reality, this list is complete overkill. Override for each system and try to reduce the list as much as possible.- Returns:
- list of restricted keywords.
-
canOpenDatabase
public boolean canOpenDatabase()find out if it's possible to open the current databse with a host application (e.g. MS Access).- Returns:
- true if it's possible.
-
openCurrentDatabase
public boolean openCurrentDatabase()Open the database with it's host application if available (e.g. open MS access database with Access).- Returns:
- true if opened sucessfully.
-
getDialogPaneFX
Get the FX pane for the database system- Returns:
- the FX settings pane for the database system.
-
browseDatabasesFX
Browse for databases using an FX dialog.- Parameters:
type
-- Returns:
-
checkDatabaseExists
-
checkDatabaseExists
public boolean checkDatabaseExists()Check a database file exists on the system. Default code here is not suitable for server based database systems.- Returns:
- false if a file name is there, but no file.
-