> Is there a way to toggle autocommit mode within ireport.py ?

When the default was changed to autocommit, I forgot to add an option to change the 
default. Just replace the following two functions in ireport.py

def createSession (options):
    if not options.userinfo:
        fatalError ('user name must be specified (option -u)')
    if not options.dbname:
        fatalError ('dabase name must be specified (option -d)')
    name, pwd = split (options.userinfo, ',')
    try:
        connectoptions = []
        if not options.transactions:
            connectoptions.append ('autocommit=on')
        if options.oracle:
            connectoptions.append ('sqlmode=oracle')
        if options.odbc:
            connectoptions.append ('component=ODB')
        optstring = string.join (connectoptions, '&')
        result = sapdb.connect (name, pwd, options.dbname, options.node, optstring)
    except sapdb.SQLError, err:
        if err.errorCode == -4008:
            name = upper (name)
            result = sapdb.connect (name, pwd, options.dbname, options.node, optstring)
    return result


def _options ():
    return [
        # (optstring, varname, typechar, default, help)
        ('u', 'userinfo', ':', None, '<user>,<pwd>'),
        ('d', 'dbname', ':', None, 'database name'),
        ('n', 'node', ':', '', 'server name'),
        ('lines', None, ':', defaultLines (), 'lines per screen'),
        ('columns', None, ':', defaultCols (), 'columns per line'),
        ('editor', None, ':', defaultEditor (), 'editor to edit SQL'),
        ('pager', None, ':', None, 'program to scroll result sets'),
        ('batch', None, ':', None, 'to stdout [grid, compressed or printf format]'),
        ('version', None, '', _versionString, 'version information'),
        ('oracle', None, '', None, 'enable Oracle (tm) SQL syntax'),
        ('odbc', None, '', None, 'enable ODBC/JDBC SQL syntax'),
        ('transactions', None, '', None, 'use transactions instead of autocommit'),
        ('history', None, ':', '~/.ireport', 'name of history file'),
        ('tutorial', None, '', None, 'start tutorial'),
        ]

This also adds an option -odbc to help you test statements if you develop mainly with 
ODBC, JDBC or one of the derived interfaces (DBD::ODBC, PHP, VB etc.)

It wouldn't be difficult to add a command as well, just use do_commit as a template 
and call self.session.setAutocommit depending on the value of strarg. Adding a new 
do_* method is enough to create a new command, you don't have to register it anywhere 
else.

> ireport has some nice features, but do not display the resultset size.
> That's a pity.

That's because the size of a result set is not known unless one steps through to the 
end. Even calling the bottom command will not help as the kernel doesn't tell how many 
records have been skipped.

Daniel Dittmar

-- 
Daniel Dittmar
SAP Labs Berlin
[EMAIL PROTECTED]

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to