Package fr.paris.lutece.utils.sql
Class SqlRegexpHelper
java.lang.Object
fr.paris.lutece.utils.sql.SqlRegexpHelper
Helper class that knows how to locate, load and apply SQL regexps such as defined in build.properties and run by build.xml (from build-config)
-
Constructor Summary
ConstructorsConstructorDescriptionSqlRegexpHelper(File propertiesFile, String sgbdName) Constructs a new SqlRegexpHelper from a properties fileSqlRegexpHelper(Callable<InputStream> propertiesSource, String sgbdName) Constructs a new SqlRegexpHelper from a properties stream -
Method Summary
Modifier and TypeMethodDescriptionPerforms all substitutions on the given stringstatic StringfindDbName(File dbProperties) Helper to find jdbc vendor from db.properties.static StringfindDbName(String jdbcUrl) Extracts the database type (mysql, oracle...) from the JDBC URL
-
Constructor Details
-
SqlRegexpHelper
Constructs a new SqlRegexpHelper from a properties file- Parameters:
propertiesFile- contains the regexpssgbdName- rdbms vendor to use- Throws:
IOException- if something goes wrong with reading the config fileException
-
SqlRegexpHelper
Constructs a new SqlRegexpHelper from a properties stream- Parameters:
propertiesFile- contains the regexpssgbdName- rdbms vendor to use- Throws:
IOException- if something goes wrong with reading the streamException
-
-
Method Details
-
findDbName
Helper to find jdbc vendor from db.properties. uses same regexp as build.xml from build-config- Parameters:
dbProperties- input path for db.properties- Returns:
- 'mysql' or any other vendor identifier
- Throws:
Exception- if vendor cannot be found for any reason
-
findDbName
Extracts the database type (mysql, oracle...) from the JDBC URL- Parameters:
jdbcUrl- JDBC URL to be parsed- Returns:
- databaseType for a URL such as jdbc:databaseType:someInfo
-
filter
Performs all substitutions on the given string- Parameters:
line- input- Returns:
- output, possibly modified by substitutions
-