Skip to Content.
Sympa Menu

freetds - Re: [freetds] Help needed with standard error output with using fisql

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Help needed with standard error output with using fisql
  • Date: Fri, 5 Jun 2009 21:19:50 -0400

Modesto Sevilla wrote:
> I am having problem redirecting the standard error when I use fisql
> with an input file.
> The -e parameter is now used for echoing SQL input not standard error.

-e writes to standard output. Cf. src/app/fisql/fisql.c, line 637:

635 for (i = 0; i < ibuflines; i++) {
636 if (echo) {
637 puts(ibuf[i]);
638 }
639 dbcmd(dbproc, ibuf[i]);
640 dbcmd(dbproc, "\n");
641 free(ibuf[i]);
642 }

> When I have an error in the sql_file, I get a segmentation fault but the
>
> output_log is blank.

Works here:

$ cat i
print 'hello'
select 'goodbye'
raiserror( 'this is a mistake', 16, 1)
go
$ fisql -S$S -U$U -P$P -e -ii -oo
$ cat o
1>> 2>> 3>> 4>> print 'hello'
select 'goodbye'
raiserror( 'this is a mistake', 16, 1)
hello

-------
goodbye

(1 rows affected)
Msg 50000, Level 16, State 1:
Server 'TITAN', Line 3:
this is a mistake
DB-LIBRARY error:
General SQL Server error: Check messages from the SQL Server
Operating-system error:
(null)
1>>

> Anyone has any ideas?

bsqldb might be better suited to what you're doing:

$ bsqldb -S$S -U$U -P$P -ee -ii -oo
$ tail i e o
==> i <==
print 'hello'
select 'goodbye'
raiserror( 'this is a mistake', 16, 1)
go

==> e <==
hello
@@rowcount not available

-------
1 rows affected
Msg 50000, Level 16, State 1
Server 'TITAN', Line 3
this is a mistake
bsqldb: error: severity 16 > 10, exiting

==> o <==
goodbye


HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page