my.usm.gcl.ddbms.client
Class DDBMSClient

java.lang.Object
  extended by my.usm.gcl.ddbms.client.DDBMSClient

public class DDBMSClient
extends java.lang.Object


Constructor Summary
DDBMSClient(java.lang.String host, int port, java.lang.String user, java.lang.String password, boolean secure, boolean compression, int queryTimeOutInSecond)
           
 
Method Summary
 java.lang.String addResource(java.lang.String type, java.lang.String host, long port, java.lang.String user, java.lang.String password, java.lang.String description)
          Requests server to register a resource (MySQL Server for example), returns the resource string if successful, throws Exception with server message in case of the error
 void close()
          Because the destructor is not guaranteed, user should explicitly close the database connection
 void discardAll()
          Sends a request to server asking to remove all of the rows from last query, throws Exception with server message in case of the error
 void discardRow(int numRows)
          Sends a request to server asking to remove "numRows" rows from last query results from its buffer, throws Exception with server message in case of the error
 void evalSQL(java.lang.String sql)
          Evaluates an SQL command, nothing happens if everything is ok , throws Exception with server message in case of the error
 void execSQL(java.lang.String sql)
          Runs a SQL command, fetchRow can be used to get results, throws Exception with server message in case of the error
 DBRow fetchNextRow(int maxCache)
          After a query is run, fetchNextRow is used to read one row at a time.
 int getClientFix()
           
 int getClientMajor()
           
 int getClientMinor()
           
 int getClientRevision()
           
 long getConnectionId()
           
 DBRowSet getRowSet(int maxRows)
          After a query is run, DBRowSet gets !ONLY! the first chunk of data (with the size maxRows), use "fetchNextRow" if you need all the rows.
 int getServerFix()
           
 int getServerMajor()
           
 int getServerMinor()
           
 int getServerRevision()
           
 void ping()
          Sends a request to renew session time , throws Exception with server message in case of the error
 void prepClear()
          Empties Prepared Statement Buffer
 void prepExec()
          Executes the current prepared statement with the parameters currently in Prepared Statement Buffer, throws Exception with server message in case of the error
 void prepSetVal(char ID, java.lang.String value)
          Adds a Parameter to Prepared Statement Buffer (
 void prepSQL(java.lang.String sql)
          Sends a Prepared SQL statement to server, arguments will be added then using prepSetVal, prepExec can be used after that to receive results, throws Exception with server message in case of the error, NOTE: adding a new prepared statement will clear all the parameters added previously for previous statements
 void removeRescource(java.lang.String res_id)
          Removes a resource (e.g.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DDBMSClient

public DDBMSClient(java.lang.String host,
                   int port,
                   java.lang.String user,
                   java.lang.String password,
                   boolean secure,
                   boolean compression,
                   int queryTimeOutInSecond)
            throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

close

public void close()
           throws java.lang.Exception
Because the destructor is not guaranteed, user should explicitly close the database connection

Throws:
java.lang.Exception

execSQL

public void execSQL(java.lang.String sql)
             throws java.lang.Exception
Runs a SQL command, fetchRow can be used to get results, throws Exception with server message in case of the error

Throws:
java.lang.Exception

prepSQL

public void prepSQL(java.lang.String sql)
             throws java.lang.Exception
Sends a Prepared SQL statement to server, arguments will be added then using prepSetVal, prepExec can be used after that to receive results, throws Exception with server message in case of the error, NOTE: adding a new prepared statement will clear all the parameters added previously for previous statements

Throws:
java.lang.Exception

prepExec

public void prepExec()
              throws java.lang.Exception
Executes the current prepared statement with the parameters currently in Prepared Statement Buffer, throws Exception with server message in case of the error

Throws:
java.lang.Exception

prepSetVal

public void prepSetVal(char ID,
                       java.lang.String value)
Adds a Parameter to Prepared Statement Buffer (


prepClear

public void prepClear()
Empties Prepared Statement Buffer


removeRescource

public void removeRescource(java.lang.String res_id)
                     throws java.lang.Exception
Removes a resource (e.g. a MySQL server) from the distributed resources by giving the resource id, obtained when creating the resource

Throws:
java.lang.Exception

evalSQL

public void evalSQL(java.lang.String sql)
             throws java.lang.Exception
Evaluates an SQL command, nothing happens if everything is ok , throws Exception with server message in case of the error

Throws:
java.lang.Exception

ping

public void ping()
          throws java.lang.Exception
Sends a request to renew session time , throws Exception with server message in case of the error

Throws:
java.lang.Exception

discardAll

public void discardAll()
                throws java.lang.Exception
Sends a request to server asking to remove all of the rows from last query, throws Exception with server message in case of the error

Throws:
java.lang.Exception

discardRow

public void discardRow(int numRows)
                throws java.lang.Exception
Sends a request to server asking to remove "numRows" rows from last query results from its buffer, throws Exception with server message in case of the error

Throws:
java.lang.Exception

addResource

public java.lang.String addResource(java.lang.String type,
                                    java.lang.String host,
                                    long port,
                                    java.lang.String user,
                                    java.lang.String password,
                                    java.lang.String description)
                             throws java.lang.Exception
Requests server to register a resource (MySQL Server for example), returns the resource string if successful, throws Exception with server message in case of the error

Throws:
java.lang.Exception

getRowSet

public DBRowSet getRowSet(int maxRows)
                   throws java.lang.Exception
After a query is run, DBRowSet gets !ONLY! the first chunk of data (with the size maxRows), use "fetchNextRow" if you need all the rows. Throws exception with server message in case of the error

Throws:
java.lang.Exception

fetchNextRow

public DBRow fetchNextRow(int maxCache)
                   throws java.lang.Exception
After a query is run, fetchNextRow is used to read one row at a time. First row is always the field names. Throws Exception in the case of server error.

Throws:
java.lang.Exception

getServerMajor

public int getServerMajor()

getServerMinor

public int getServerMinor()

getServerRevision

public int getServerRevision()

getServerFix

public int getServerFix()

getConnectionId

public long getConnectionId()

getClientMajor

public int getClientMajor()

getClientMinor

public int getClientMinor()

getClientRevision

public int getClientRevision()

getClientFix

public int getClientFix()