Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

RE: Still can't process stored procedure results.: msg#00188

db.tds.freetds

Subject: RE: Still can't process stored procedure results.



When you say that you cannot get the results of the stored procedure when
they are printed to the screen, do you mean exactly that?

There are three ways that I know of to get data back from an MS stored
procedure:

1. Via Result Set - To do this your SP has to have a SELECT statement in it
that returns records.
2. Output Parameters - For these, you need actual parameters to the SP that
are designated as OUTPUT, and you have to bind variables to them client
side. Than, within your SP you need to SET or SELECT a value into these
params. This didn't work with previous versions of FreeTDS against MS SQL
dbs.
3. Have your SP raise an error (RAISERROR T-SQL statement) and use the
diagnostic records interface of FreeTDS to get the information. This is
typically only useful for error handling.

Now, if you are using PRINT from our SP, I am not sure how you can get the
results.

Thomas Rogers
System Engineer
Concurrent Computer Corporation
phone: 215.712.7422 x7261
mailto:tomr@xxxxxxxx

-----Original Message-----
From: James Vanns [mailto:jimv@xxxxxxxxxxxxxxxx]
Sent: Monday, August 18, 2003 9:12 AM
To: FreeTDS Development Group
Subject: [freetds] Still can't process stored procedure results.

OK, I understand that M$ SQL Server (2000) outputs the results of stored
procedures in two different ways depending on how the sproc is written.
It can return a result set or print out the fields directly (to stdout
if you like!).

I can retrieve (using the TDS library) the results of a sproc if it is a
result-set. However I cannot if it is printed to the 'screen'. I am
switching on the directives below:

<snip>
results = socket->res_info;

if (results)
switch (result_type) {
case TDS_ROWFMT_RESULT:
case TDS_COMPUTEFMT_RESULT:
for (int i = 0 ; i < results->num_cols ; i++)
headers.push_back (results->columns[i]->column_name);

break;
case TDS_ROW_RESULT:
case TDS_COMPUTE_RESULT:
while (tds_process_row_tokens (socket, &row_type, &id) ==
TDS_SUCCEED) {
vector<string> row;
for (int i = 0 ; i < results->num_cols ; i++)
row.push_back (field_as_string (i));

result_set.push_back (row);
}
break;
}

</snip>

I am using the latest FreeTDS source and protocol version 8. Any ideas
on how I can see the results of a sproc that simply prints its output?

Many thanks.

James Vanns

--
James Vanns BSc (Hons) MCP
Linux Systems Administrator
Senior Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370

_______________________________________________
FreeTDS mailing list
FreeTDS@xxxxxxxxxxxxxxxxx
http://lists.ibiblio.org/mailman/listinfo/freetds


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation