How to use the @bentley/imodeljs-backend.ChangeSummaryManager.buildPropertyValueChangesECSql function in @bentley/imodeljs-backend

To help you get started, we’ve selected a few @bentley/imodeljs-backend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / agent-test-app / src / QueryAgent.ts View on Github external
changeContent.instanceChanges = this._iModelDb!.withPreparedStatement("SELECT ECInstanceId FROM ecchange.change.InstanceChange WHERE Summary.Id=? ORDER BY ECInstanceId", (stmt: ECSqlStatement): any[] => {
            stmt.bindId(1, changeSummary.id);
            const instanceChanges = new Array();
            while (stmt.step() === DbResult.BE_SQLITE_ROW) {
                const row = stmt.getRow();

                const instanceChange: any = ChangeSummaryManager.queryInstanceChange(this._iModelDb!, Id64.fromJSON(row.id));
                switch (instanceChange.opCode) {
                    case ChangeOpCode.Insert: {
                        // Get the instance after the insert
                        const rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.AfterInsert));
                        assert(rows.length === 1);
                        instanceChange.after = rows[0];
                        break;
                    }
                    case ChangeOpCode.Update: {
                        // Get the instance before the update
                        let rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.BeforeUpdate));
                        assert(rows.length === 1);
                        instanceChange.before = rows[0];
                        // Get the instance after the update
                        rows = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.AfterUpdate));
                        assert(rows.length === 1);
                        instanceChange.after = rows[0];
                        break;
                    }
                    case ChangeOpCode.Delete: {
github imodeljs / imodeljs / test-apps / agent-test-app / src / QueryAgent.ts View on Github external
break;
                    }
                    case ChangeOpCode.Update: {
                        // Get the instance before the update
                        let rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.BeforeUpdate));
                        assert(rows.length === 1);
                        instanceChange.before = rows[0];
                        // Get the instance after the update
                        rows = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.AfterUpdate));
                        assert(rows.length === 1);
                        instanceChange.after = rows[0];
                        break;
                    }
                    case ChangeOpCode.Delete: {
                        // Get the instance before the delete
                        const rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.BeforeDelete));
                        assert(rows.length === 1);
                        instanceChange.before = rows[0];
                        break;
                    }
                    default:
                        throw new Error("Unexpected ChangedOpCode " + instanceChange.opCode);
                }
                instanceChanges.push(instanceChange);
            }
            return instanceChanges;
        });
github imodeljs / imodeljs / test-apps / agent-test-app / src / QueryAgent.ts View on Github external
const instanceChanges = new Array();
            while (stmt.step() === DbResult.BE_SQLITE_ROW) {
                const row = stmt.getRow();

                const instanceChange: any = ChangeSummaryManager.queryInstanceChange(this._iModelDb!, Id64.fromJSON(row.id));
                switch (instanceChange.opCode) {
                    case ChangeOpCode.Insert: {
                        // Get the instance after the insert
                        const rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.AfterInsert));
                        assert(rows.length === 1);
                        instanceChange.after = rows[0];
                        break;
                    }
                    case ChangeOpCode.Update: {
                        // Get the instance before the update
                        let rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.BeforeUpdate));
                        assert(rows.length === 1);
                        instanceChange.before = rows[0];
                        // Get the instance after the update
                        rows = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.AfterUpdate));
                        assert(rows.length === 1);
                        instanceChange.after = rows[0];
                        break;
                    }
                    case ChangeOpCode.Delete: {
                        // Get the instance before the delete
                        const rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.BeforeDelete));
                        assert(rows.length === 1);
                        instanceChange.before = rows[0];
                        break;
                    }
                    default:
github imodeljs / imodeljs / test-apps / agent-test-app / src / QueryAgent.ts View on Github external
const instanceChange: any = ChangeSummaryManager.queryInstanceChange(this._iModelDb!, Id64.fromJSON(row.id));
                switch (instanceChange.opCode) {
                    case ChangeOpCode.Insert: {
                        // Get the instance after the insert
                        const rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.AfterInsert));
                        assert(rows.length === 1);
                        instanceChange.after = rows[0];
                        break;
                    }
                    case ChangeOpCode.Update: {
                        // Get the instance before the update
                        let rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.BeforeUpdate));
                        assert(rows.length === 1);
                        instanceChange.before = rows[0];
                        // Get the instance after the update
                        rows = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.AfterUpdate));
                        assert(rows.length === 1);
                        instanceChange.after = rows[0];
                        break;
                    }
                    case ChangeOpCode.Delete: {
                        // Get the instance before the delete
                        const rows: any[] = this._iModelDb!.executeQuery(ChangeSummaryManager.buildPropertyValueChangesECSql(this._iModelDb!, instanceChange, ChangedValueState.BeforeDelete));
                        assert(rows.length === 1);
                        instanceChange.before = rows[0];
                        break;
                    }
                    default:
                        throw new Error("Unexpected ChangedOpCode " + instanceChange.opCode);
                }
                instanceChanges.push(instanceChange);
            }