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

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

public class DBSQLReplyPacket
extends java.lang.Object

Title: DBSQLReplyPacket

Description: This class represents the result packet sent back to the client

Company: Altair Engineering, Inc.


Field Summary
static int DB_FAIL
          The constant to indicate a failed operation.
 
Constructor Summary
DBSQLReplyPacket()
          Constructor
 
Method Summary
 java.lang.String GetReason()
          Gets the reason for the failure in execution of the query
 long GetResult()
          Returns an integer indicating if the operation was successful or not
 java.sql.ResultSet GetResultSet()
          Gets the result set
 void Init(long lResult, java.sql.ResultSet rs)
          Fills the reply packet
 boolean IsResultSetPresent()
          Returns true if the result set is present else false
 void ReadPacket(java.io.ObjectInputStream in)
          Reads this object from the input stream
 void SetReason(java.lang.String strReason)
          Sets the reason for the failure in execution of the query
 java.lang.String toString()
          Returns a string representation
 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

DB_FAIL

public static final int DB_FAIL
The constant to indicate a failed operation.

See Also:
Constant Field Values
Constructor Detail

DBSQLReplyPacket

public DBSQLReplyPacket()
Constructor

Method Detail

Init

public void Init(long lResult,
                 java.sql.ResultSet rs)
Fills the reply packet

Parameters:
lResult - The result of the operation
rs - The result set for the operation. If not present then pass null

GetResult

public long GetResult()
Returns an integer indicating if the operation was successful or not

Returns:
int >= 0 if successful else DB_FAIL for a query. If the operation is not a query, then the code will be the return value from the execution of that statement.

GetResultSet

public java.sql.ResultSet GetResultSet()
Gets the result set

Returns:
ResultSet The result set for the operation

IsResultSetPresent

public boolean IsResultSetPresent()
Returns true if the result set is present else false

Returns:
boolean true if result set is present else false

SetReason

public void SetReason(java.lang.String strReason)
Sets the reason for the failure in execution of the query

Parameters:
strReason - The reason for failure

GetReason

public java.lang.String GetReason()
Gets the reason for the failure in execution of the query

Parameters:
String - The reason for failure

toString

public java.lang.String toString()
Returns a string representation

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