'Returns a complete input.
For dot commands it will be one line.  For SQL statements it
will be as many as is necessary to have a
:meth:`~apsw.complete` statement (ie semicolon terminated).
Returns None on end of file.'

def getcompleteline(self):

    try:
        self._completion_first = True
        command = self.getline(self.prompt)
        if (command is None):
            return None
        if (len(command.strip()) == 0):
            return ''
        if (command[0] == '?'):
            command = ('.help    ' + command[1:])
        while ((command[0] != '.') and (not apsw.complete(command))):
            self._completion_first = False
            line = self.getline(self.moreprompt)
            if (line is None):
                raise self.Error(('Incomplete    SQL    (line    %d    of    %s):    %s\n' % (self.input_line_number, getattr(self.stdin, 'name', '<stdin>'), command)))
            if (line in ('go', '/')):
                break
            command = ((command + '\n') + line)
        return command
    except KeyboardInterrupt:
        self.handle_interrupt()
        return ''
