Hi Thomas,
thank you for your reply. I'll answer more next
week, but here is some more information from me:
On Tue, Aug 28, 2001 at 10:29:43PM -0400, Thomas A. Lowery wrote:
> > And if I select the NOTE_BOOK column alone, it looks
> > like the text is being written line by line, but on
> > the same row:
> >
> > mssweb@dbi:ODBC:SOURCE1> select NOTE_BOOK from cn_a where cna_id='000228'/
> > NOTE_BOOK
> > LSV24 ref .'ported will be replaced by LSV24 to start prep for INDUS
> > [1 rows of 1 fields returned]
>
> Does this column contain embedded control characters? \r would do
> what you're describing.
I'll test next week if there are any \r (maybe the dot in "INDUS.\n" below?)
But I have also tried using the Data::ShowTable as you advised and it solves
my problem:
maas34:eedalf {111} dbish
DBI::Shell 10.7 using DBI 1.14
WARNING: The DBI::Shell interface and functionality are
======= very likely to change in subsequent versions!
Use of uninitialized value in length at
/opt/local/perl-5.6.0/lib/site_perl/5.6.0/sun4-solaris/DBI/Shell.pm line 734.
Connecting to 'dbi:ODBC:SOURCE1' as 'mssweb'...
mssweb@dbi:ODBC:SOURCE1> /format
Unable to select '': Format '' unavailable. Available formats: box, neat
mssweb@dbi:ODBC:SOURCE1> /format box
mssweb@dbi:ODBC:SOURCE1> /option command_prefix=;
/option command_prefix=; (was /)
mssweb@dbi:ODBC:SOURCE1> ;option
batch: 0
chistory_size: 50
command_prefix: ;
debug: 0
displaymode: neat <--- shouldn't this be "box"?
editor: /home/eedalf/bin/vim
init_autocommit: 1
init_trace: 0
rhistory_head: 5
rhistory_size: 50
rhistory_tail: 5
mssweb@dbi:ODBC:SOURCE1> select NOTE_BOOK from cn_a where cna_id='000228';
+----------------------------------------------------------------------------------+
|NOTE_BOOK
|
+----------------------------------------------------------------------------------+
|LSV23 ref imported will be replaced by LSV24 to start prep for INDUS.\nLSV24 ref
.|
+----------------------------------------------------------------------------------+
[1 rows of 1 fields returned]
> > 2) "perldoc DBI::Shell" mentions a possibility to set/get
> > $dbh-attributes, but how do I actually do it, for example
> > for LongTruncOk or LongReadLen?
>
> /options show all the current get/set attributes. Currently Long* are
> not on the list, but I'll add them. Until then you can set these in
> the connection string:
>
> DBI_DSN="dbi:mysql(LongTruncOk=>1,LongReadLen=>25):database=names"
>
> [tlowery@stllnx1 dbish]$
>DBI_DSN="dbi:mysql(LongTruncOk=>1,LongReadLen=>25):database=names"
> [tlowery@stllnx1 dbish]$ dbish
> DBI::Shell 11.0 using DBI 1.19
> /option editor=vim (was vi)
> /option prompt=connect-- (was
>dbi:mysql(LongTruncOk=>1,LongReadLen=>25):database=names)
> /option sqlpath=.:~/sql (was .)
> /option tmp_dir=/tmp (was undef)
> /option tmp_file=dbish23077.sql (was dbish23077.sql)
Is there some debug mode for dbish, I don't see this output:
> Loaded plugins DBI::Shell::Timing
> Loaded plugins DBI::Shell::Completion
> Term defined. Term::ReadLine=HASH(0x8176fd8)
> Using Term::ReadLine::Gnu
>
> WARNING: The DBI::Shell interface and functionality are
> ======= very likely to change in subsequent versions!
>
>
> Connecting to 'dbi:mysql(LongTruncOk=>1,LongReadLen=>25):database=names' as ''...
>
> @mysql--> /opt
> batch: 0
> chistory_size: 50
> command_prefix: /
> debug: 0
> displaymode: box
> editor: vim
> format: sqlm
> init_autocommit: 1
> init_trace: 0
> prompt: mysql--
> rhistory_head: 5
> rhistory_size: 50
> rhistory_tail: 5
> separator: ,
> sqlpath: .:~/sql
> timing_style: auto
> tmp_dir: /tmp
> tmp_file: dbish22679.sql
> user_level: 1
>
>
> > 3) Is there a way to stop fetching results (like ^C in
> > sqsh or isql of Sybase?). Trying ^C kills dbish
>
> Well ... that does stop the fetch ;-0
>
> If you want a limited number of rows send the output to a pager:
> @mysql--> select * from common_first_names/ | less
What do you think about putting
local $SIG{INT} = sub {$FLAG = 1};
at the beginning of the dbish and then somewhere in the
sub sth_go {
...
while (my $rowref = $sth->fetchrow_arrayref()) {
if ($FLAG) {
$sth->finish;
print STDERR "Interrupted\n";
$FLAG = 0;
}
...
}
}
I use ctrl-c in isql/sqsh all the time and
think that many others do it as well.
> However, one method around this is to pipe to less -S. Allows for
> horizontal scrolling.
>
> @mysql--> select * from lng/ | less -S
+1 for dbish. The sqsh can't do less -S
Regards
Alex