Class PostgreSQLDriver
java.lang.Object
fr.inria.rules.integraal.storage.external.rdbms.driver.PostgreSQLDriver
- All Implemented Interfaces:
RDBMSDriver
Driver for PostgreSQL databases
-
Constructor Summary
ConstructorsConstructorDescriptionPostgreSQLDriver(String uri) Creates a new driver over the given jdbc stringPostgreSQLDriver(String host, String dbName, String user, String password) Creates a new driver using the given parameters -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all tables in the database by truncating them.Returns the base safe INSERT query template.Returns the safe INSERT-SELECT query template.A driver may keep a connection open in order to execute queries faster or create a new one each time Returns a JDBC connection to the target database.getCSVCopyQuery(String tableName, String csvFilePath, char delimiter, int headerSize) Returns the SQL query used to bulk-copy CSV data.Returns the data source handled by this driver.Returns the JDBC connection string.Returns the SQL numeric-column type name used by this driver.Returns the SQL text-column type name used by this driver.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RDBMSDriver
dropAllIndexes, getBaseInsertQuery, getBaseSelectFilteredQuery, getBaseSelectQuery, getBaseTableAlias, hasTable
-
Constructor Details
-
PostgreSQLDriver
public PostgreSQLDriver(String host, String dbName, String user, String password) throws org.postgresql.util.PSQLException Creates a new driver using the given parameters- Parameters:
host- the url of the databasedbName- the name of the databaseuser- the username used to connect to the databasepassword- the password used to connect to the database- Throws:
org.postgresql.util.PSQLException- iff some error occur
-
PostgreSQLDriver
Creates a new driver over the given jdbc string- Parameters:
uri- jdbc string- Throws:
org.postgresql.util.PSQLException- iff some error occur
-
-
Method Details
-
getJDBCString
Description copied from interface:RDBMSDriverReturns the JDBC connection string.- Specified by:
getJDBCStringin interfaceRDBMSDriver- Returns:
- the jdbc connection string
-
getDatasource
Description copied from interface:RDBMSDriverReturns the data source handled by this driver.- Specified by:
getDatasourcein interfaceRDBMSDriver- Returns:
- the
DataSourcerepresented by this driver
-
getConnection
Description copied from interface:RDBMSDriverA driver may keep a connection open in order to execute queries faster or create a new one each time Returns a JDBC connection to the target database.- Specified by:
getConnectionin interfaceRDBMSDriver- Returns:
- a
Connectionfor the database represented by this driver
-
getBaseSafeInsertQuery
Description copied from interface:RDBMSDriverReturns the base safe INSERT query template.- Specified by:
getBaseSafeInsertQueryin interfaceRDBMSDriver- Returns:
- the base INSERT query which does not create exceptions in case of duplicates corresponding to this driver
-
getBaseSafeInsertSelectQuery
Description copied from interface:RDBMSDriverReturns the safe INSERT-SELECT query template.- Specified by:
getBaseSafeInsertSelectQueryin interfaceRDBMSDriver- Returns:
- the base INSERT query using a SELECT clause which does not create exceptions in case of duplicates corresponding to this driver
-
getTextFieldName
Description copied from interface:RDBMSDriverReturns the SQL text-column type name used by this driver.- Specified by:
getTextFieldNamein interfaceRDBMSDriver- Returns:
- the name of the Text field corresponding to this driver
-
getNumberFieldName
Description copied from interface:RDBMSDriverReturns the SQL numeric-column type name used by this driver.- Specified by:
getNumberFieldNamein interfaceRDBMSDriver- Returns:
- the name of the Number field corresponding to this driver
-
getCSVCopyQuery
Description copied from interface:RDBMSDriverReturns the SQL query used to bulk-copy CSV data.- Specified by:
getCSVCopyQueryin interfaceRDBMSDriver- Parameters:
tableName- table name to store datacsvFilePath- path to the csv filedelimiter- delimiter of the csv fileheaderSize- size of the csv header- Returns:
- the query used to copy a CSV file into the database system
-
dropAllTables
Clears all tables in the database by truncating them.- Specified by:
dropAllTablesin interfaceRDBMSDriver- Throws:
SQLException- If an error occurs during database access.
-