[Wikitech-l] Escaping for field and index names

2013-10-07 Thread Jeroen De Dauw
Hey, When constructing an SQL string, how should the following things be escaped, if at all? * Field names * Index names It looks like when doing a select using the Database MW thing, the field names provided do not get escaped at all. Cheers -- Jeroen De Dauw http://www.bn2vs.com Don't

Re: [Wikitech-l] Escaping for field and index names

2013-10-07 Thread Tyler Romeo
On Oct 7, 2013 11:55 AM, Jeroen De Dauw jeroended...@gmail.com wrote: Hey, When constructing an SQL string, how should the following things be escaped, if at all? * Field names * Index names It looks like when doing a select using the Database MW thing, the field names provided do not

Re: [Wikitech-l] Escaping for field and index names

2013-10-07 Thread Chris Steipp
On Mon, Oct 7, 2013 at 8:54 AM, Jeroen De Dauw jeroended...@gmail.comwrote: Hey, When constructing an SQL string, how should the following things be escaped, if at all? * Field names * Index names It looks like when doing a select using the Database MW thing, the field names provided do

Re: [Wikitech-l] Escaping for field and index names

2013-10-07 Thread Brad Jorsch (Anomie)
On Mon, Oct 7, 2013 at 12:05 PM, Chris Steipp cste...@wikimedia.org wrote: If you are writing an enhancement to this, you should wrap them in ` and escape ` characters in the name. DatabaseBase::addIdentifierQuotes wraps, but doesn't escape. Backquotes are a MySQLism. The SQL standard uses

Re: [Wikitech-l] Escaping for field and index names

2013-10-07 Thread Tyler Romeo
On Mon, Oct 7, 2013 at 12:31 PM, Brad Jorsch (Anomie) bjor...@wikimedia.org wrote: DatabaseMysqlBase::addIdentifierQuotes, on the other hand, doesn't escape correctly; it uses the same function for quoting strings and identifiers, despite the different quote marks. So it will change 'foo