freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Coleman, Dave" <DColeman AT US.TIAuto.com>
- To: 'TDS Development Group' <freetds AT franklin.oit.unc.edu>
- Subject: Stored procedures
- Date: Tue, 26 Mar 2002 10:52:14 -0500
I have a general question. I am using freeTDS compiled for TDS 4.2 on Red
Hat Linux 7.1, connecting to SQL server 7.0. Is there any special actions
that need to be taken when a stored procedure is submitted to the server
vice the processing that is necessary when a SELECT statement is called...
Here is the code we use to parse the query. It works beautifully with
SELECT's and such. When executing INSERT's, UPDATE's, or SELECT's, the
object is a perfect non-persistant connection to the database. When
executing a stored procedure with this code, I get erratic results...
unidentified markers and the like. Is there something special I need to
process that is returned from a stored procedure call?
Thanks in advance,
Dave Coleman
int tdsDB::query(char *query)
{
int queryStatus,
colIdx,
rowIdx=0;
const void * colVal;
char *colStr;
//-------------------------
rows = 0;
//-------------------------
if( connected )
{
parent->hasRows = 1;
//-------------------------
queryStatus = tds_submit_query(sqlSock, query);
//-------------------------
while( queryStatus==TDS_SUCCEED )
{
queryStatus = tds_process_result_tokens( sqlSock );
while( (queryStatus != TDS_NO_MORE_ROWS) && (queryStatus !=
TDS_FAIL) )
{
queryStatus = tds_process_row_tokens( sqlSock );
parent->allocCols(sqlSock->res_info->num_cols);
for( colIdx = 0 ; colIdx < sqlSock->res_info->num_cols ;
colIdx++ )
{
colVal = getColValue( colIdx );
colStr = resultString( colVal,
sqlSock->res_info->columns[colIdx]->column_type );
parent->setColName(sqlSock->res_info->columns[colIdx]->column_name, colIdx);
parent->setColVal(colStr, colIdx);
}
if( (queryStatus != TDS_NO_MORE_ROWS) && (queryStatus !=
TDS_FAIL) )
{
rowIdx++;
parent->addRow();
parent->moveNext();
}
}
rows=rowIdx;
if( queryStatus == TDS_FAIL )
{
return TDS_FAIL;
}
else
{
if( queryStatus != TDS_NO_MORE_ROWS )
{
return TDS_NO_MORE_ROWS;
}
}
}
return TDS_SUCCEED;
}
else
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
// -|> Mrdegdc 9/7/2001 8:06am
//
// Not connected to a data source, cannot execute query
//-------------------------------------------------------
return SQL_NO_SOCKET;
}
}
- Stored procedures, Coleman, Dave, 03/26/2002
Archive powered by MHonArc 2.6.24.