'calls main setformat and then builds the insert SQL'

def setformat(self, formatstr=None):

    ph = self.dbconfig.get('insert_param', self._DBTYPE_PLACEHOLDER_MAP.get(self.dbconfig['dbtype'], '%%s'))
    self.format_types = self.dbconfig.get('format_types', 'x')
    Output.setformat(self, formatstr, typemap=self._TYPEMAP)
    self.tablefield = 'decoder'
    for (fname, ftype, fspec) in self.fields:
        if (ftype == 'T'):
            self.tablefield = fname
    sqlfields = [self.fieldmap[fname][0] for (fname, ftype, fspec) in self.fields if (fname in self.fieldmap)]
    self.insertsql = ('INSERT    INTO    "%%s"    (%s)    VALUES    (%s)' % (','.join(sqlfields), ','.join(([ph] * len(sqlfields)))))
