On Tue, Aug 28, 2001 at 04:36:56PM +0200, Alexander Farber wrote:

> in order to access a Centura SQLBase 7.5 hosted on a Windows NT 4 
> machine via the dbish and Easysoft OOB (trial version):

Cool.

> and it kind of works: I am able to issue SQL queries.
> But often the results of the queries look mangled.
> For example, if you look below, the column CNA_ID seems
> to be overwritten (by the NOTE_BOOK column maybe?
> 
>     mssweb@dbi:ODBC:SOURCE1> select CNA_ID from cn_a where cna_id='000228'/
>     CNA_ID
>     '000228'
>     [1 rows of 1 fields returned]

Looks normal.

>     mssweb@dbi:ODBC:SOURCE1> select * from cn_a where cna_id='000228'/
>     
>CNA_ID,CNA_CODE,SYSTEM_TYPE,AS_ABBR,CNA_NO,CNA_LEVEL,LAST_ACA_NO,LAST_ECA_NO,LAST_SCA_NO,CNA_STATUS,CNA_REL_DATE,CNA_DOC,CNA_DOC_LANG,CNA_DOC_REV,CONV_FROM,CNA_TEXT,CNA_OLD_ID,FILE_NAME,NOTE_BOOK,LAST_DEL_NO,CNA_REV,SEQ_NO,INHR_FROM_ID,LAST_MCA_NO,LCL_LAST_ECA_NO,LCL_LAST_MCA_NO,INHR_FROM_CODE,CNA_MAPP_ID,BMT_NO
>      LSV24 ref 
>.','10','11',undef,undef,'0','0','0',undef,undef,undef',undef,'NA','na','NA','MSS','na','CM5RR','CN000228','LSV23
> ref imported will be replaced by LSV24 to start prep for INDUS
>      [1 rows of 29 fields returned]

Yuck.

> 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.

> Here are my questions, maybe someone can help me
> 
> 1) I wonder how to fix the above problem?

Posting to the list is a good start.  You're always welcome to patch
the code ;->

> 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)
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

Need to add this to the list.

> 4) I have:
> 
>     maas34:eedalf {106} perl -MData::ShowTable -e 1
>     maas34:eedalf {107} 
> 
>    but it doesn't seem to be used (see the ugly output above), why?

At the command prompt type: /format (/ default execute prefix.)
@mysql--> /format
Unable to select '': Format '' unavailable. Available formats: box, html, neat, raw, 
sqlminus, string

This shows all the formats available. (you may not have all of these)

Select a new format style:
@mysql--> /format
Unable to select '': Format '' unavailable. Available formats: box, html, neat, raw, 
sqlminus, string
 
format: neat
id_pk,iso_code,gender,description
'0','0','U','Not Known'
'1','1','M','Male'
'2','2','F','Female'
'9','9','S','Not Specified'
[4 rows of 4 fields returned]

@mysql--> /format box
@mysql--> select * from gender_codes/
+-----+--------+------+-------------+
|id_pk|iso_code|gender|description  |
+-----+--------+------+-------------+
|    0|       0|U     |Not Known    |
+-----+--------+------+-------------+
|    1|       1|M     |Male         |
+-----+--------+------+-------------+
|    2|       2|F     |Female       |
+-----+--------+------+-------------+
|    9|       9|S     |Not Specified|
+-----+--------+------+-------------+
[4 rows of 4 fields returned]

Note, that on select * on a table with a large number of columns is
still going to be ugly.
@mysql--> select * from lng
@mysql--> /
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|lchar
                                                     |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[1 rows of 1 fields returned]

However, one method around this is to pipe to less -S.  Allows for
horizontal scrolling.

@mysql--> select * from lng/ | less -S

> Besides the above problems, I think that DBI::Shell and dbish
> are great things. They'll probably save me from installing
> Win NT 4, SQLBase and SQLsomething in order to just being able
> to send few SQL commands while I'm developing a CGI-script...

Good to hear someone other than myself is using dbish ... ;-)

Tom

-- 
Thomas A. Lowery
See DBI/FAQ http://tlowery.hypermart.net

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to