Check if table exists.
@param callInfo Call info.
@param db Database.
@param tableName Table name.
@return <code>true<code> if and only if the table exists.
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;
    });
  }
1249587
public boolean createTableIfNotExists(final String tableName, final String schema) {
        Connection conn = getConnection();

        try {
            return JdbcUtil.createTableIfNotExists(conn, tableName, schema);
        } finally {
            closeQuietly(conn);
        }
    }
160114
def table_exists?(name)
      return false unless name
      schema ? @connection.table_exists?(name, schema) : @connection.table_exists?(name)
    end
263005
public boolean existsTable(String keyspace, String table, boolean showLog) {
        this.metadata = this.cluster.getMetadata();

        if (!(this.metadata.getKeyspace(keyspace).getTables().isEmpty())) {
            for (TableMetadata t : this.metadata.getKeyspace(keyspace).getTables()) {
                if (t.getName().equals(table)) {
                    return true;
                }
            }
        }
        return false;
    }
261468
public boolean renameTable(String tableName, String newTableName) throws DBException
    {
        try {
            if (DBConstants.TRUE.equals((String)this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
            if (this.getStatement(DBConstants.SQL_CREATE_TYPE) == null)
            	this.setStatement(((JdbcDatabase)this.getDatabase()).getJDBCConnection().createStatement(), DBConstants.SQL_CREATE_TYPE);

            String sql = "RENAME TABLE " + tableName + " TO " + newTableName;
            this.getStatement(DBConstants.SQL_CREATE_TYPE).execute(sql);
            
            if (DBConstants.TRUE.equals((String)this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
        } catch (SQLException e) {
            throw this.getDatabase().convertError(e);
        }
        return true;
    }
774481
public function isDbTableExists($tableName)
    {
        $status = false;
        $resultSet = array();

        $query = $this->executeRawQuery("SHOW TABLES LIKE '".trim($tableName)."';");
        if($resultSet)
            $resultSet = $query->toArray();



        if(!empty($resultSet)) {
            $status = true;

        }

        return $status;
    }
350608
@SafeVarargs
    public final boolean exists(String sql, Object... parameters) {
        final Cursor cursor = rawQuery(sql, parameters);

        try {
            return cursor.moveToNext();
        } finally {
            cursor.close();
        }
    }
357366
def column_exists(self, tablename: str, column: str) -> bool:
        """"""
        sql = """
            SELECT COUNT(*)
            FROM information_schema.columns
            WHERE table_name=?
            AND column_name=?
            AND table_schema={}
        """.format(self.get_current_schema_expr())
        row = self.fetchone(sql, tablename, column)
        return True if row[0] >= 1 else False
718481
boolean exists(final String tableName, final Object rowKey) throws UncheckedIOException {
        return exists(tableName, AnyGet.of(rowKey));
    }
651311
public static boolean tableExists(Connection connection, String tableName) throws SQLException {
        try (Statement statement = connection.createStatement()) {
            statement.execute("SELECT * FROM " + TableLocation.parse(tableName) + " LIMIT 0;");
            return true;
        } catch (SQLException ex) {
            return false;
        }
    }
817060
def exists_table(self, name, database=None):
        
        return bool(self.list_tables(like=name, database=database))
669884
public static boolean hasLevel( ASpatialDb db, int levelNum ) throws Exception {
        String tablename = TABLENAME + levelNum;
        return db.hasTable(tablename);
    }
713304
@Then("^a Cassandra keyspace '(.+?)' contains a table '(.+?)'$")
    public void assertTableExistsOnCassandraKeyspace(String keyspace, String tableName) {
        assertThat(commonspec.getCassandraClient().getTables(keyspace)).as("The table " + tableName + "exists on cassandra").contains(tableName);
    }
1194502
def tableexists(tablename):
    """"""
    result = True
    try:
        t = table(tablename, ack=False)
    except:
        result = False
    return result
1311857
def table_exists(self, table):
        
        if not self.dataset_exists(table.dataset):
            return False

        try:
            self.client.tables().get(projectId=table.project_id,
                                     datasetId=table.dataset_id,
                                     tableId=table.table_id).execute()
        except http.HttpError as ex:
            if ex.resp.status == 404:
                return False
            raise

        return True
175968
public function tableExists($tablename)
  {
    $fromdb = "";

    if ($pos = strpos($tablename, "."))
    {
      $fromdb = "from `".substr($tablename, 0, $pos)."`";
      $tablename = substr($tablename, $pos+1);
    }

    $query = "show tables $fromdb like ".$this->quote($tablename);
    $result = $this->q($query);

    $exists = mysqli_num_rows($result) != 0;
    mysqli_free_result($result);
    return $exists;
  }
943667
@Override
	public JdbcDatabaseDescriptor dbByName(final String dbName) {
		Collection<H2DatabaseWorking> select = CollectionUtils.select(dbsw, new Predicate<H2DatabaseWorking>() {

			@Override
			public boolean evaluate(H2DatabaseWorking db) {
				return dbName.equals( db.getName() );
			}

		});
		if(CollectionUtils.size(select)==0){
			throw new IllegalArgumentException("There are no databases called '" + dbName + "'");
		}
		if(CollectionUtils.size(select)>=2){
			throw new IllegalArgumentException("More than one database is called '" + dbName + "'");
		}
		return CollectionUtils.extractSingleton( select );
	}