Runs checks over the database settings before building a {@link CroquetWicket} instance.
518409
protected void checkDbSettings() {
        final DatabaseSettings db = settings.getDatabaseSettings();

        if(db == null) {
            throw new RuntimeException("You must specify db settings." +
                    " If you don't need a database, simply leave the section blank.");
        }

        // CHECKSTYLE:OFF conditional complexity too large
        if(db.getPersistenceUnit() != null &&
          (db.getDriver() != null ||
           db.getDialectClass() != null ||
           db.getJdbcUrl() != null ||
           db.getUser() != null ||
           db.getPass() != null)) {
        // CHECKSTYLE:ON
            throw new IllegalStateException("Cannot set persist-unit with any other database settings");
        }
    }
855522
@Override
	public void visit(SQLiteModelMethod value) throws Exception {
		if (value.getAnnotation(BindSqlInsert.class) != null) {
			SqlInsertBuilder.generate(builder, value);
		} else if (value.getAnnotation(BindSqlUpdate.class) != null) {
			SqlModifyBuilder.generate(builder, value);
		} else if (value.getAnnotation(BindSqlDelete.class) != null) {
			SqlModifyBuilder.generate(builder, value);
		} else if (value.getAnnotation(BindSqlSelect.class) != null) {
			SqlSelectBuilder.generateSelect(builder, value);
		} 
		// other situation are blocked first

	}
1176576
public void executeStatements(String... statements) throws SQLException {
    Preconditions.checkNotNull(this.conn, "The Hive connection must be set before any queries can be run");

    for (String statement : statements) {
      if (isSimulate) {
        LOG.info("[SIMULATE MODE] STATEMENT NOT RUN: " + choppedStatementNoLineChange(statement));
      } else {
        LOG.info("RUNNING STATEMENT: " + choppedStatementNoLineChange(statement));
        try (Statement stmt = this.conn.createStatement()) {
          try {
            stmt.execute(statement);
          } catch (SQLException sqe) {
            LOG.error("Failed statement: " + choppedStatementNoLineChange(statement));
            throw sqe;
          }
        }
      }
    }
  }
907666
public boolean beforeUpdate(List<Object> tList, String setSql, List<Object> setSqlArgs) {
    	return true;
    }
1348632
public function performCheck()
    {
        if ($this->installerOptions->isAutoAttachEnabled() === false) {
            try {
                $existingTables = [];
                foreach ($this->connection->fetchAll('show tables') as $row) {
                    $existingTables[] = array_shift($row);
                }
                $numExistingTables = count($existingTables);
                if ($numExistingTables > 0) {
                    $result = new PreconditionResult(
                        PreconditionResult::STATE_FAILED,
                        t2(
                            'There is already %s table in this database. concrete5 must be installed in an empty database.',
                            'There are already %s tables in this database. concrete5 must be installed in an empty database.',
                            $numExistingTables
                        )
                    );
                } else {
                    $result = new PreconditionResult(PreconditionResult::STATE_PASSED);
                }
            } catch (Exception $x) {
                $result = new PreconditionResult(PreconditionResult::STATE_FAILED, $x->getMessage());
            }
        } else {
            $result = new PreconditionResult(PreconditionResult::STATE_SKIPPED, t('The configuration is auto-attached'));
        }

        return $result;
    }
1342816
void initialize() {
        Preconditions.checkState(this.database.get() == null, "%s has already been initialized.", this.logId);

        try {
            clear(true);
            this.database.set(openDatabase());
        } catch (Exception ex) {
            // Make sure we cleanup anything we may have created in case of failure.
            try {
                close();
            } catch (Exception closeEx) {
                ex.addSuppressed(closeEx);
            }

            throw ex;
        }

        log.info("{}: Initialized.", this.logId);
    }
425765
protected void doPrepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector
      collector, Collection<Event<Tuple>> queue) {
    Objects.requireNonNull(topoConf);
    Objects.requireNonNull(context);
    Objects.requireNonNull(collector);
    Objects.requireNonNull(queue);
    this.windowedOutputCollector = new WindowedOutputCollector(collector);
    bolt.prepare(topoConf, context, windowedOutputCollector);
    this.listener = newWindowLifecycleListener();
    this.windowManager = initWindowManager(listener, topoConf, context, queue);
    start();
    LOG.info(String.format("Initialized window manager %s", windowManager));
  }
