Exemplo n.º 1
0
    def __delete_rows(self, request, schema, table, row_id=None):
        where = request.GET.getlist("where")
        query = {"schema": schema, "table": table}
        if where:
            query["where"] = self.__read_where_clause(where)
        context = {
            "connection_id": request.data["connection_id"],
            "cursor_id": request.data["cursor_id"],
            "user": request.user,
        }

        if row_id:
            clause = {
                "operator": "=",
                "operands": [
                    actions._load_value(row_id),
                    {"type": "column", "column": "id"},
                ],
                "type": "operator",
            }
            where = query.get("where")
            if where:  # If there is already a where clause take the conjunction
                clause = conjunction([clause, where])
            query["where"] = clause

        return actions.data_delete(query, context)
Exemplo n.º 2
0
    def __delete_rows(self, request, schema, table, row_id=None):
        where = request.GET.getlist('where')
        query = {
            'schema': schema,
            'table': table,
        }
        if where:
            query['where'] = self.__read_where_clause(where)
        context = {
            'connection_id': request.data['connection_id'],
            'cursor_id': request.data['cursor_id'],
            'user': request.user
        }

        if row_id:
            clause = {
                'operator':
                '=',
                'operands': [
                    actions._load_value(row_id), {
                        'type': 'column',
                        'column': 'id'
                    }
                ],
                'type':
                'operator'
            }
            where = query.get('where')
            if where:  # If there is already a where clause take the conjunction
                clause = conjunction([clause, where])
            query['where'] = clause

        return actions.data_delete(query, context)
Exemplo n.º 3
0
    def __delete_rows(self, request, schema, table, row_id=None):
        where = request.GET.get('where')
        query = {
            'schema': schema,
            'table': table,
            'where': self.__read_where_clause(where),
        }

        context = {'cursor_id': request.data['cursor_id'],
                   'user': request.user}

        if row_id:
            query['where'].append({
                'left': {
                    'type': 'column',
                    'column': 'id'
                },
                'operator': '=',
                'right': row_id,
                'type': 'operator_binary'
            })
        return actions.data_delete(query, context)