|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsnaq.db.SQLUpdate
public class SQLUpdate
Command-line utility to send SQL commands to a database.
This class is useful for creating a large number of database tables
and/or records from a user-defined text file containing SQL commands.
It relies on the ConnectionPoolManager
class to assist
with the creation of a connection to the database, which in turn requires
the appropriate dbpool.properties
file in the classpath.
Usage: java snaq.db.SQLUpdate <poolnames> <input file> [<separator>]where
pool
is the name of the connection pool as defined in
the dbpool.properties file, input file
is the name of the text
file containing the SQL statements to be issued to the defined database,
and separator
is an optional parameter to specify a delimiter
for the SQL statements in the file. If the separator is not specified then
each line of the file is assumed to be a separate statement.
Note: comments are allowed in the input file by starting the line with either "#" or "--".
ConnectionPoolManager
Constructor Summary | |
---|---|
SQLUpdate(String db)
|
Method Summary | |
---|---|
static String |
loadTextFile(File f)
Loads a text file into a string. |
static void |
main(String[] args)
Allows command-line issuing of SQL statements to a database defined in the pool manager properties file. |
static String[] |
splitSQL(String text,
String separator)
Splits the specified text input into separate SQL statements. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLUpdate(String db) throws IOException
IOException
Method Detail |
---|
public static String loadTextFile(File f) throws IOException
f
- File
containing text to load
String
containing the text loaded from the specified file
IOException
public static String[] splitSQL(String text, String separator)
text
- string containing the text to be processedseparator
- string specifying the separator between SQL statements
String
array containing the SQL statements parsedpublic static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |