How to use the @bentley/bentleyjs-core.DbResult.BE_SQLITE_ROW function in @bentley/bentleyjs-core

To help you get started, we’ve selected a few @bentley/bentleyjs-core 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 / core / backend / src / IModelExporter.ts View on Github external
iModelDb.withPreparedStatement("SELECT ECInstanceId FROM ecchange.change.InstanceChange WHERE Summary.Id=?", (statement) => {
        statement.bindId(1, changeSummary.id);
        while (statement.step() === DbResult.BE_SQLITE_ROW) {
          const instanceId: Id64String = statement.getValue(0).getId();
          const instanceChange: InstanceChange = ChangeSummaryManager.queryInstanceChange(iModelDb, instanceId);
          const entityClassFullName: string = EntityChangeOps._toClassFullName(instanceChange.changedInstance.className);
          try {
            const entityType: typeof Entity = iModelDb.getJsClass(entityClassFullName);
            if (entityType.prototype instanceof Element) {
              // const propertyNames: string[] = ChangeSummaryManager.getChangedPropertyValueNames(iModelDb, instanceChange.id);
              entityChanges.elements.addChange(instanceChange.opCode, instanceChange.changedInstance.id);
            } else if (entityType.prototype instanceof ElementAspect) {
              entityChanges.elementAspects.addChange(instanceChange.opCode, instanceChange.changedInstance.id);
            } else if (entityType.prototype instanceof Model) {
              entityChanges.models.addChange(instanceChange.opCode, instanceChange.changedInstance.id);
            } else if (entityType.prototype instanceof Relationship) {
              entityChanges.relationships.addChange(instanceChange.opCode, instanceChange.changedInstance.id);
            }
          } catch (error) {
github imodeljs / imodeljs / example-code / snippets / src / backend / ExecutingECSQL.ts View on Github external
iModel.withPreparedStatement("SELECT ECInstanceId,ECClassId,Parent,LastMod FROM bis.Element WHERE CodeValue=? AND LastMod>=?", (stmt: ECSqlStatement) => {
    stmt.bindString(1, "MyCode");
    stmt.bindDateTime(2, "2018-01-01T12:00:00");

    while (stmt.step() === DbResult.BE_SQLITE_ROW) {
      // do something with the query result
    }
  });
  // __PUBLISH_EXTRACT_END__
github imodeljs / imodeljs / test-apps / export-obj / src / ExportObj.ts View on Github external
iModel.withPreparedStatement("SELECT ECInstanceId FROM bis.GeometricElement3d", (stmt: ECSqlStatement) => {
    while (stmt.step() === DbResult.BE_SQLITE_ROW) {
      elementIdArray.push(stmt.getValue(0).getId());
    }
  });
github imodeljs / imodeljs / core / backend / src / IModelDb.ts View on Github external
return this._iModel.withPreparedStatement(sql, (statement: ECSqlStatement): ElementAspect[] => {
        statement.bindId("elementId", elementId);
        const aspects: ElementAspect[] = [];
        while (DbResult.BE_SQLITE_ROW === statement.step()) {
          const row: any = statement.getRow();
          aspects.push(this._queryAspect(row.id, row.className.replace(".", ":")));
        }
        return aspects;
      });
    }
github imodeljs / imodeljs / core / backend / src / ECSqlStatement.ts View on Github external
public next(): IteratorResult {
    if (DbResult.BE_SQLITE_ROW === this.step()) {
      return {
        done: false,
        value: this.getRow(),
      };
    } else {
      return {
        done: true,
        value: undefined,
      };
    }
  }
github imodeljs / imodeljs / core / backend / src / ChangeSummaryManager.ts View on Github external
(stmt: ECSqlStatement) => {
        stmt.bindString(1, changeSetId);
        if (DbResult.BE_SQLITE_ROW === stmt.step())
          return stmt.getValue(0).getId();

        return undefined;
      });
  }
github imodeljs / imodeljs / core / backend / src / LinkTableRelationship.ts View on Github external
return this._iModel.withPreparedStatement(`SELECT * FROM ${relClassSqlName} WHERE ecinstanceid=?`, (stmt: ECSqlStatement) => {
        stmt.bindId(1, criteria);
        if (DbResult.BE_SQLITE_ROW !== stmt.step())
          throw new IModelError(IModelStatus.NotFound, "LinkTableRelationship not found", Logger.logWarning, loggingCategory);
        return stmt.getRow() as LinkTableRelationshipProps;
      });
    }
github imodeljs / imodeljs / core / backend / src / Relationship.ts View on Github external
props = this._iModel.withPreparedStatement("SELECT * FROM " + relClassSqlName + " WHERE SourceECInstanceId=? AND TargetECInstanceId=?", (stmt: ECSqlStatement) => {
        stmt.bindId(1, criteria.sourceId);
        stmt.bindId(2, criteria.targetId);
        if (DbResult.BE_SQLITE_ROW !== stmt.step())
          throw new IModelError(IModelStatus.NotFound, "Relationship not found", Logger.logWarning, loggerCategory);
        return stmt.getRow() as T;
      });
    }
github imodeljs / imodeljs / presentation / backend / src / PresentationManager.ts View on Github external
imodel.withPreparedStatement(query, (stmt) => {
      stmt.bindId(1, id);
      if (stmt.step() === DbResult.BE_SQLITE_ROW)
        key = { className: stmt.getValue(0).getClassNameForClassId().replace(".", ":"), id };
    });
    return key;