| java.lang.Object guam.DBInterface
DBInterface | public class DBInterface (Code) | | Interface with the MySQL database to create connections, close connections and administer user data
author: dkc version: 1.0 |
Method Summary | |
public boolean | changeUserPass(String username, String password) | public boolean | connect(String dbHost, String userName, String userPass, String dbPort) | public boolean | createUser(String username, String password) | public boolean | deleteUser(String username) Delete a user from the database user list. | public void | disconnect() Disconnect from server. | public Vector | getColumnPrivs(String username, String DBName, String TableName, String ColName) | public Vector | getDBPrivs(String username, String DBName) | public Hashtable | getDBStructure() Returns the structure of the current database
a Hashtable prepared for insertion into a JTree. | public Vector | getGlobalPrivs(String username) | public Vector | getTablePrivs(String username, String DBName, String TableName) | public Vector | getUserList() | public boolean | grantColumnPriv(String username, String database, String table, String column, int privilege) | public boolean | grantColumnPriv(String username, String database, String table, String[] columns, int privilege) | public boolean | grantDBPriv(String username, String database, int privilege) | public boolean | grantGlobalPriv(String username, int privilege) | public boolean | grantTablePriv(String username, String database, String table, int privilege) | public boolean | isConnected() Check to see if there is a connection open. | public boolean | revokeColumnPriv(String username, String database, String table, String column, int privilege) | public boolean | revokeColumnPriv(String username, String database, String table, String[] columns, int privilege) | public boolean | revokeDBPriv(String username, String database, int privilege) | public boolean | revokeGlobalPriv(String username, int privilege) | public boolean | revokeTablePriv(String username, String database, String table, int privilege) |
ALL | final public static int ALL(Code) | | |
ALTER | final public static int ALTER(Code) | | |
CREATE | final public static int CREATE(Code) | | |
DELETE | final public static int DELETE(Code) | | |
DROP | final public static int DROP(Code) | | |
FILE | final public static int FILE(Code) | | |
GRANT | final public static int GRANT(Code) | | |
INDEX | final public static int INDEX(Code) | | |
INSERT | final public static int INSERT(Code) | | |
PROCESS | final public static int PROCESS(Code) | | |
REFERENCES | final public static int REFERENCES(Code) | | |
RELOAD | final public static int RELOAD(Code) | | |
SELECT | final public static int SELECT(Code) | | |
SHUTDOWN | final public static int SHUTDOWN(Code) | | |
UPDATE | final public static int UPDATE(Code) | | |
USAGE | final public static int USAGE(Code) | | |
lastAccessed | long lastAccessed(Code) | | |
DBInterface | public DBInterface()(Code) | | Construct the object, load the JDBC driver
|
changeUserPass | public boolean changeUserPass(String username, String password)(Code) | | Change a user's password
Parameters: username - the user whose password is to be changed Parameters: password - the new password for the user true if the change was successful, false if there was an error |
connect | public boolean connect(String dbHost, String userName, String userPass, String dbPort)(Code) | | Connect to a MySQL server
Parameters: dbHost - Hostname to connect to Parameters: userName - User to log in as Parameters: userPass - Password for given user or null if no password set Parameters: dbPort - Port to connect or null for default true if the connection succeeded or false if there was a problem connecting |
createUser | public boolean createUser(String username, String password)(Code) | | Create a MySQL user on the server
Parameters: username - Username to create Parameters: password - Password for user true if the user was created successfully, false if there was an error. |
deleteUser | public boolean deleteUser(String username)(Code) | | Delete a user from the database user list.
Parameters: username - The user to delete true if deletion was successful, false if there was an error |
disconnect | public void disconnect()(Code) | | Disconnect from server. If not connected, does nothing.
|
getColumnPrivs | public Vector getColumnPrivs(String username, String DBName, String TableName, String ColName)(Code) | | Returns column privileges for a given user
Parameters: username - the name of the user whose privileges are to be returned Parameters: DBName - The name of the database Parameters: TableName - The name of the table Parameters: ColName - the name of the column a Vector containing strings of all the privileges the user has |
getDBPrivs | public Vector getDBPrivs(String username, String DBName)(Code) | | Returns database privileges for a given user
Parameters: username - the name of the user whose privileges are to be returned Parameters: DBName - The name of the database a Vector containing strings of all the privileges the user has |
getDBStructure | public Hashtable getDBStructure()(Code) | | Returns the structure of the current database
a Hashtable prepared for insertion into a JTree. The structure is as follows:root->databases->tables->columns, where databases and tables are hashtables and columns is aVector. The keys in the hashtables are the name of the element, and the Vector elementsare Strings. |
getGlobalPrivs | public Vector getGlobalPrivs(String username)(Code) | | Returns the global privileges for a given user
Parameters: username - the name of the user whose privileges are to be returned a Vector containing strings of all the privileges the user has |
getTablePrivs | public Vector getTablePrivs(String username, String DBName, String TableName)(Code) | | Returns table privileges for a given user
Parameters: username - the name of the user whose privileges are to be returned Parameters: DBName - The name of the database Parameters: TableName - The name of the table a Vector containing strings of all the privileges the user has |
getUserList | public Vector getUserList()(Code) | | Retrieve the list of users from the current database
a vector of all the users registered in the database |
grantColumnPriv | public boolean grantColumnPriv(String username, String database, String table, String column, int privilege)(Code) | | Grant a column privilege to a specific user
Parameters: username - User to grant privilege to Parameters: database - Database on which to grant privilege Parameters: table - Table on which to grant privilege Parameters: column - Column on which to grant privilege Parameters: privilege - Privilege to be granted true if successful, false if there was an error |
grantColumnPriv | public boolean grantColumnPriv(String username, String database, String table, String[] columns, int privilege)(Code) | | Grant a privilege on a list of columns to a specific user
Parameters: username - User to grant privilege to Parameters: database - Database on which to grant privilege Parameters: table - Table on which to grant privilege Parameters: columns - Array of columns on which to grant privilege Parameters: privilege - Privilege to be granted true if successful, false if there was an error |
grantDBPriv | public boolean grantDBPriv(String username, String database, int privilege)(Code) | | Grant a database privilege to a specific user
Parameters: username - User to grant privilege to Parameters: database - Database on which to grant privilege Parameters: privilege - Privilege to be granted true if successful, false if there was an error |
grantGlobalPriv | public boolean grantGlobalPriv(String username, int privilege)(Code) | | Grant a global privilege to a specific user
Parameters: username - User to grant privilege to Parameters: privilege - Privilege to be granted true if successful, false if there was an error |
grantTablePriv | public boolean grantTablePriv(String username, String database, String table, int privilege)(Code) | | Grant a table privilege to a specific user
Parameters: username - User to grant privilege to Parameters: database - Database on which to grant privilege Parameters: table - Table on which to grant privilege Parameters: privilege - Privilege to be granted true if successful, false if there was an error |
isConnected | public boolean isConnected()(Code) | | Check to see if there is a connection open.
true if there is a connection open, false if not. |
revokeColumnPriv | public boolean revokeColumnPriv(String username, String database, String table, String column, int privilege)(Code) | | Revoke a column privilege from a specific user
Parameters: username - User to revoke privilege from Parameters: database - Database from which to revoke privilege Parameters: table - Table from which to revoke privilege Parameters: column - Column from which to revoke privilege Parameters: privilege - Privilege to be revoked true if successful, false if there was an error |
revokeColumnPriv | public boolean revokeColumnPriv(String username, String database, String table, String[] columns, int privilege)(Code) | | Revoke a privilege on a list of columns from a specific user
Parameters: username - User to revoke privilege from Parameters: database - Database from which to revoke privilege Parameters: table - Table from which to revoke privilege Parameters: columns - Array of columns from which to revoke privilege Parameters: privilege - Privilege to be revoked true if successful, false if there was an error |
revokeDBPriv | public boolean revokeDBPriv(String username, String database, int privilege)(Code) | | Revoke a database privilege from a specific user
Parameters: username - User to revoke privilege from Parameters: database - Database from which to revoke privilege Parameters: privilege - Privilege to be revoked true if successful, false if there was an error |
revokeGlobalPriv | public boolean revokeGlobalPriv(String username, int privilege)(Code) | | Revoke a global privilege from a specific user
Parameters: username - User to revoke privilege from Parameters: privilege - Privilege to be revoked true if successful, false if there was an error |
revokeTablePriv | public boolean revokeTablePriv(String username, String database, String table, int privilege)(Code) | | Revoke a table privilege from a specific user
Parameters: username - User to revoke privilege from Parameters: database - Database from which to revoke privilege Parameters: table - Table from which to revoke privilege Parameters: privilege - Privilege to be revoked true if successful, false if there was an error |
|
|