Ah but you're missing command line editing!

I've actually writen a few isql clones in perl, including one that was left as an exercise for my students :-)

I just found the following - written for perl 4/sybperl 1.xx, with a last modified date of Feb 22, 1994:

#!/usr/local/bin/sybperl require 'sybperl.pl'; require 'getopts.pl'; &Getopts('P:U:'); &dblogin($opt_U, $opt_P); select(STDOUT); $| = 1; # set unbuffered $count = 1; print "$count> "; while(<>) { /^exit|^quit/ && exit(0); /^go/ && do { &exec; $count = 1; print "$count> "; next; }; &dbcmd($_); ++$count; print "$count> "; } sub exec { local($ret, $numcol, $i); local(@dat, %width); &dbsqlexec; while(($ret = &dbresults) != $NO_MORE_RESULTS) { $numcol = &dbnumcols; for($i = 1; $i <= $numcol; ++$i) { $width{$i} = &dbcollen(0, $i); printf("%-$width{$i}.$width{$i}s ", &dbcolname(0, $i)); } print "\n\n"; while(@dat = &dbnextrow) { for($i = 1; $i <= $numcol; ++$i) { printf("%$width{$i}.$width{$i}s ", $dat[$i-1]); } print "\n"; } while(@dat = &dbretdata) { print "@dat\n"; } } }
I think I used that for my presentation at the 1994 Sybase User Group conference. I have a feeling I'd write that a little bit differently today :-)

Michael


In reply to Re: Fake sqsh by mpeppler
in thread Fake sqsh by hossman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.