Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

sosc::DbTool Class Reference

Inheritance diagram for sosc::DbTool:

sosc::BatchTool List of all members.

Public Methods

 DbTool (String className, String url, String userName, String password) throws Exception
 DbTool (Connection connection) throws Exception
Connection getConnection () throws Exception
String getUserName ()
void close () throws Exception
void rollback () throws Exception
void commit () throws Exception
void setAutoCommit (boolean autocommit) throws Exception
String q (Object o)
String quote (String s) throws SQLException
String getString (String sql) throws Exception
int getInt (String sql) throws Exception
double getDouble (String sql) throws Exception
long getLong (String sql) throws Exception
Object getObject (String sql) throws Exception
ResultSet query (String sql) throws Exception
void update (String sql) throws Exception
Statement createStatement () throws Exception
String inClause (Collection c, boolean quoted) throws Exception
int rowCount (ResultSet r) throws Exception
List toList (ResultSet r) throws Exception
StringBuffer resultSetToXML (ResultSet r) throws Exception
StringBuffer resultSetToXML (ResultSet r, StringBuffer sb, int count) throws Exception
void finalize ()

Static Public Methods

Map toMap (ResultSet r) throws Exception
Map toMap (ResultSet r, boolean advance) throws Exception

Protected Attributes

Connection connection

Private Methods

void setConnection (Connection connection) throws SQLException
void setConnection (String className, String url, String userName, String password) throws Exception

Private Attributes

String className
String url
String userName
String password
boolean connectionIsPrivate = true

Constructor & Destructor Documentation

sosc::DbTool::DbTool String    className,
String    url,
String    userName,
String    password
throws Exception [inline]
 

Definition at line 41 of file DbTool.java.

References sosc::DbTool::className, sosc::DbTool::password, sosc::DbTool::setConnection(), sosc::DbTool::url, and sosc::DbTool::userName.

sosc::DbTool::DbTool Connection    connection throws Exception [inline]
 

Definition at line 48 of file DbTool.java.

References sosc::DbTool::connection, and sosc::DbTool::setConnection().


Member Function Documentation

void sosc::DbTool::close   throws Exception [inline]
 

Definition at line 91 of file DbTool.java.

References sosc::DbTool::connection.

void sosc::DbTool::commit   throws Exception [inline]
 

Definition at line 99 of file DbTool.java.

References sosc::DbTool::connection.

Referenced by sosc::JobTool::addJob(), and sosc::JobTool::runJob().

Statement sosc::DbTool::createStatement   throws Exception [inline]
 

Definition at line 245 of file DbTool.java.

References sosc::DbTool::connection.

void sosc::DbTool::finalize   [inline]
 

Definition at line 489 of file DbTool.java.

References sosc::DbTool::connection, and sosc::DbTool::connectionIsPrivate.

Connection sosc::DbTool::getConnection   throws Exception [inline]
 

Definition at line 77 of file DbTool.java.

References sosc::DbTool::connection, and sosc::DbTool::connectionIsPrivate.

double sosc::DbTool::getDouble String    sql throws Exception [inline]
 

Definition at line 164 of file DbTool.java.

References sosc::DbTool::getString().

int sosc::DbTool::getInt String    sql throws Exception [inline]
 

Definition at line 159 of file DbTool.java.

References sosc::DbTool::getString().

Referenced by sosc::JobTool::addJob(), and sosc::BatchTool::createBatch().

long sosc::DbTool::getLong String    sql throws Exception [inline]
 

Definition at line 169 of file DbTool.java.

References sosc::DbTool::getString().

Object sosc::DbTool::getObject String    sql throws Exception [inline]
 

Definition at line 174 of file DbTool.java.

References sosc::DbTool::query().

Referenced by sosc::DbTool::getString().

String sosc::DbTool::getString String    sql throws Exception [inline]
 

Definition at line 154 of file DbTool.java.

References sosc::DbTool::getObject().

Referenced by sosc::DbTool::getDouble(), sosc::DbTool::getInt(), sosc::DbTool::getLong(), and sosc::JobTool::runJob().

String sosc::DbTool::getUserName   [inline]
 

Definition at line 86 of file DbTool.java.

References sosc::DbTool::userName.

String sosc::DbTool::inClause Collection    c,
boolean    quoted
throws Exception [inline]
 

Converts the specified collection to an 'in clause' by calling toString() on each item in the collection. If quoted is true, then the resuting string is also passed through quote(). Null items result in ',null,'. If the collection is null, or has size zero, "(null)" is returned.

Definition at line 257 of file DbTool.java.

References sosc::DbTool::quote().

String sosc::DbTool::q Object    o [inline]
 

This is a generic method that returns the parameter surrounded by single quotes ("apostrophes"). if a null or a empty string was entered, then a single space is returned. It returns null if the database returns an empty string as the column value.

@return the parameter surrounded by single quotes (apostrophes).

Definition at line 114 of file DbTool.java.

ResultSet sosc::DbTool::query String    sql throws Exception [inline]
 

Creates a statement and runs the specified SQL. Note that the caller will need to call ResultSet.getStatement().close() if they wan to be really kind.

Definition at line 190 of file DbTool.java.

References sosc::DbTool::connection.

Referenced by sosc::BatchTool::addIntContents(), sosc::BatchTool::addVarcharContents(), sosc::AuthTool::authenticate(), sosc::BatchTool::batchSummary(), sosc::BatchTool::getBatchContents(), sosc::BatchTool::getContentArguments(), sosc::AuthTool::getIdNames(), sosc::DbTool::getObject(), sosc::BatchTool::getProfileId(), sosc::AuthTool::getUserEmail(), sosc::AuthTool::isGroupMember(), sosc::JobTool::runJob(), and sosc::Commworx::simpleAuth().

