public class PostgreSQLScriptRunner extends ScriptRunner
ScriptRunner.ScriptType| Modifier and Type | Field and Description |
|---|---|
private static java.util.List<java.lang.String> |
COUNT
PostgreSQL query for counting the number of UDFs with a spicefic name.
|
private static java.util.regex.Pattern |
PG_VER
pattern for the PostgreSQL 'SELECT version()' result parsing
|
private static java.util.List<java.lang.String> |
SCALE
SCALE UDF (built-in for PostgreSQL 10+)
|
dialect, LOG, placeholders, scripts, scriptType, usePlaceholders| Constructor and Description |
|---|
PostgreSQLScriptRunner(Dialect dialect)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyUdfScripts(java.sql.Connection conn)
Apply UDF SQL scripts.
|
private int |
countUDFs(java.sql.Connection conn,
java.lang.String schema,
java.lang.String name)
Count number of UDFs with a given name.
|
protected void |
createMissingUdfs(java.lang.String dbname,
java.lang.String url,
java.lang.String adm,
java.lang.String pwd)
Check for missing UDFs and create them.
|
private void |
createScaleUDF(java.sql.Connection conn)
Create SCALE UDF.
|
private static int |
getPgVersion(java.sql.Connection conn)
Retrieve PostgreSQL server version.
|
addScriptPath, applyDDLScripts, applyPlaceholders, applySchema, applyScripts, createMissingUdfs, defaultUdfScripts, execute, main, makeScripts, parseCmdLine, supportsUdfScriptsprivate static final java.util.regex.Pattern PG_VER
private static final java.util.List<java.lang.String> COUNT
private static final java.util.List<java.lang.String> SCALE
public PostgreSQLScriptRunner(Dialect dialect)
dialect - the target database dialectprotected void applyUdfScripts(java.sql.Connection conn)
throws java.sql.SQLException,
java.io.IOException
applyUdfScripts in class ScriptRunnerconn - Database connection.java.sql.SQLException - on SQL error.java.io.IOException - on script reading error.protected void createMissingUdfs(java.lang.String dbname,
java.lang.String url,
java.lang.String adm,
java.lang.String pwd)
throws java.sql.SQLException,
PersistenceException
createMissingUdfs in class ScriptRunnerdbname - Database name.url - Database JDBC URL.adm - Admin login.pwd - Admin password.java.sql.SQLException - on SQL error.PersistenceException - on script reading error.private static int getPgVersion(java.sql.Connection conn)
throws java.sql.SQLException
conn - The database connection.java.sql.SQLException - On error.private int countUDFs(java.sql.Connection conn,
java.lang.String schema,
java.lang.String name)
throws java.sql.SQLException
conn - The database connection.schema - schema name.name - UDF name.java.sql.SQLException - On error.private void createScaleUDF(java.sql.Connection conn)
throws java.sql.SQLException
conn - The database connection.java.sql.SQLException - On error.