(self, op, sql, pklist=None, splitkeys=False)
return self._create_dbdict(fields + key_fields, values + key_values)
Main entry point.
Main entry point.
Main entry point .
def parse_sql(self, op, sql, pklist=None, splitkeys=False):
        """Main entry point."""
        if pklist is None:
            self.pklist = []
        else:
            self.pklist = pklist
        tk = self.tokenizer(sql)
        fields = []
        values = []
        key_fields = []
        key_values = []
        try:
            if op == "I":
                self.parse_insert(tk, fields, values, key_fields, key_values)
            elif op == "U":
                self.parse_update(tk, fields, values, key_fields, key_values)
            elif op == "D":
                self.parse_delete(tk, fields, values, key_fields, key_values)
            raise Exception("syntax error")
        except StopIteration:
            # last sanity check
            if (len(fields) + len(key_fields) == 0 or
                len(fields) != len(values) or
                len(key_fields) != len(key_values)):
                raise Exception("syntax error, fields do not match values")
        if splitkeys:
            return (self._create_dbdict(key_fields, key_values),
                    self._create_dbdict(fields, values))
        return self._create_dbdict(fields + key_fields, values + key_values)
def parse_sql ( self , op , sql , pklist = None , splitkeys = False ) : if pklist is None : self . pklist = [ ] else : self . pklist = pklist tk = self . tokenizer ( sql ) fields = [ ] values = [ ] key_fields = [ ] key_values = [ ] try : if op == "I" : self . parse_insert ( tk , fields , values , key_fields , key_values ) elif op == "U" : self . parse_update ( tk , fields , values , key_fields , key_values ) elif op == "D" : self . parse_delete ( tk , fields , values , key_fields , key_values ) raise Exception ( "syntax error" ) except StopIteration : # last sanity check if ( len ( fields ) + len ( key_fields ) == 0 or len ( fields ) != len ( values ) or len ( key_fields ) != len ( key_values ) ) : raise Exception ( "syntax error, fields do not match values" ) if splitkeys : return ( self . _create_dbdict ( key_fields , key_values ) , self . _create_dbdict ( fields , values ) ) return self . _create_dbdict ( fields + key_fields , values + key_values )