String sosc::DbTool::quote String    s throws SQLException [inline]
 

Definition at line 143 of file DbTool.java.

Referenced by sosc::BatchTool::addIntContents(), sosc::JobTool::addJob(), sosc::AuthTool::authenticate(), sosc::AuthTool::changePassword(), sosc::BatchTool::createProfile(), sosc::AuthTool::getGroupMembers(), sosc::BatchTool::getProfileId(), sosc::AuthTool::getUserEmail(), sosc::DbTool::inClause(), sosc::JobTool::runJob(), sosc::AuthTool::setUserEmail(), and sosc::AuthTool::setUserPassword().

StringBuffer sosc::DbTool::resultSetToXML ResultSet    r,
StringBuffer    sb,
int    count
throws Exception [inline]
 

Definition at line 458 of file DbTool.java.

StringBuffer sosc::DbTool::resultSetToXML ResultSet    r throws Exception [inline]
 

Definition at line 451 of file DbTool.java.

void sosc::DbTool::rollback   throws Exception [inline]
 

Definition at line 95 of file DbTool.java.

References sosc::DbTool::connection.

int sosc::DbTool::rowCount ResultSet    r throws Exception [inline]
 

Definition at line 282 of file DbTool.java.

References sosc::DbTool::rowCount().

Referenced by sosc::BatchTool::getContentArguments(), sosc::BatchTool::getProfileId(), and sosc::DbTool::rowCount().

void sosc::DbTool::setAutoCommit boolean    autocommit throws Exception [inline]
 

Definition at line 103 of file DbTool.java.

References sosc::DbTool::connection.

void sosc::DbTool::setConnection String    className,
String    url,
String    userName,
String    password
throws Exception [inline, private]
 

Definition at line 65 of file DbTool.java.

References sosc::DbTool::className, sosc::DbTool::password, sosc::DbTool::setConnection(), sosc::DbTool::url, and sosc::DbTool::userName.

void sosc::DbTool::setConnection Connection    connection throws SQLException [inline, private]
 

Definition at line 55 of file DbTool.java.

References sosc::DbTool::connection.

Referenced by sosc::DbTool::DbTool(), and sosc::DbTool::setConnection().

List sosc::DbTool::toList ResultSet    r throws Exception [inline]
 

All roads lead back to core. Of course, this works only for a single row.

Definition at line 328 of file DbTool.java.

Map sosc::DbTool::toMap ResultSet    r,
boolean    advance
throws Exception [inline, static]
 

Returns the NEXT row on the specified result set as a Map. If advance is true then the result set is moved to the next row. If false then the resultSet is left on whatever row it started on.

If there is no current row then an empty Map is returned.

Definition at line 304 of file DbTool.java.

Map sosc::DbTool::toMap ResultSet    r throws Exception [inline, static]
 

All roads lead back to core. Of course, this works only for a single row.

Definition at line 293 of file DbTool.java.

Referenced by sosc::BatchTool::addIntContents(), and sosc::JobTool::runJob().

void sosc::DbTool::update String    sql throws Exception [inline]
 

Definition at line 227 of file DbTool.java.

References sosc::DbTool::connection.

Referenced by sosc::AuthTool::addGroup(), sosc::AuthTool::addGroupMember(), sosc::BatchTool::addIntContents(), sosc::JobTool::addJob(), sosc::AuthTool::addUser(), sosc::BatchTool::addVarcharContents(), sosc::AuthTool::changePassword(), sosc::BatchTool::createBatch(), sosc::BatchTool::createProfile(), sosc::BatchTool::createSchema(), sosc::BatchTool::dropSchema(), sosc::AuthTool::refreshSchema(), sosc::AuthTool::removeGroup(), sosc::AuthTool::removeGroupMember(), sosc::AuthTool::removeUser(), sosc::JobTool::runJob(), sosc::AuthTool::setUserEmail(), and sosc::AuthTool::setUserPassword().


Member Data Documentation

String sosc::DbTool::className [private]
 

Definition at line 32 of file DbTool.java.

Referenced by sosc::DbTool::DbTool(), and sosc::DbTool::setConnection().

Connection sosc::DbTool::connection [protected]
 

Definition at line 31 of file DbTool.java.

Referenced by sosc::BatchTool::BatchTool(), sosc::DbTool::close(), sosc::DbTool::commit(), sosc::DbTool::createStatement(), sosc::DbTool::DbTool(), sosc::DbTool::finalize(), sosc::DbTool::getConnection(), sosc::DbTool::query(), sosc::DbTool::rollback(), sosc::DbTool::setAutoCommit(), sosc::DbTool::setConnection(), and sosc::DbTool::update().

boolean sosc::DbTool::connectionIsPrivate = true [private]
 

Definition at line 36 of file DbTool.java.

Referenced by sosc::DbTool::finalize(), and sosc::DbTool::getConnection().

String sosc::DbTool::password [private]
 

Definition at line 35 of file DbTool.java.

Referenced by sosc::DbTool::DbTool(), and sosc::DbTool::setConnection().

String sosc::DbTool::url [private]
 

Definition at line 33 of file DbTool.java.

Referenced by sosc::DbTool::DbTool(), and sosc::DbTool::setConnection().

String sosc::DbTool::userName [private]
 

Definition at line 34 of file DbTool.java.

Referenced by sosc::DbTool::DbTool(), sosc::DbTool::getUserName(), and sosc::DbTool::setConnection().


The documentation for this class was generated from the following file:
Generated on Mon Jul 14 17:19:21 2003 for SOSC by doxygen1.2.15