private static function get_columns( $table ) {
		global $wpdb;

		$table_sql       = self::esc_sql_ident( $table );
		$primary_keys    = array();
		$text_columns    = array();
		$all_columns     = array();
		$suppress_errors = $wpdb->suppress_errors();

		// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Escaped through esc_sql_ident/esc_like.
		$results = $wpdb->get_results( "DESCRIBE $table_sql" );
		if ( $results ) {
			foreach ( $results as $col ) {
				// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Property names come from database.
				if ( 'PRI' === $col->Key ) {
					$primary_keys[] = $col->Field;
				}
				if ( self::is_text_col( $col->Type ) ) {
					$text_columns[] = $col->Field;
				}
				$all_columns[] = $col->Field;
				// phpcs:enable
			}
		}
		$wpdb->suppress_errors( $suppress_errors );
		return array( $primary_keys, $text_columns, $all_columns );
	}
private static function get_columns( $table ) {
		global $wpdb;

		$table_sql       = self::esc_sql_ident( $table );
		$primary_keys    = array();
		$text_columns    = array();
		$all_columns     = array();
		$suppress_errors = $wpdb->suppress_errors();

		// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Escaped through esc_sql_ident/esc_like.
		$results = $wpdb->get_results( "DESCRIBE $table_sql" );
		if ( $results ) {
			foreach ( $results as $col ) {
				// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Property names come from database.
				if ( 'PRI' === $col->Key ) {
					$primary_keys[] = $col->Field;
				}
				if ( self::is_text_col( $col->Type ) ) {
					$text_columns[] = $col->Field;
				}
				$all_columns[] = $col->Field;
				// phpcs:enable
			}
		}
		$wpdb->suppress_errors( $suppress_errors );
		return array( $primary_keys, $text_columns, $all_columns );
	}
private static function get_columns ( $ table ) { global $ wpdb ; $ table_sql = self :: esc_sql_ident ( $ table ) ; $ primary_keys = array ( ) ; $ text_columns = array ( ) ; $ all_columns = array ( ) ; $ suppress_errors = $ wpdb -> suppress_errors ( ) ; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Escaped through esc_sql_ident/esc_like. $ results = $ wpdb -> get_results ( "DESCRIBE $table_sql" ) ; if ( $ results ) { foreach ( $ results as $ col ) { // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Property names come from database. if ( 'PRI' === $ col -> Key ) { $ primary_keys [ ] = $ col -> Field ; } if ( self :: is_text_col ( $ col -> Type ) ) { $ text_columns [ ] = $ col -> Field ; } $ all_columns [ ] = $ col -> Field ; // phpcs:enable } } $ wpdb -> suppress_errors ( $ suppress_errors ) ; return array ( $ primary_keys , $ text_columns , $ all_columns ) ; }
Gets the column names of a db table differentiated into key columns and text columns and all columns.

@param string $table The table name.
@return array A 3 element array consisting of an array of primary key column names, an array of text column names, and an array containing all column names.
Gets the column names of a db table differentiated into key columns and text columns and all columns .