com.altair.hwm.database.sql.protocol
Class DBSQLReqPacket

java.lang.Object
  extended by com.altair.hwm.database.sql.protocol.DBSQLReqPacket

public class DBSQLReqPacket
extends java.lang.Object

Title: DBSQLReqPacket

Description: This class represents the request packet that will be received from the client

Company: Altair Engineering, Inc.


Field Summary
static int CMD_DML_INSERT
           
static int CMD_DML_QUERY
           
static int CMD_DML_UPDATE
          The kind of operations that can be executed are: In DML: update, insert, delete query In DDL: create table, delete table etc.
 
Constructor Summary
DBSQLReqPacket()
          Constructor
DBSQLReqPacket(java.lang.String strQuery, int nReqType)
          Constructor
DBSQLReqPacket(java.lang.String strQuery, java.util.Vector vectParams, int nReqType)
          Constructor
 
Method Summary
 java.util.Vector GetParams()
          Gets the parameters
 java.lang.String GetQueryString()
          Gets the query
 int GetRequestType()
          Gets the type of request.
 void ReadPacket(java.io.ObjectInputStream in)
          Reads this object from the input stream
 void SetParams(java.util.Vector vectParams)
          Sets the parameters
 void SetQueryString(java.lang.String strQuery)
          Sets the query
 void SetRequestType(int nReqType)
          Sets the type of request.
 java.lang.String toString()
          Returns the string representation of this object
 void WritePacket(java.io.ObjectOutputStream out)
          Writes out this object to the output stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CMD_DML_UPDATE

public static final int CMD_DML_UPDATE
The kind of operations that can be executed are: In DML: update, insert, delete query In DDL: create table, delete table etc. We shall keep separate constants only for DML and one constant for all DDL

See Also:
Constant Field Values

CMD_DML_INSERT

public static final int CMD_DML_INSERT
See Also:
Constant Field Values

CMD_DML_QUERY

public static final int CMD_DML_QUERY
See Also:
Constant Field Values
Constructor Detail

DBSQLReqPacket

public DBSQLReqPacket()
Constructor


DBSQLReqPacket

public DBSQLReqPacket(java.lang.String strQuery,
                      int nReqType)
Constructor

Parameters:
strQuery - The query/update/insert etc. to execute
nReqType - The type of request

DBSQLReqPacket

public DBSQLReqPacket(java.lang.String strQuery,
                      java.util.Vector vectParams,
                      int nReqType)
Constructor

Parameters:
strQuery - The prepared statement to execute
vectParams - The vector of objects which are parameters for the prepared statement
nReqType - The type of request
Method Detail

SetQueryString

public void SetQueryString(java.lang.String strQuery)
Sets the query

Parameters:
strQuery - The query to execute

GetQueryString

public java.lang.String GetQueryString()
Gets the query

Returns:
String The query to execute

SetRequestType

public void SetRequestType(int nReqType)
Sets the type of request. If the request is of type CMD_DML_QUERY then a result set is returned. Else if the request is of type CMD_DML_INSERT, then m_nResult in the reply packet will contain the auto incremented ID.

Parameters:
nReqType -

GetRequestType

public int GetRequestType()
Gets the type of request. If the request is of type CMD_DML_QUERY then a result set is returned. Else if the request is of type CMD_DML_INSERT, then m_nResult in the reply packet will contain the auto incremented ID.

Returns:
int The request type

SetParams

public void SetParams(java.util.Vector vectParams)
Sets the parameters

Parameters:
vectParams - The vector of parameters for the prepared statement

GetParams

public java.util.Vector GetParams()
Gets the parameters

Returns:
Vector The vector of parameters for the prepared statement

toString

public java.lang.String toString()
Returns the string representation of this object

Overrides:
toString in class java.lang.Object

WritePacket

public void WritePacket(java.io.ObjectOutputStream out)
                 throws java.io.IOException
Writes out this object to the output stream

Parameters:
out - The output stream
Throws:
java.io.IOException

ReadPacket

public void ReadPacket(java.io.ObjectInputStream in)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Reads this object from the input stream

Parameters:
in - The input stream
Throws:
java.io.IOException
java.lang.ClassNotFoundException