Check if config table already exists

@param con
548937
protected boolean isDbInitialized(final Connection con)
   {
      return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
      {

         public Boolean run()
         {
            return JDBCUtils.tableExists(configTableName, con);
         }
      });
   }
1101518
@SafeVarargs
  public static void assertTableExists(DB db, String... tableNames) throws DBAssertionError {
    multipleTableExistenceAssertions(CallInfo.create(), db, tableNames, true);
  }
1286784
public static boolean columnExist(CSTable table, String name) {
        for (int i = 1; i <= table.getColumnCount(); i++) {
            if (table.getColumnName(i).startsWith(name)) {
                return true;
            }
        }
        return false;
    }
669888
protected function _hasJoin_sql($key, $table, $cond, &$filter, &$options) {
		$relConf = $this->fieldConf[$key]['belongs-to-one'];
		$relModel = is_array($relConf)?$relConf[0]:$relConf;
		$rel = $this->getRelInstance($relModel,null,$key);
		$fkey = is_array($this->fieldConf[$key]['belongs-to-one']) ?
			$this->fieldConf[$key]['belongs-to-one'][1] : $rel->primary;
		$alias = $table.'__'.$key;
		$query = $this->_sql_left_join($key,$this->table,$fkey,[$table,$alias]);
		$this->_sql_mergeRelCondition($cond,$alias,$filter,$options);
		return $query;
	}
80683
function (config) {
        // at this stage, the `db` variable should not exist. expecting fresh setup or post teardown setup.
        if (Transaction.databases[config.identity]) {
            // @todo - emit wrror event instead of console.log
            console.log('Warn: duplicate setup of connection found in Transactions.setup');
            this.teardown();
        }

        var _db;

        // clone the configuration
        config = util.clone(config);
        delete config.replication;

        // allow special transaction related config
        util.each(config, function (value, name, config) {
            if (!/^transaction.+/g.test(name)) { return; }

            // remove transaction config prefix
            var baseName = name.replace(/^transaction/g, '');
            baseName = baseName.charAt(0).toLowerCase() + baseName.slice(1);

            delete config[name];
            config[baseName] = value;
        });

        _db = db.createSource(config);

        // Save a few configurations
        _db && (_db.transactionConfig = {
            rollbackOnError: config.rollbackTransactionOnError
        });

        Transaction.databases[config.identity] = _db;
    }
1172065
private function checkIfTableExist()
    {
        $sql = new SqlCommand();
        $sql->exeCommand("SHOW TABLES LIKE '" . PRE . $this->entity . "'");
        if (!$sql->getResult())
            new \EntityForm\EntityCreateEntityDatabase($this->entity, []);
    }
1370587
public function tableExists($tableName) {
        $tables = $this->query("SHOW TABLES");
        foreach ($tables as $k => $table) {
            $key = 'Tables_in_' . $this->config['table'];
            if (strtolower($table[$key]) == strtolower($this->getPrefix() . $tableName)) {
                return TRUE;
            }
        }
        return FALSE;
    }
1371702
public function hasPrevSibling(ConnectionInterface $con = null)
    {
        if (!ChildCategoryQuery::isValid($this)) {
            return false;
        }

        return ChildCategoryQuery::create()
            ->filterByTreeRight($this->getLeftValue() - 1)
            ->exists($con);
    }
518454
private static boolean tableExists(CallInfo callInfo, DB db, String tableName) {
    return db.access(callInfo, () -> { 
      DatabaseMetaData dbmd = db.getConnection().getMetaData();
      try(ResultSet rs = dbmd.getTables(null, null, null, new String[] {"TABLE"})) {
        while(rs.next()) { 
          if (tableName.equalsIgnoreCase(rs.getString("TABLE_NAME"))) {
            return true;
          }
        }
      }
      return false;
    });
  }
98019
public boolean containsColumn(final String tableName, final String column) {
        return containsTable(tableName) && tables.get(tableName).getColumns().keySet().contains(column.toLowerCase());
    }
