Skip to content

Fix simulate query #2#18670

Merged
MauricioFauth merged 2 commits intophpmyadmin:QA_5_2from
MoonE:fix-simulate-query2
Oct 3, 2023
Merged

Fix simulate query #2#18670
MauricioFauth merged 2 commits intophpmyadmin:QA_5_2from
MoonE:fix-simulate-query2

Conversation

@MoonE
Copy link
Contributor

@MoonE MoonE commented Aug 29, 2023

Allows showing the updated values by clicking on the affected row number #18583 (comment).

  • Did not work when setting value to other column value, e.g. SET a=a+1
  • Show updated data when clicking on the affected rows number
    Now shows all table columns plus the new value as a column
  • The button now also appears when using an update statement that uses schema.table format,
    and delete statements like DELETE a FROM a ...

@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Patch coverage: 95.00% and project coverage change: -0.52% ⚠️

Comparison is base (e64f1e9) 48.47% compared to head (5d9f5c7) 47.95%.

Additional details and impacted files
@@             Coverage Diff              @@
##             QA_5_2   #18670      +/-   ##
============================================
- Coverage     48.47%   47.95%   -0.52%     
  Complexity    17012    17012              
============================================
  Files           607      607              
  Lines         72340    72334       -6     
============================================
- Hits          35065    34689     -376     
- Misses        37275    37645     +370     
Flag Coverage Δ
dbase-extension 47.96% <94.44%> (-1.18%) ⬇️
recode-extension 47.98% <94.44%> (+<0.01%) ⬆️
unit-7.2-ubuntu-latest 47.92% <94.44%> (-0.61%) ⬇️
unit-7.3-ubuntu-latest 48.39% <95.00%> (-0.76%) ⬇️
unit-7.4-ubuntu-latest 49.14% <95.00%> (-0.53%) ⬇️
unit-8.0-ubuntu-latest 48.43% <95.00%> (-0.05%) ⬇️
unit-8.1-ubuntu-latest 48.42% <95.00%> (-1.33%) ⬇️
unit-8.2-ubuntu-latest 48.44% <95.00%> (-1.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
libraries/classes/Import/SimulateDml.php 95.16% <95.00%> (-1.90%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MoonE MoonE force-pushed the fix-simulate-query2 branch from 7323c7b to 22faf9b Compare August 29, 2023 20:17
$newValues = [];
$oldValues = [];

preg_match('/^(?:`([^`]+)`\.)?`([^`]+)`$/i', $tableReferences[0], $matches);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a comment for this regex.

@MoonE MoonE marked this pull request as draft August 29, 2023 22:40
@MoonE MoonE force-pushed the fix-simulate-query2 branch from 22faf9b to c972deb Compare August 29, 2023 22:53
MoonE added 2 commits August 30, 2023 01:16
- Did not work when setting value to other column value, e.g. `SET a=a+1`
- Show updated data when clicking on the affected rows number
  Now shows all table columns plus the new value as a column

Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
The button now also appears when using an update statement that uses schema.table format,
and delete statements like `DELETE a FROM a ...`

Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
@MoonE MoonE force-pushed the fix-simulate-query2 branch from c972deb to 5d9f5c7 Compare August 29, 2023 23:16
$newValues[] = $set->value . ' AS ' . ($newColumns[] = Util::backquote('n' . $i));
++$i;
$oldColumns[] = Util::backquote($column);
$values[$column] = $set->value . ' AS ' . ($newColumns[] = Util::backquote($column . ' `new`'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is less complex compared to that, with the caveat that the old and new value columns are not next to each other and if someone has a table with column pairs named [x] and [x] `new` it breaks.

@MoonE MoonE marked this pull request as ready for review August 29, 2023 23:28
@MauricioFauth MauricioFauth merged commit d59645d into phpmyadmin:QA_5_2 Oct 3, 2023
@MauricioFauth MauricioFauth added this to the 5.2.2 milestone Oct 3, 2023
@MauricioFauth MauricioFauth self-assigned this Oct 3, 2023
@MoonE MoonE deleted the fix-simulate-query2 branch October 3, 2023 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants