Skip to Content.
Sympa Menu

freetds - Re: Patching FreeTDS for SQLServer2000

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Raul" <spopa AT tiscalinet.it>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: Patching FreeTDS for SQLServer2000
  • Date: Tue, 13 Mar 2001 02:59:32 -0500


Bob, you're right
I omitted the code only to avoid an annoying post
BTW this is the original method of Statement class
************************************************************
public boolean getMoreResults() throws SQLException
{
SQLException exception = null;
if (tds == null)
{
throw new SQLException("Statement is closed");
}

updateCount = -1; // Do we need this global variable?

if (!tds.moreResults())
{
return false;
}

closeResults(); // Reset all internal variables (why is this done
here?)

try
{
tds.isResultSet();

// Keep eating garbage and warnings until we reach the next
result
while (!tds.isResultSet() && !tds.isEndOfResults())
{
if (tds.isProcId())
{
tds.processSubPacket();
}
else if (tds.isDoneInProc())
{
PacketDoneInProcResult tmp =
(PacketDoneInProcResult)tds.processSubPacket();
}
else if (tds.isTextUpdate())
{
PacketResult tmp1 =
(PacketResult)tds.processSubPacket();
}
else if (tds.isMessagePacket() || tds.isErrorPacket())
{
PacketMsgResult tmp =
(PacketMsgResult)tds.processSubPacket();
exception = warningChain.addOrReturn(tmp);
}
else
{
throw new SQLException("Protocol confusion. "
+ "Got a 0x"
+ Integer.toHexString((tds.peek() &
0xff))
+ " packet");
}
} // end while

if (exception != null)
{
try
{
tds.discardResultSet(null);
}
catch(java.io.IOException e)
{
throw new SQLException("Error discarding result set while
processing sql error- " +
exception.getMessage() +
"\nIOException was " +
e.getMessage());
}
catch(com.internetcds.jdbc.tds.TdsException e)
{
throw new SQLException("Error discarding result set while
processing sql error- " +
exception.getMessage() +
"\nIOException was " +
e.getMessage());
}
throw exception;
}

if (tds.isEndOfResults())
{
PacketEndTokenResult end =
(PacketEndTokenResult)tds.processSubPacket();
updateCount = end.getRowCount();
return false;
}
else if (tds.isResultSet())
{
return true;
}
else
{
throw new SQLException("Protocol confusion. "
+ "Got a 0x"
+ Integer.toHexString((tds.peek() &
0xff))
+ " packet");
}
}

catch(java.io.IOException e)
{
throw new SQLException("Network error- " + e.getMessage());
}
catch(com.internetcds.jdbc.tds.TdsException e)
{
throw new SQLException("TDS error- " + e.getMessage());
}
}
********************************************************************
public boolean getMoreResults() throws SQLException
{
SQLException exception = null;
if (tds == null)
{
throw new SQLException("Statement is closed");
}

updateCount = -1; // Do we need this global variable?

if (!tds.moreResults())
{
return false;
}

closeResults(); // Reset all internal variables (why is this done
here?)

try
{
tds.isResultSet();

// Keep eating garbage and warnings until we reach the next
result
while (!tds.isResultSet() && !tds.isEndOfResults())
{
if (tds.isProcId())
{
tds.processSubPacket();
}
//*********************************************************
//**********************BEGIN PATCH***********************
else if (tds.peek() == Tds.TDS_RET_STAT_TOKEN)
{
tds.processSubPacket();
}
//********************************************************
//**********************END PATCH************************
else if (tds.isDoneInProc())
{
PacketDoneInProcResult tmp =
(PacketDoneInProcResult)tds.processSubPacket();
}
else if (tds.isTextUpdate())
{
PacketResult tmp1 =
(PacketResult)tds.processSubPacket();
}
else if (tds.isMessagePacket() || tds.isErrorPacket())
{
PacketMsgResult tmp =
(PacketMsgResult)tds.processSubPacket();
exception = warningChain.addOrReturn(tmp);
}
else
{
throw new SQLException("Protocol confusion. "
+ "Got a 0x"
+ Integer.toHexString((tds.peek() &
0xff))
+ " packet");
}
} // end while

if (exception != null)
{
try
{
tds.discardResultSet(null);
}
catch(java.io.IOException e)
{
throw new SQLException("Error discarding result set while
processing sql error- " +
exception.getMessage() +
"\nIOException was " +
e.getMessage());
}
catch(com.internetcds.jdbc.tds.TdsException e)
{
throw new SQLException("Error discarding result set while
processing sql error- " +
exception.getMessage() +
"\nIOException was " +
e.getMessage());
}
throw exception;
}

if (tds.isEndOfResults())
{
PacketEndTokenResult end =
(PacketEndTokenResult)tds.processSubPacket();
updateCount = end.getRowCount();
return false;
}
else if (tds.isResultSet())
{
return true;
}
else
{
throw new SQLException("Protocol confusion. "
+ "Got a 0x"
+ Integer.toHexString((tds.peek() &
0xff))
+ " packet");
}
}

catch(java.io.IOException e)
{
throw new SQLException("Network error- " + e.getMessage());
}
catch(com.internetcds.jdbc.tds.TdsException e)
{
throw new SQLException("TDS error- " + e.getMessage());
}
}





Archive powered by MHonArc 2.6.24.

Top of Page