pixie icon indicating copy to clipboard operation
pixie copied to clipboard

Return options for INSERT operations, UPDATE and DELETE

Open robertaodj opened this issue 9 years ago • 2 comments

As with the 'queries' sql return run it would be possible for INSERT, UPDATE, and DELETE operations?

$Query = QB::table('my_table')->where('city', '=', 'New York')->update(['name', 'Robert']);
$QueryObj = $query->getQuery();
$QueryObj->getRawSql();

or simply:

$Query->getSQL();

// UPDATE WHERE my_table city = 'New York' SETname = 'Robert'

It would be possible to also have the return of the number of rows affected?

$ Query->rowsAffected();

// 2

And yet the affected ID?

$Query->idAffecteds();

// 1 // [1,3] <- affected ids.

robertaodj avatar Sep 29 '16 13:09 robertaodj

yes this will be nice option

phpwebdev avatar Oct 03 '16 07:10 phpwebdev

@robertaodj take a look at the @mrcnpdlk at #151 . At least half of your problem is already fixed.

TCB13 avatar Nov 21 '17 20:11 TCB13