Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS: Fisql utility command fails to give (return status=0) for SQL Store proc with multiple output Tabs (Results+Messages)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS: Fisql utility command fails to give (return status=0) for SQL Store proc with multiple output Tabs (Results+Messages)
  • Date: Fri, 9 Sep 2016 16:53:57 +0100

2016-09-09 15:05 GMT+01:00 <vasanth.sengunthar AT accenture.com>:
> Hi Bill,
>
> Thank you for prompt response and yes, please help us with required code to
> fix the fisql Issue.
>
> We tried to solve the issue via 'tsql' program but with given such
> scenario, tsql fails to capture both (results + messages) with output
> file. It fetch only results to output file not the messages rather prints
> the same in command prompt itself.
>
> Thanks,
> -Vasanth
>

Can you try this change?

diff --git a/src/apps/fisql/fisql.c b/src/apps/fisql/fisql.c
index 0396920..67aa850 100644
--- a/src/apps/fisql/fisql.c
+++ b/src/apps/fisql/fisql.c
@@ -683,6 +683,8 @@ main(int argc, char *argv[])
signal(SIGINT, active_interrupt_handler);
dbsetinterrupt(dbproc, (void *) active_interrupt_pending,
(void *) active_interrupt_servhandler);
if (dbsqlexec(dbproc) == SUCCEED) {
+ int status_printed = 0;
+
maybe_handle_active_interrupt();
while ((dbrc = dbresults(dbproc)) != NO_MORE_RESULTS) {
printedlines = 0;
@@ -802,12 +804,14 @@ main(int argc, char *argv[])
if (DBCOUNT(dbproc) >= 0) {
fprintf(stdout, "(%d rows affected",
(int) DBCOUNT(dbproc));
if (dbhasretstat(dbproc)) {
+ status_printed = 1;
dbrc = dbretstatus(dbproc);
fprintf(stdout, ", return status = %d",
dbrc);
}
fprintf(stdout, ")\n");
} else {
if (dbhasretstat(dbproc)) {
+ status_printed = 1;
dbrc = dbretstatus(dbproc);
fprintf(stdout, "(return status =
%d)\n", dbrc);
}
@@ -815,6 +819,10 @@ main(int argc, char *argv[])
}
}
}
+ if (!status_printed && dbhasretstat(dbproc)) {
+ dbrc = dbretstatus(dbproc);
+ fprintf(stdout, "(return status = %d)\n", dbrc);
+ }
} else {
/* Something failed, so change the default
* exit status to reflect that.

Frediano


> -----Original Message-----
> From: FreeTDS [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of
> Thompson, William
> Sent: Thursday, September 08, 2016 6:27 PM
> To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
> Subject: Re: [freetds] FreeTDS: Fisql utility command fails to give (return
> status=0) for SQL Store proc with multiple output Tabs (Results+Messages)
>
> Hi,
>
> There's a bug, if you want to call it that, in the fisql program that means
> that the "return status = n" message is not printed in this case.
>
> One solution would be to use the "tsql" program rather than "fisql", if you
> like. I've checked, and it works as you would want.
>
> If for some reason, you're especially fond of fisql, then it could be fixed.
> Are you prepared to fix it yourself and try it out? If so, I'll give you a
> suggested code change...
>
> Cheers,
>
> Bill
>
> -----Original Message-----
> From: FreeTDS [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of
> vasanth.sengunthar AT accenture.com
> Sent: 08 September 2016 07:28
> To: freetds AT lists.ibiblio.org
> Subject: [freetds] FreeTDS: Fisql utility command fails to give (return
> status=0) for SQL Store proc with multiple output Tabs (Results+Messages)
>
> Hi,
>
> Please help with missing (return status=0) with fisql command for MS SQL
> Server 2012 -output from Linux OS.
> Check trail mail for more reference.
>
> Regards,
> Vasanth
>
> -----Original Message-----
> From: Sengunthar, Vasanth
> Sent: Tuesday, August 30, 2016 8:29 PM
> To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
> Subject: RE: [freetds] FreeTDS: Fisql utility command fails to give (return
> status=0) for SQL Store proc with multiple output Tabs (Results+Messages)
>
> Hi All,
>
> Please help with below Issue.
> Looking forward to hearing a positive response from you.
>
> Regards,
> Vasanth
>
>
> -----Original Message-----
> From: Sengunthar, Vasanth
> Sent: Monday, August 22, 2016 3:09 PM
> To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
> Subject: RE: [freetds] FreeTDS: Fisql utility command fails to give (return
> status=0) for SQL Store proc with multiple output Tabs (Results+Messages)
>
> Hi,
>
> Please check below sample SP.
>
> Database : Microsoft SQL Server 2012
> Protocol Version : tds_version = 7.0
>
> [SP]
> ---------
> USE [TEST01]
> GO
> /****** Object: StoredProcedure [dbo].[tst_test_result_msg] Script
> Date: 8/22/2016 5:31:16 AM ******/
> SET ANSI_NULLS OFF
> GO
> SET QUOTED_IDENTIFIER ON
> GO
>
> ALTER PROCEDURE [dbo].[tst_test_result_msg]
> @tst_flag varchar(1),
> @tst_desc varchar(40)
> AS
> BEGIN
> DECLARE
> @tst_activ_type varchar(5)
>
> SELECT cust_no, cust_name
> FROM dbo.customer
>
> IF @tst_flag = 'A'
> SELECT @tst_desc = 'Print A'
> ELSE
> IF @tst_flag = 'B'
> SELECT @tst_desc = 'Print B'
> ELSE
> IF @tst_flag = 'C'
> SELECT @tst_desc = 'Print C'
> ELSE
> IF @tst_flag = 'D'
> SELECT @tst_desc = 'Print D'
>
> PRINT @tst_desc
> END
>
>
> Regards,
> Vasanth
>
>
> -----Original Message-----
> From: FreeTDS [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Igor
> Korot
> Sent: Sunday, August 21, 2016 7:03 AM
> To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
> Subject: Re: [freetds] FreeTDS: Fisql utility command fails to give (return
> status=0) for SQL Store proc with multiple output Tabs (Results+Messages)
>
> Hi.
> Do you have an example of one such SP?
> What is you DB (MS, Sybase) and what version?
> Which protocol version do you use?
>
> All in all - we need more info.
>
> Thank you.
>
> On Aug 20, 2016 11:01 AM, <vasanth.sengunthar AT accenture.com> wrote:
>
>
> Hi,
>
>
>
> Thank you all in advance, please help me with below issue.
>
>
>
> I have been working with fisql command lot lately and recently I came
> across this issue, where the fisql command does not give (return status=0)
> for some SQL execution.
>
>
>
> The Issues is not generic but specific to any such SQL store procedure
> which gives output in (results + message) format.
>
>
>
> And the approach I like to present to out client includes such scenario
> where they have multiple store procedure like above.
>
>
>
> Looking forward to your earliest response,
>
> Regards,
> Vasanth Sengunthar
>
> ________________________________
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the e-mail by you is prohibited. Where allowed
> by local law, electronic communications with Accenture and its affiliates,
> including e-mail and instant messaging (including content), may be scanned
> by our systems for the purposes of information security and assessment of
> internal compliance with Accenture policy.
> ____________________________________________________________
> __________________________
>
> www.accenture.com
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.ibiblio.org_mailman_listinfo_freetds&d=DQICAg&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=vQqnb-FGv_1Cq8lIuKD95mRfUO0gBovRe0eqdms7a5s&m=IodVUj5zMfeQKJDmDX80aFnfyn9y4W4EpZ5OBAzYolQ&s=aGO9gO5yFlXxuEHx6iLcCyFGQDh_XC5h1qsrfVFYXsM&e=
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.ibiblio.org_mailman_listinfo_freetds&d=DQICAg&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=vQqnb-FGv_1Cq8lIuKD95mRfUO0gBovRe0eqdms7a5s&m=IodVUj5zMfeQKJDmDX80aFnfyn9y4W4EpZ5OBAzYolQ&s=aGO9gO5yFlXxuEHx6iLcCyFGQDh_XC5h1qsrfVFYXsM&e=
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.ibiblio.org_mailman_listinfo_freetds&d=DQICAg&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=vQqnb-FGv_1Cq8lIuKD95mRfUO0gBovRe0eqdms7a5s&m=kiLkyqyKTjhcDkCkKEW_pwbkNHFdvDtZj6mbcor2fMQ&s=YeeQpC5oh2O1h9ftbdVpH6iIE20ltx2edLYOiJ7Piyg&e=
>
> ----------------------------------------------------------------------
> This message, and any attachments, is for the intended recipient(s) only,
> may contain information that is privileged, confidential and/or proprietary
> and subject to important terms and conditions available at
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.bankofamerica.com_emaildisclaimer&d=DQICAg&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=vQqnb-FGv_1Cq8lIuKD95mRfUO0gBovRe0eqdms7a5s&m=kiLkyqyKTjhcDkCkKEW_pwbkNHFdvDtZj6mbcor2fMQ&s=IxXw3jX5aMlcnYvBOGeU3od1dXPXg8zb-yd9JzTJdow&e=
> . If you are not the intended recipient, please delete this message.
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.ibiblio.org_mailman_listinfo_freetds&d=DQICAg&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=vQqnb-FGv_1Cq8lIuKD95mRfUO0gBovRe0eqdms7a5s&m=kiLkyqyKTjhcDkCkKEW_pwbkNHFdvDtZj6mbcor2fMQ&s=YeeQpC5oh2O1h9ftbdVpH6iIE20ltx2edLYOiJ7Piyg&e=
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page