Commit Graph

62 Commits

Author SHA1 Message Date
Kamil Tekiela
47a039d70c Implement ResultInterface & MysqliResult
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-31 23:59:24 +00:00
Kamil Tekiela
945d887a10 Fix var annotation for Charset and Collation
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-09 22:25:58 +00:00
Kamil Tekiela
56a832948c
Refactor DatabaseInterface.php (#17209)
* Use str_starts_with()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant !empty()

!empty() on a declared variable is redundant.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Replace loop with array_column()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Simpify assignment by removing temporary variable

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant if statements and array_merge

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove temporary variable

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Unindent code

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Add helper method fetchByMode()

This is done to avoid calling methods through variables. It is the same
in terms of performance.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Move if statements to where they are relevant

I had a choice to either move the while loop out of the if statements
or move the if statements inside. I decided it made more sense to move
them inside.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Add NULL to phpdoc for the two parameters that can be null

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Simplify return statement

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Improve performance and simplify code

Since we are always using STORE mode then we can use data_seek() method.
This will allow us to get rid of the loop and use fetchByMode() method.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Inline value defaulting

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant check

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* [bugfix] getColumnNames() should return an array of strings

There were multiple issues here. If we are selecting only a certain
column from the SQL then let's use the handy function instead of
array_keys. We will never get anything other than an array so checking
if it is not an array makes no sense. Returning null only to cast it to
an array is pointless. If really necessary, we could still check for an
empty array. The ColumnController returned the value without even
casting it to an array. I am not sure how jQuery/JavaScript dealt with it.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getColumnMapFromSql and add type hint

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getVirtualTables

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant loop

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant usage of freeResult()

If there was no chance for the object to leak the scope and it is the
end of the scope then there's no reason to call this method.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Replace dynamic variable with declare one

It's always the same name. If we were creating more than one, we could
use associative array, but in this case there seems to be absolutely no
need for any of this. Dynamic variables make it harder to debug the code.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update psalm-baseline.xml

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Widen the condition per williamdes suggestion

This will allow value such as '' and '0' to pass through. Previously
`if(! empty($database))` and `if($database)` dissallowed them.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* fetchResult() should return only arrays

Tests fixed to return arrays. Non-empty in case of true, empty in case
of false.
Fixed a lot of Psalm issues where the condition was always true.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-11-26 20:17:46 -03:00
Maurício Meneghini Fauth
3e0856c77b
Remove useless string concatenations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-27 21:40:22 -03:00
Maurício Meneghini Fauth
4834c5fe7d
Remove bypass flag from Util::backquote method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-26 11:51:34 -03:00
Maurício Meneghini Fauth
f00d70cccb
Remove useless whitespaces
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-15 17:05:40 -03:00
Maurício Meneghini Fauth
7f6472b2c2
Add void return type where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-13 15:29:11 -03:00
Maurício Meneghini Fauth
2de0a7cbd7
Update Psalm baseline
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-28 12:11:52 -03:00
William Desportes
f77433b9b7
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-28 01:37:17 +02:00
William Desportes
42165e4953
Fix #15370 - Edit routine UI incorrectly removes too many escape slashes
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-27 23:12:04 +02:00
William Desportes
587536b766
Remove non used variables
Running: composer run psalm -- --alter --issues=UnusedVariable
And removing the false positives I reported upstream

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-16 02:13:27 +02:00
S. B. Hunter
a0410aa77d
Replace REQUEST to POST in Routines.php (#16904)
Signed-off-by: Akihiro Asahara <akihiro.asahara@gmail.com>

Co-authored-by: Akihiro Asahara <akihiro.asahara@gmail.com>
2021-07-14 14:24:08 -03:00
Maurício Meneghini Fauth
1835ebb4fc
Replace mb_strpos !== false with str_contains
See: https://wiki.php.net/rfc/str_contains#case-insensitivity_and_multibyte_strings

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-10 13:43:40 -03:00
Maurício Meneghini Fauth
9adaa912e1
Rename Response class to ResponseRenderer
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-30 12:35:22 -03:00
Maurício Meneghini Fauth
1c084de30b
Fix coding standard errors
Related to 62f142c9fa.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-03 16:50:33 -03:00
Maurício Meneghini Fauth
e376c4189b
Remove the .pma-fieldset from some pages
Replaces with Bootstrap's cards

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-27 18:18:23 -03:00
Maurício Meneghini Fauth
95fdd35e2f
Remove the .pma-table CSS class
Replaces with equivalent Bootstrap classes.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-15 17:16:22 -03:00
Maurício Meneghini Fauth
8d0c2a339c
Move both operands of an assignment to the same line
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-04-20 22:35:21 -03:00
William Desportes
993a6aa8a0
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-03-23 01:13:58 +01:00
William Desportes
2885bbca99
Fix #14430 - Execute button is disabled for routines
Allow the procedure definer to the procedure

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-03-23 00:29:00 +01:00
William Desportes
157be3004d
Do not query twice to ask about "CREATE ROUTINE" privs
They do not change between calls, store the value then.

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-03-23 00:05:03 +01:00
Brittany Barnes
dc1be997c9
Converted getExecuteform to utilize twig template (#16712)
Signed-off-by: Britt Barnes <britbarnes92@gmail.com>
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Co-authored-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-19 15:23:27 -03:00
Maurício Meneghini Fauth
d83abf63e7
Use PSR-12 for control structures spacing
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-05 15:27:03 -03:00
Maurício Meneghini Fauth
0b8edc5bde
Use PSR-12 for namespace use statements
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-05 14:18:35 -03:00
William Desportes
1ac9a165e0
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-02-25 18:44:47 +01:00
William Desportes
c5155ecae9
Refactor field flags to use an object an not strpos
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-02-24 23:56:33 +01:00
Saksham Gupta
6f64a08906 Fix 13325 : Created procedure shows up in triggers and events and vice versa
Signed-off-by: Saksham Gupta <shucon01@gmail.com>

Remove console.log

Signed-off-by: Saksham Gupta <shucon01@gmail.com>

Change variable name tableType

Signed-off-by: Saksham Gupta <shucon01@gmail.com>
2021-02-17 13:56:01 +05:30
William Desportes
54f09a8e9c
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-02-05 01:51:54 +01:00
William Desportes
2cac456ce2
Fix code comment typos
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-02-05 01:03:28 +01:00
Maurício Meneghini Fauth
65ca0c1b2c
Extract HTML from Database\Routines::getEditorForm method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-01-08 17:49:22 -03:00
Maurício Meneghini Fauth
5178f76f95
Move fieldset CSS style to the .pma-fieldset class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-12-28 19:46:40 -03:00
Maurício Meneghini Fauth
ac4bfaebe7
Remove some custom CSS utilities
Uses Bootstrap equivalents.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-12-26 20:05:03 -03:00
Maurício Meneghini Fauth
5bad0f74af
Use Bootstrap's table for db routines page
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-30 23:04:48 -03:00
Maurício Meneghini Fauth
d23be36126
Fix some errors found by PHPStan and Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-26 15:20:44 -03:00
Maurício Meneghini Fauth
c64b77abe1
Move HTML's table CSS to the pma-table class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-16 16:36:16 -03:00
Maurício Meneghini Fauth
a83ec78ebf Make DatabaseInterface::isUserType method private
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-24 00:40:03 -03:00
Maurício Meneghini Fauth
c447bac98d Move Routines::main to the controller
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-02 23:13:31 -03:00
Rajat Jain
13aae49714 Added search in Routines.
Signed-off-by: Rajat Jain <rajatjain.ix@gmail.com>
2020-09-24 22:13:24 +05:30
Maurício Meneghini Fauth
ceac762e09 Remove pmaThemePath and pmaThemeImage PHP globals
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-09-02 10:57:57 -03:00
Maurício Meneghini Fauth
3f01cd8c13 Remove Message::display method
Related to https://github.com/phpmyadmin/phpmyadmin/issues/16258.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-07-20 19:43:46 -03:00
Maurício Meneghini Fauth
3b285ff17e Use identical operator for non-empty strings
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-07-10 18:06:29 -03:00
Maurício Meneghini Fauth
e81146e4b3 Remove useless return annotations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-07-07 10:30:27 -03:00
Maurício Meneghini Fauth
58eee2e371 Use early exit when possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-27 21:46:12 -03:00
Maurício Meneghini Fauth
f4582e083e Use early exit when possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-27 00:35:24 -03:00
Maurício Meneghini Fauth
82c2964bb8 Remove useless elses
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-26 22:27:45 -03:00
Maurício Meneghini Fauth
3baad2eb1c Fix some coding standard issues
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-25 22:42:37 -03:00
Maurício Meneghini Fauth
9269d75fb4 Fix some coding standard issues
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-25 20:22:18 -03:00
Maurício Meneghini Fauth
80a45fa0ae Break too long lines
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-16 18:08:20 -03:00
William Desportes
1cc7f78012
Split part of the logic of getQueryFromRequest into processFunctionSpecificParameters
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-16 14:39:00 +02:00
William Desportes
f2d349df40
Split part of the logic of getQueryFromRequest into processParamsAndBuild
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-16 14:06:36 +02:00