[phpMyAdmin Developers] phpmyadmin database update

Isaac Bennetch bennetch at gmail.com
Tue Jul 18 00:27:57 CEST 2017


Hello,

On 7/17/17 12:22 PM, Manish Bisht wrote:
> I found three ways to execute the query. What is the difference between
> these.
>
> $GLOBALS['dbi']->query($sql_query);
>
> $GLOBALS['dbi']->tryQuery($sql_query);
>
> PMA_queryAsControlUser($sql_query);
>
>
> What is the difference between these. What I know is query() returns
> error and tryQuery() doesn't returns error.

Michal has already answered most of this, but query() calls tryQuery()
and if it fails, it die()s. queryAsControlUser() specifically runs as
the controluser[1][2] so that's what we'd want here.

You can see this in DatabaseInterface.php[3]

1 -
https://docs.phpmyadmin.net/en/latest/setup.html#phpmyadmin-configuration-storage
2 -
https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_controluser
3 -
https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/classes/DatabaseInterface.php#L140-146

On 7/17/17 2:20 PM, Manish Bisht wrote:
> I have checked other ajax requests and found that some extra parameter
>
> server : PMA_commonParams.get('server'),
> db : PMA_commonParams.get('db'),
> table : PMA_commonParams.get('table'),
>
> are passed in the ajax request. What is the need of this so that I can
> check if these are required in my case.

I'm pretty confident that these are used to tell phpMyAdmin which
server, database, and table are currently active. For instance, after
copying a table to a new database, the user may wish to switch to the
newly copied one instead of staying on the same page; these functions
facilitate that change.

> Then this is not required in my case and I can simply ignore these.

Sure, that sounds correct.

I think all of your other questions have been answered by the others, so
let me know of course if there's anything I missed.

Isaac



More information about the Developers mailing list