829923
protected void addUUIDColumnToTable(CmsSetupDb dbCon, String tablename, String column) throws SQLException {

        System.out.println(new Exception().getStackTrace()[0].toString());
        if (!dbCon.hasTableOrColumn(tablename, column)) {
            String query = readQuery(QUERY_ADD_TEMP_UUID_COLUMN); // Get the query
            // if the table is not one of the ONLINE or OFFLINE resources add the new column in the first position
            if (!RESOURCES_TABLES_LIST.contains(tablename)) {
                query += " FIRST";
            }
            Map<String, String> replacer = new HashMap<String, String>(); // Build the replacements
            replacer.put(REPLACEMENT_TABLENAME, tablename);
            replacer.put(REPLACEMENT_COLUMN, column);
            dbCon.updateSqlStatement(query, replacer, null); // execute the query
        } else {
            System.out.println("column " + column + " in table " + tablename + " already exists");
        }
    }
979958
public static boolean createTableIfNotExists(final Connection conn, final String tableName, final String schema) {
        if (doesTableExist(conn, tableName)) {
            return false;
        }

        try {
            execute(conn, schema);

            return true;
        } catch (SQLException e) {
            return false;
        }
    }
529387
protected boolean isConfigTrue(IConfigKey key) {
        String value = getConfig(key);
        if (value == null) {
            return false;
        }
        value = value.toLowerCase();
        return TRUE.equals(value);
    }
844060
public static function has($key, $config = null)
    {
        $config = ($config === null) ? self::$config : $config;

        if (!isset($config[$key]) && !array_key_exists($key, $config)) {
            return false;
        }

        return true;
    }
182136
public function createTable($tableName, $tableConfig = null)
    {
        if ($this->hasTable($tableName)) {
            throw new RuntimeException("Table with name {$tableName} is exist. Use rewriteTable()");
        }

        return $this->create($tableName, $tableConfig);
    }
469365
public function exists(ConnectionInterface $con = null)
    {
        if (null === $con) {
            $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
        }

        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $criteria->setDbName($this->getDbName()); // Set the correct dbName
        $criteria->clearOrderByColumns(); // ORDER BY will do nothing but slow down the query
        $criteria->clearSelectColumns(); // We are not retrieving data
        $criteria->addSelectColumn('1');
        $criteria->limit(1);

        // We need to set the primary table name, since in the case that there are no WHERE columns
        // it will be impossible for the createSelectSql() method to determine which
        // tables go into the FROM clause.
        $criteria->setPrimaryTableName(constant($this->modelTableMapName . '::TABLE_NAME'));

        $dataFetcher = $criteria->doSelect($con);
        $exists = (boolean) $dataFetcher->fetchColumn(0);
        $dataFetcher->close();

        return $exists;
    }
635557
@Override
    protected void validate(List<TableInfo> tableInfos)
    {
        try
        {
            if (isNamespaceAvailable(databaseName))
            {
                for (TableInfo tableInfo : tableInfos)
                {
                    if (tableInfo != null)
                    {
                        HTableDescriptor hTableDescriptor = admin.getTableDescriptor((databaseName + ":" + tableInfo
                                .getTableName()).getBytes());
                        boolean columnFamilyFound = false;
                        Boolean f = false;
                        for (HColumnDescriptor columnDescriptor : hTableDescriptor.getColumnFamilies())
                        {

                            if (!columnFamilyFound
                                    && columnDescriptor.getNameAsString().equalsIgnoreCase(tableInfo.getTableName()))
                            {
                                columnFamilyFound = true;
                            }

                            for (CollectionColumnInfo cci : tableInfo.getCollectionColumnMetadatas())
                            {
                                if (columnDescriptor.getNameAsString().equalsIgnoreCase(cci.getCollectionColumnName()))
                                {
                                    f = true;
                                    break;
                                }

                            }
                            if (!(columnFamilyFound || f))
                            {
                                throw new SchemaGenerationException("column " + tableInfo.getTableName()
                                        + " does not exist in table " + databaseName + "", "Hbase", databaseName,
                                        tableInfo.getTableName());
                            }
                            // TODO make a check for sec table
                        }

                    }
                }
            }
            else
            {
                throw new SchemaGenerationException("Namespace" + databaseName + "does not exist", "HBase",
                        databaseName);
            }

        }
        catch (TableNotFoundException tnfex)
        {
            throw new SchemaGenerationException("table " + databaseName + " does not exist ", tnfex, "Hbase");
        }
        catch (IOException ioe)
        {
            logger.error("Either check for network connection or table isn't in enabled state, Caused by:", ioe);
            throw new SchemaGenerationException(ioe, "Hbase");
        }
    }