Populate database with a data set.
@param callInfo Call Info.
@param data Data Set.
542830
static void populate(CallInfo callInfo, DataSet data) {
    Table table = asTable(data.getSource());
    table.setDirtyStatus(true);
    doPopulate(callInfo, table, data);

  }
1191735
static void stateAssertion(CallInfo callInfo, DataSet expected) {
    DataSource source =  expected.getSource();
    source.setDirtyStatus(true);
    dataSetAssertion(callInfo, 
                     expected,   
                     source.executeQuery(callInfo, false));
  }
1617
void setData(Map<String, Object> data) {
        Objects.requireNonNull(data, "data can't be null");

        // @adovbnya DO NOT CHANGE !!!!
        // allow tenant change only from initial (empty) value or only from super tenant
        if (this.dataMap.isEmpty()) {
            this.dataMap = ValueHolder.valueOf(data);
        } else if (!Objects.equals(this.dataMap.get(), data)) {
            if (!this.tenant.isPresent()) {
                throw new IllegalStateException("Tenant doesn't set in context yet");
            }

            if (this.tenant.get().isSuper()) {
                this.dataMap = ValueHolder.valueOf(data);
            } else {

                StackTraceElement[] traces = Thread.currentThread().getStackTrace();
                if (!isAllowedToChangeTenant(traces)) {
                    throw new IllegalStateException("Trying to set the data from " + this.dataMap.get()
                                                        + " to " + data);
                }
            }
        }
    }
446651
@Override
  public void initialize() {
    if(databaseConnection == null) {
      return; // Supposedly we initialized already.
    }
    if(LOG.isDebugging()) {
      LOG.debugFine("Loading data from database connection.");
    }
    MultipleObjectsBundle bundle = databaseConnection.loadData();
    // Run at most once.
    databaseConnection = null;

    // Find DBIDs for bundle
    {
      DBIDs bids = bundle.getDBIDs();
      if(bids instanceof ArrayStaticDBIDs) {
        this.ids = (ArrayStaticDBIDs) bids;
      }
      else if(bids == null) {
        this.ids = DBIDUtil.generateStaticDBIDRange(bundle.dataLength());
      }
      else {
        this.ids = (ArrayStaticDBIDs) DBIDUtil.makeUnmodifiable(DBIDUtil.ensureArray(bids));
      }
    }
    // Replace id representation (it would be nicer if we would not need
    // DBIDView at all)
    this.idrep = new DBIDView(this.ids);
    relations.add(this.idrep);
    getHierarchy().add(this, idrep);

    DBIDArrayIter it = this.ids.iter();

    int numrel = bundle.metaLength();
    for(int i = 0; i < numrel; i++) {
      SimpleTypeInformation<?> meta = bundle.meta(i);
      @SuppressWarnings("unchecked")
      SimpleTypeInformation<Object> ometa = (SimpleTypeInformation<Object>) meta;
      WritableDataStore<Object> store = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_DB, ometa.getRestrictionClass());
      for(it.seek(0); it.valid(); it.advance()) {
        store.put(it, bundle.data(it.getOffset(), i));
      }
      Relation<?> relation = new MaterializedRelation<>(ometa, ids, null, store);
      relations.add(relation);
      getHierarchy().add(this, relation);

      // Try to add indexes where appropriate
      for(IndexFactory<?> factory : indexFactories) {
        if(factory.getInputTypeRestriction().isAssignableFromType(ometa)) {
          @SuppressWarnings("unchecked")
          final IndexFactory<Object> ofact = (IndexFactory<Object>) factory;
          @SuppressWarnings("unchecked")
          final Relation<Object> orep = (Relation<Object>) relation;
          final Index index = ofact.instantiate(orep);
          Duration duration = LOG.isStatistics() ? LOG.newDuration(index.getClass().getName() + ".construction").begin() : null;
          index.initialize();
          if(duration != null) {
            LOG.statistics(duration.end());
          }
          getHierarchy().add(relation, index);
        }
      }
    }

    // fire insertion event
    eventManager.fireObjectsInserted(ids);
  }
135188
static void insert(CallInfo callInfo, DataSet data) {
    Table table = asTable(data.getSource());
    if (data.isEmpty()) {
      throw new InvalidOperationException("Empty data set.");
    }
    table.setDirtyStatus(true);
    doInsert(callInfo, table, data);
  }
1109889
@Override
    public void setDataset(Instances dataset) {
        if(dataset instanceof InstancesHeader) {
            this.instanceHeader = (InstancesHeader) dataset;
        }else {
            this.instanceHeader = new InstancesHeader(dataset);
        }
    }
1038313
public final void setDatas(@NonNull Iterable<? extends Data<?>> datas) {
        checkNotNull(datas, "datas");
        mDataWatcher.setDatas(datas);
        mDatas.clear();
        for (Data<?> data : datas) {
            mDatas.add(data);
        }
        // Clear error message, because the caller expects the view state to be reset when all datas change
        if (mDatas.isEmpty()) {
            mErrorMessage = null;
        }
        updateViews();
    }
299542
public void setDataSet(PagedDataSet dataSet) {
        /* todo: would be nice to address this side-effect outside of the setter */
        _dataSet = dataSet;
        _dataGridState.getPagerModel().setDataSetSize(_dataSet.getSize());
    }
528271
public static void dump(DataSet data, File outputFile) {
    try (Log log = Log.create(outputFile)) {
      log.write(CallInfo.create(), data);
    } 
  }
121798
static int execute(CallInfo callInfo, DB db, String sql, Object[] args) {
    return db.access(callInfo, () -> {
      db.logSetup(callInfo, sql);
      try (WrappedStatement ws = db.compile(sql)) {
        PreparedStatement stmt = ws.getStatement();
        if (args != null && args.length != 0) {
          for (int i=0; i < args.length; i++) {
            stmt.setObject(i + 1, args[i]);
          }
        }
        stmt.execute();
        return stmt.getUpdateCount();
      }
    });
  }
1148760
public static void sqldatabase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
    zeroArgumentFunctionCall(buf, "current_database()", "database", parsedArgs);
  }
928583
public function populate($data = array())
    {
        if (isset($data['name']) && $data['name'] !== null) {
            $this->name = $data['name'];
        }
        if (isset($data['locale']) && $data['locale'] !== null) {
            $this->locale = $data['locale'];
        }
    }
1070205
@Override
    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
680645
public static CallableStatement prepareCall(Connection conn, String sql, Object... params) throws SQLException {
		Assert.notBlank(sql, "Sql String must be not blank!");

		sql = sql.trim();
		SqlLog.INSTASNCE.log(sql, params);
		final CallableStatement call = conn.prepareCall(sql);
		fillParams(call, params);
		return call;
	}
764893
void write(CallInfo callInfo, SQLException e) {
    Element rootNode = root(callInfo);
    Element exNode = createNode(rootNode, DATABASE_EXCEPTION_TAG);
    StringWriter sw = new StringWriter();
    sw.append('\n');
    e.printStackTrace(new PrintWriter(sw));
    exNode.appendChild(xmlDoc.createCDATASection(sw.toString()));
    flush(rootNode);
  }
58747
public void setData (Collection<?> data)
    {
        _data.clear();
        _data.addAll(data);
        _model.fireTableDataChanged();
    }
935302
public void setData(@Nullable T data) {
        Preconditions.checkState(mGroupBasicAdapter != null, "Must call bindView() first");

        List<Card> cards = mDataParser.parseGroup(data, this);
        this.setData(cards);
    }