def default(self, cmd):
        cmd = cmd.strip()

        if cmd == 'EOF':
            # EOF means exit.  print a new line to clean up
            print
            return True

        if not cmd.endswith(';'):
            cmd = self.multiline(cmd).strip()

        # if there are multiple statements on one line, split them up
        if ';' in cmd:
            # split up the command and execute each part
            complete, partial = cmd.split(';', 1)
            if partial:
                # if there are two or more commands, run the first
                self.default(complete + ';')
                return self.default(partial)

        if not cmd:
            # no sql, noop
            return False

        start = time.time()
        # execute the SQL command
        try:
            # a weak attempt to see if we have any %(keyword)s to expand
            if r'%(' in cmd:
                cmd = cmd % self.db.keywords
            self.cu.execute(cmd)
        except sqlerrors.DatabaseError, e:
            if len(e.args) > 1:
                print 'Error:', str(e.args[0])
            else:
                print 'Error:', str(e)
            return False
        except Exception, e:
            print 'Error:', str(e)
            return False

        # check for no rows
        if self.cu.fields() is None or not len(self.cu.fields()):
            print "Query OK"
            # reload the schema, in case there was a change
            self.db.loadSchema()
        else: # display the results (if any)
            rows, end = self.display(self.cu)
            if self.show_stats and rows != -1:
                print '%d rows in set (%.2f sec)' %(rows, end - start)
        return False
dataset/ETHPy150Open sassoftware/conary/conary/dbstore/shell.py/DbShell.default/original