(self, cmd)
mode MODE ?TABLE?: Sets output mode to one of
mode MODE ?TABLE?: Sets output mode to one of
mode MODE ?TABLE? : Sets output mode to one of
def command_mode(self, cmd):
        """mode MODE ?TABLE?: Sets output mode to one of"""
        if len(cmd) in (1, 2):
            w = cmd[0]
            if w == "tabs":
                w = "list"
            m = getattr(self, "output_" + w, None)
            if w != "insert":
                if len(cmd) == 2:
                    raise self.Error("Output mode %s doesn't take parameters" % (cmd[0]))
            if m:
                self.output = m
                # set some defaults
                self.truncate = True
                if cmd[0] == "csv":
                    self.separator = ","
                elif cmd[0] == "tabs":
                    self.separator = "\t"
                else:
                    pass
                    #self.separator=self._output_stack[0]["separator"]
                if w == "insert":
                    if len(cmd) == 2:
                        self._output_table = cmd[1]
                    else:
                        self._output_table = "table"
                    self._output_table = self._fmt_sql_identifier(self._output_table)
                return
        if not self._output_modes:
            self._cache_output_modes()
        raise self.Error("Expected a valid output mode: " + ", ".join(self._output_modes))
def command_mode ( self , cmd ) : if len ( cmd ) in ( 1 , 2 ) : w = cmd [ 0 ] if w == "tabs" : w = "list" m = getattr ( self , "output_" + w , None ) if w != "insert" : if len ( cmd ) == 2 : raise self . Error ( "Output mode %s doesn't take parameters" % ( cmd [ 0 ] ) ) if m : self . output = m # set some defaults self . truncate = True if cmd [ 0 ] == "csv" : self . separator = "," elif cmd [ 0 ] == "tabs" : self . separator = "\t" else : pass #self.separator=self._output_stack[0]["separator"] if w == "insert" : if len ( cmd ) == 2 : self . _output_table = cmd [ 1 ] else : self . _output_table = "table" self . _output_table = self . _fmt_sql_identifier ( self . _output_table ) return if not self . _output_modes : self . _cache_output_modes ( ) raise self . Error ( "Expected a valid output mode: " + ", " . join ( self . _output_modes ) )