|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mckoi.database.jdbc.MckoiConnection
public final class MckoiConnection
Wraps a Connection and provides Mckoi specific extensions that are outside the JDBC specification.
Example,
Connection connection = java.sql.DriverManager.getConnection( .... ); MckoiConnection mckoi_connection = new MckoiConnection(connection); // 'mckoi_connection' is used for mckoi specific comms.
Constructor Summary | |
---|---|
MckoiConnection(java.sql.Connection connection)
Constructs the Mckoi specific extension access object. |
Method Summary | |
---|---|
void |
addTriggerListener(java.lang.String trigger_name,
TriggerListener trigger_listener)
Registers a TriggerListener to listen for any triggers that are fired with the given name. |
static java.lang.String |
quote(java.lang.String java_string)
Given a string, this will use escape codes to convert the Java string into a Mckoi SQL string that can be parsed correctly by the database. |
void |
removeTriggerListener(java.lang.String trigger_name,
TriggerListener trigger_listener)
Removes a TriggerListener that is listening for triggers with the given name. |
void |
setStrictGetObject(boolean status)
This method can be used to disable strict get object in ResultSet. |
void |
setVerboseColumnNames(boolean status)
This method is used to enable verbose column names in ResultSetMetaData. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MckoiConnection(java.sql.Connection connection)
Method Detail |
---|
public void setStrictGetObject(boolean status)
Strict get is enabled by default.
public void setVerboseColumnNames(boolean status)
public void addTriggerListener(java.lang.String trigger_name, TriggerListener trigger_listener)
NOTE: All trigger events are fired on a dedicated trigger thread. All triggers are fired from this thread in sequence.
trigger_name
- the name of the database trigger to listen for.trigger_listener
- the listener to be notified when the trigger
event occurs.public void removeTriggerListener(java.lang.String trigger_name, TriggerListener trigger_listener)
trigger_name
- the name of the database trigger to stop listening
for.trigger_listener
- the listener to stop being notified of trigger
events for this trigger name.public static java.lang.String quote(java.lang.String java_string)
String user_input = [some untrusted string] Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery( "SELECT number FROM Part WHERE number = " + MckoiConnection.quote(user_input));If the user supplies the string "Gr's\nut\'", this method will generate the SQL query string;
SELECT number FROM Part WHERE number = 'Gr\'s\\nut\\\''This is used for generating secure dynamic SQL commands. It is particularly important if the quoted strings are coming from an untrusted source.
This security precaution is not necessary if using PreparedStatement to form the SQL parameters.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |