Last modified: 2011-11-25 07:42:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33657, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31657 - automatic table prefix on database functions
automatic table prefix on database functions
Status: NEW
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-12 22:21 UTC by Olivier Finlay Beaton
Modified: 2011-11-25 07:42 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Olivier Finlay Beaton 2011-10-12 22:21:28 UTC
Database::update and Database::select should either auto-alias table names to their non-prefix version, or add the prefix to other fields.

In the case of updates, if you put a table name in the 'vars' and 'conds' you have to prefix it yourself.

I assume the same applies to other methods and parameters.

I'm not sure, but this may be solved by say in the FROM making it do: `{$prefix}page` AS `page`.  As an example. That way people can just use the unprefixed table names everywhere, and based on the $tables parameter it assigns proper table prefixes (as it already does).
Comment 1 Olivier Finlay Beaton 2011-10-12 22:36:40 UTC
18:33 < finlay> Reedy: no I don't propose prefixes vars and conds
18:33 < finlay> Reedy: I propose to make the FROM look like in my case: FROM
                `td_page` AS `page`
18:33 < finlay> then all the other names in the vars and the WHERE and GROUP BY
                line up to the non-prefixed name
18:33 < finlay> so I can hapily use `page`. everywhere
18:33 < finlay> or whatever the table names are
18:33 < finlay> so whatever does the prefixes of $tables in the first place
18:34 < finlay> if the user did not specify a table alias for a given table
18:34 < finlay> make it default-alias it to the non-prefixed name

If the user aliases `td_page` to `blah` then they will have to use `blah` everywhere. If they don't specify an alias, it will alias the table from `td_page` to `page`... assuming 'td_' was my table prefix.

It should be an elegant solution that fixes it for everyone involved and makes developers happy.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links