Jump to content

\IPS\Helpers\Table\Db select specific columns


newbie LAC

Recommended Posts

Hello,

I use \IPS\Helpers\Table\Db. Don't tell me use \IPS\Helpers\Table\Custom

I only need specific columns

In that class you have

( \count( $selects ) ) ? $this->table . '.*, ' . implode( ', ', $selects ) : '*'

Could you add new property and change above code?

For example

	/**
	 * @brief	Select only specific columns
	 */
	public $selectColumns = NULL;

and

$this->selectColumns ?? ( ( \count( $selects ) ) ? $this->table . '.*, ' . implode( ', ', $selects ) : '*' )

 

 

Link to comment
Share on other sites

5 minutes ago, Daniel F said:

but we have already the include property there, which could probably be used here, without introducing a new property for this.

include works with results

I have several resources where I added new elements (which are not tables columns) to results array

You also have 

For example member devices

		$table = new \IPS\Helpers\Table\Db( 'core_members_known_devices', \IPS\Http\Url::internal("app=core&module=members&controller=devices&do=member&id={$member->member_id}"), array( 'member_id=?', $member->member_id ) );
		$table->langPrefix = 'device_table_';
		$table->include = array( 'user_agent', 'login_key', 'login_handler', 'last_seen', 'other_members' );

other_members not table column

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...