コード例 #1
0
ファイル: views.py プロジェクト: sashatankov/oeplatform
    def __update_rows(self, request, schema, table, row, row_id=None):
        context = {
            "connection_id": request.data["connection_id"],
            "cursor_id": request.data["cursor_id"],
            "user": request.user,
        }

        where = request.GET.getlist("where")

        query = {"schema": schema, "table": table, "values": row}

        if where:
            query["where"] = self.__read_where_clause(where)

        if row_id:
            clause = {
                "operator": "=",
                "operands": [
                    actions._load_value(row_id),
                    {"type": "column", "column": "id"},
                ],
                "type": "operator",
            }
            where = query.get("where")
            if where:
                clause = conjunction([clause, where])
            query["where"] = clause

        return actions.data_update(query, context)
コード例 #2
0
ファイル: views.py プロジェクト: knut0815/oeplatform
    def __update_rows(self, request, schema, table, row, row_id=None):
        context = {
            'connection_id': request.data['connection_id'],
            'cursor_id': request.data['cursor_id'],
            'user': request.user
        }

        where = request.GET.getlist('where')

        query = {'schema': schema, 'table': table, 'values': row}

        if where:
            query['where'] = self.__read_where_clause(where)

        if row_id:
            clause = {
                'operator':
                '=',
                'operands': [
                    actions._load_value(row_id), {
                        'type': 'column',
                        'column': 'id'
                    }
                ],
                'type':
                'operator'
            }
            where = query.get('where')
            if where:
                clause = conjunction([clause, where])
            query['where'] = clause

        return actions.data_update(query, context)
コード例 #3
0
    def __update_rows(self, request, schema, table, row, row_id=None):
        context = {'cursor_id': request.data['cursor_id'],
                   'user': request.user}

        where = request.GET.get('where')

        query = {
            'schema': schema,
            'table': table,
            'where': self.__read_where_clause(where),
            'values': row
        }
        if row_id:
            query['where'].append({
                'left': {
                    'type': 'column',
                    'column': 'id'
                },
                'operator': '=',
                'right': actions._load_value(row_id),
                'type': 'operator_binary'
            })
        return actions.data_update(query, context)