yasql (Yet Another SQL client)

Summary

I always liked the Sybase isql and MySQL mysql command-line shells for Unix. I have often regretted the lack of a Unix port to osql, the command-line interface to M$-SQL. Eventually I wrote one.

Usage

    [yasql help] [such as it is]

    Transact-SQL commands may be typed in at the 'yasql>' prompt.
    Multiline commands may be wrapped and continued at the '-->' prompt.

    To execute a command, end it with ';', or type 'go' or '\g' at the
    next line.

    Commands: (all may be prefixed by ":", ie ":view", for clarity)

        bye     exit program
        clear   clear/reset current query
        exit    synonym for "bye"
        help    this screen
        go      run current query (shortcut: \g)
        quit    synonym for "bye"
        reset   synonym for "clear"
        set     set internal variable (see below)
        view    print current query

    Set variables: (set with ":set var value"; unset with ":set novar"
    or empty value)

        column_delimiter   string to separate fields when output is directed
                           to a transcript file; defaults to tab ("\\t")
        column_separator   synonym for "column_delimiter"
        field_delimiter    synonym for "column_delimiter"
        field_separator    synonym for "column_delimiter"
        format             synonym for "result_mode"
        grep               perl regexp applied to result set; only matching
                           rows are displayed/written.
        log                redirects result sets from console to a file
        logfile            synonym for "log"
        outfile            synonym for "log"
        output             synonym for "log"
        mode               synonym for "result_mode"
        result_mode        When set to "data, rec, record, list, detail, or
                           zoom," all result sets are shown in a "name: value"
                           list of lists.  Default behavior can be restored
                           with "tab, table, col, column, columns, row, or
                           rows".  Can also take a value of "HTML", which
                           outputs data in <TR>(<TD></td>)+</tr> sets.
        row_delimitor      string to separate records when output is directed
                           to a transcript file; defaults to newline ("\\n")
        row_separator      synonym for row_delimiter
        transcript         synonym for "log"

    Translated queries:

        The following queries are completely re-written by the yasql engine
        from their mysql-like representations to M$SQL-compatible versions.
        The translated versions are displayed at runtime for your edification.

            SHOW TABLES
            SHOW DATABASES
            SHOW VIEWS
            SHOW PROCS
            DESCRIBE [TABLE]
            SELECT ... LIMIT n

Download

yasql.pl

Author

Mark Zieg <mark@zieg.com>