822455
protected function beforeAjax()
    {
        if ($this->initialized) {
            return;
        }

        $this->controller->pageAction();
        $this->validateField();
        $this->prepareVars();
        $this->initialized = true;
    }
162839
function(setting) {
		var o = setting.treeObj,
		c = consts.event;
		o.bind(c.CHECK, function (event, srcEvent, treeId, node) {
			event.srcEvent = srcEvent;
			tools.apply(setting.callback.onCheck, [event, treeId, node]);
		});
	}
250711
private void doGetDatasourceSetting() throws PageException {
	Struct sct = new StructImpl();
	pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
	sct.set("psq", Caster.toBoolean(config.getPSQL()));
    }
414993
private function initSql()
    {
        $this->sql['start'] = null;
        $this->sql['join'] = '';
        $this->sql['where'] = '';
        $this->sql['orderby'] = null;
        $this->sql['limit'] = null;
        $this->sql['offset'] = null;
    }
495287
protected function _setupBeforeCalls()
	{
		//  API rate limit check before call is made
		$this->beforeCall[] = function () {
			if ($this->getSetting(self::SET_CACHE_RATELIMIT) && $this->rlc != false)
				if ($this->rlc->canCall($this->getSetting($this->used_key), $this->getSetting(self::SET_REGION), $this->getResource(), $this->getResourceEndpoint()) == false)
					throw new ServerLimitException('API call rate limit would be exceeded by this call.');
		};

		$callbacks = $this->getSetting(self::SET_CALLBACKS_BEFORE, []);
		if (is_array($callbacks) == false)
			$callbacks = [$callbacks];

		foreach ($callbacks as $c)
		{
			if (is_callable($c) == false)
				throw new SettingsException("Provided value of '" . self::SET_CALLBACKS_BEFORE . "' option is not valid.");

			$this->beforeCall[] = $c;
		}
	}
708577
public function verifySettings()
    {
        // Creation is done here rather than in isSelected() because some
        // containers may do a validation pass before running isSelected(),
        // but we need to check for the existence of the created class.
        if ($this->dynselector === null) {
            $this->selectorCreate();
        }

        if (empty($this->classname)) {
            $this->setError("The classname attribute is required");
        } elseif ($this->dynselector === null) {
            $this->setError("Internal Error: The custom selector was not created");
        } elseif (!($this->dynselector instanceof ExtendFileSelector) && (count($this->parameters) > 0)) {
            $this->setError(
                "Cannot set parameters on custom selector that does not "
                . "implement ExtendFileSelector."
            );
        }
    }
161654
public function init()
    {

        // initialize the prepared statements
        $this->bundleOptionValueStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::BUNDLE_OPTION_VALUE));
    }
279428
private void setupCheckBoxes() {

        m_includeResource.setValue(new Boolean(true));
        m_includeUnchanged.setValue(new Boolean(true));
        m_includeSystem.setValue(new Boolean(true));
        m_recursive.setValue(new Boolean(true));
    }
646166
public void checkMandatoryProperties() throws PdbConfigurationException {
        StringBuilder exceptionMessage = new StringBuilder();
        if (StringUtils.isBlank(getJdbc())) {
            exceptionMessage.append("- A connection string should be declared under the 'database.jdbc' property.\n");
        }

        if (StringUtils.isBlank(getEngine())) {
            exceptionMessage.append("- An engine string should be declared under the 'database.engine' property.\n");
        }

        if (exceptionMessage.length() > 0) {
            throw new PdbConfigurationException("The following configuration errors were detected in the configuration file: \n"
                    + exceptionMessage.toString());
        }
    }
869581
def build_if_needed(db):
    """"""
    if len(db.engine.table_names()) == 0:
        # import all classes here
        from my_site.models.tables.user import User

        db.create_all()