Class Msql

java.lang.Object
   |
   +----Msql

public class Msql
extends Object
Msql Class - implements a connection to a remote server and a JAVA variant of the Msql API as defined by David Hughes

Constructors

o Msql()
Constructor
o Msql(String)
Msql Constructor - establishes connection to named host

Methods

o _ListDBs()
List Databases available on server.
o _ListFields(String)
List Fields in a given table.
o _ListTables()
List tables in the selected database.
o Close()
Close - close the connection to the server.
o Connect(String)
Connect - establishes connection to named host
o Connect(String, boolean)
Connect - connect using a specified port (root=1112 or mortal=4333).
o Connect(String, String)
Connect - establishes connection to named host
o Connect(String, String, boolean)
Connect - connect using a specified port (root=1112 or mortal=4333).
o CreateDB(String)
Create a new database.
o DropDB(String)
Drop a database.
o ListDBs()
List Databases available on server.
o ListFields(String)
List Fields in a given table.
o ListTables()
List tables in the selected database.
o Query(String)
Send an SQL Query to the server.
o ReloadACL(String)
Reload access control list.
o SelectDB(String)
SelectDB - Select the database to work with
o Shutdown()
Shutdown server.

Constructors

Msql
 public Msql()
Constructor
Msql
 public Msql(String msqlServer) throws MsqlException
Msql Constructor - establishes connection to named host
Parameters:
msqlServer - the name of the msql server.

Methods

 Connect
 public void Connect(String msqlServer,
                     String userName) throws MsqlException
Connect - establishes connection to named host
Parameters:
msqlServer - the name of the msql server.
userName - user name the applet will assume.
Throws: MsqlException
on mSQL protocol failure.
Throws: MsqlException
on Unknown Host.
Throws: MsqlException
on Unknown Service.
Throws: MsqlException
on TCP-IP Protocol Error.
Throws: MsqlException
on Socket Error.
Throws: MsqlException
on IO Error.
Throws: MsqlException
on Security Exception. 1. Open socket. 2. Establish IO Streams on socket. 3. Obtain version info. 4. Supply user name. 5. Retrieve status.
 Connect
 public void Connect(String msqlServer,
                     String userName,
                     boolean rootServer) throws MsqlException
Connect - connect using a specified port (root=1112 or mortal=4333).
Parameters:
msqlServer - the name of the msql server.
userName - user name the applet will assume.
rootServer - true if server is run as root.
Throws: MsqlException
as above.
Connect
 public void Connect(String msqlServer) throws MsqlException
Connect - establishes connection to named host
Parameters:
msqlServer - the name of the msql server.
Throws: MsqlException
as above.
 Connect
 public void Connect(String msqlServer,
                     boolean rootPort) throws MsqlException
Connect - connect using a specified port (root=1112 or mortal=4333).
Parameters:
msqlServer - the name of the msql server.
rootServer - true if server is run as root.
Throws: MsqlException
as above.
 Close
 public void Close() throws MsqlException
Close - close the connection to the server.
 SelectDB
 public void SelectDB(String db) throws MsqlException
SelectDB - Select the database to work with
Parameters:
db - the name of the database to select.
Throws: MsqlException
if select fails.
 Query
 public MsqlResult Query(String s) throws MsqlException
Send an SQL Query to the server.
Parameters:
s - the Query string.
Returns:
null when used with INSERT/UPDATE or similar queries which do not return data
Throws: MsqlException
when query or communication fails.
 _ListDBs
 public MsqlData _ListDBs() throws MsqlException
List Databases available on server.
Returns:
MsqlData structure cointaining names of databases.
Throws: MsqlException
if ListDB or communication fails.
 ListDBs
 public String[] ListDBs() throws MsqlException
List Databases available on server.
Returns:
array of String cointaining names of databases.
Throws: MsqlException
if ListDB or communication fails.
_ListTables
 public MsqlData _ListTables() throws MsqlException
List tables in the selected database.
Returns:
MsqlData structure containing names of tables.
Throws: MsqlException
if ListTables or communication fails.
 ListTables
 public String[] ListTables() throws MsqlException
List tables in the selected database.
Returns:
array of String conttaining names of tables.
Throws: MsqlException
if ListTables or communication fails.
 _ListFields
 public MsqlData _ListFields(String s) throws MsqlException
List Fields in a given table.
Parameters:
s - name of the table for which information requested.
Returns:
MsqlData structure containing field information.
Throws: MsqlException
if ListTables or communication fails.
 ListFields
 public MsqlFieldDesc[] ListFields(String s) throws MsqlException
List Fields in a given table.
Parameters:
s - name of the table for which information requested.
Returns:
array of MsqlFieldDesc containing field information.
Throws: MsqlException
if ListTables or communication fails.
 CreateDB
 public void CreateDB(String s) throws MsqlException
Create a new database. Included for completeness only since command can only be executed if issued from UNIX domain socket.
 DropDB
 public void DropDB(String s) throws MsqlException
Drop a database. Included for completeness only since command can only be executed if issued from UNIX domain socket.
 ReloadACL
 public void ReloadACL(String s) throws MsqlException
Reload access control list. Included for completeness only since command can only be executed if issued from UNIX domain socket.
 Shutdown
 public void Shutdown() throws MsqlException
Shutdown server. Included for completeness only since command can only be executed if issued from UNIX domain socket.