public class ExecuteSQL
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
commentString |
private static int |
DB2 |
private static int |
dbType |
private static boolean |
debug |
private static java.lang.String |
DEFAULT_FILE_ENCODING |
private static java.lang.String |
DEFAULT_STORE |
private static java.lang.String |
inputEncoding |
private static int |
MSSQL |
private static int |
MYSQL |
private static int |
ORACLE |
private static int |
POSTGRE |
private static java.lang.String |
usage |
private static boolean |
utilityDebug |
Constructor and Description |
---|
ExecuteSQL() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
aBOM(java.lang.String line) |
private static boolean |
commentLine(java.lang.String line) |
private static boolean |
emptyLine(java.lang.String line) |
static int |
execute(java.io.File inFile,
java.io.File propFile)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.io.File inFile,
java.io.File propFile,
java.lang.String storeId)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.io.File inFile,
java.io.File propFile,
java.lang.String storeId,
boolean debugFlag)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.io.File inFile,
java.io.File propFile,
java.lang.String storeId,
java.lang.String kkVer,
boolean debugFlag)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.io.File inFile,
java.io.File propFile,
java.lang.String storeId,
java.lang.String kkVer,
boolean debugFlag,
java.lang.String encoding)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.io.File inFile,
java.io.File propFile,
java.lang.String storeId,
java.lang.String kkVer,
boolean debugFlag,
java.lang.String encoding,
java.lang.String startVersion)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.io.File inFile,
java.io.File propFile,
java.lang.String storeId,
java.lang.String kkVer,
java.lang.String encoding)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.io.File inFile,
java.io.File propFile,
java.lang.String storeId,
java.lang.String kkVer,
java.lang.String encoding,
java.lang.String startVersion)
Execute the SQL against the database defined in the properties file.
|
static int |
execute(java.lang.String inFileName,
java.lang.String propFileName)
Execute the SQL against the database defined in the properties file.
|
private static java.lang.String |
getNextLine(java.util.Scanner br) |
private static boolean |
kkHigherVersionMarker(java.lang.String line,
java.lang.String kkVer) |
private static boolean |
kkStartVersionMarker(java.lang.String line,
java.lang.String kkVer) |
static void |
main(java.lang.String[] args) |
private static boolean |
nonCriticalError(java.sql.SQLException e,
int dbType) |
private static boolean |
nonSql(java.lang.String line) |
private static boolean |
oracleForwardSlash(java.lang.String line) |
private static void |
printSQLFailed() |
private static java.lang.String |
removeFinalString(java.lang.String line,
java.lang.String ch) |
private static boolean |
theEnd(java.lang.String line) |
private static final java.lang.String usage
private static final java.lang.String DEFAULT_STORE
private static boolean debug
private static boolean utilityDebug
private static int dbType
private static java.lang.String commentString
private static final int DB2
private static final int ORACLE
private static final int POSTGRE
private static final int MSSQL
private static final int MYSQL
private static java.lang.String DEFAULT_FILE_ENCODING
private static java.lang.String inputEncoding
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- the argsjava.lang.Exception
- an unexpected exceptionpublic static int execute(java.lang.String inFileName, java.lang.String propFileName)
inFileName
- the SQL file name to runpropFileName
- the Properties file name that defines the database credentialspublic static int execute(java.io.File inFile, java.io.File propFile)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialspublic static int execute(java.io.File inFile, java.io.File propFile, java.lang.String storeId)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialsstoreId
- the storeIdpublic static int execute(java.io.File inFile, java.io.File propFile, java.lang.String storeId, java.lang.String kkVer, java.lang.String encoding)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialsstoreId
- the storeIdkkVer
- execute the SQL up to the specified kkVersion. It stops processing the file if it
encounters a line starting with "# vN.N.N.N" or "-- vN.N.N.N". If kkVer is null,
no version checking is carried out.encoding
- the encodingpublic static int execute(java.io.File inFile, java.io.File propFile, java.lang.String storeId, java.lang.String kkVer, java.lang.String encoding, java.lang.String startVersion)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialsstoreId
- the storeIdkkVer
- execute the SQL up to the specified kkVersion. It stops processing the file if it
encounters a line starting with "# vN.N.N.N" or "-- vN.N.N.N". If kkVer is null,
no version checking is carried out.encoding
- the encodingstartVersion
- execute the SQL from this version if specified. If not specified it starts from
the beginning.public static int execute(java.io.File inFile, java.io.File propFile, java.lang.String storeId, boolean debugFlag)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialsstoreId
- the storeIddebugFlag
- debug flag - true to enable debugpublic static int execute(java.io.File inFile, java.io.File propFile, java.lang.String storeId, java.lang.String kkVer, boolean debugFlag)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialsstoreId
- the storeIdkkVer
- execute the SQL up to the specified kkVersion. It stops processing the file if it
encounters a line starting with "# vN.N.N.N" or "-- vN.N.N.N". If kkVer is null,
no version checking is carried out.debugFlag
- debug flag - true to enable debugpublic static int execute(java.io.File inFile, java.io.File propFile, java.lang.String storeId, java.lang.String kkVer, boolean debugFlag, java.lang.String encoding)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialsstoreId
- the storeIdkkVer
- execute the SQL up to the specified kkVersion. It stops processing the file if it
encounters a line starting with "# vN.N.N.N" or "-- vN.N.N.N". If kkVer is null,
no version checking is carried out.debugFlag
- debug flag - true to enable debugencoding
- the encodingpublic static int execute(java.io.File inFile, java.io.File propFile, java.lang.String storeId, java.lang.String kkVer, boolean debugFlag, java.lang.String encoding, java.lang.String startVersion)
inFile
- the SQL file to runpropFile
- the Properties file that defines the database credentialsstoreId
- the storeIdkkVer
- execute the SQL up to the specified kkVersion. It stops processing the file if it
encounters a line starting with "# vN.N.N.N" or "-- vN.N.N.N". If kkVer is null,
no version checking is carried out.debugFlag
- debug flag - true to enable debugencoding
- the encodingstartVersion
- execute the SQL from this version if specified. If not specified it starts from
the beginning.private static boolean nonCriticalError(java.sql.SQLException e, int dbType)
private static void printSQLFailed()
private static boolean commentLine(java.lang.String line)
private static boolean aBOM(java.lang.String line)
private static boolean emptyLine(java.lang.String line)
private static boolean theEnd(java.lang.String line)
private static boolean kkStartVersionMarker(java.lang.String line, java.lang.String kkVer)
private static boolean kkHigherVersionMarker(java.lang.String line, java.lang.String kkVer)
private static java.lang.String removeFinalString(java.lang.String line, java.lang.String ch)
private static boolean nonSql(java.lang.String line)
private static boolean oracleForwardSlash(java.lang.String line)
private static java.lang.String getNextLine(java.util.Scanner br)
Copyright © 2018 DS Data Systems UK Ltd.