[development] portability issue with uid=0 being anonymous
Steven Peck
sepeck at gmail.com
Thu Nov 1 22:09:55 UTC 2007
If you were unaware, see the groups enterprise group for other posts
http://groups.drupal.org/enterprise
On 11/1/07, Christoph Otto (Volt) <a-chotto at microsoft.com> wrote:
> I'm porting the Drupal 6 beta to run on the new sqlsrv driver for SQL Server 2005 and am running into some issues around the way uid 0 and 1 are set to anonymous and admin. The current code (modules/system/system.install line 249) inserts placeholders into uid = 1 and 2 then subtracts 1 from each uid via an UPDATE. This works fine for MySQL and PostgreSQL, but isn't portable to SQL Server 2005, which doesn't allow IDENTITY columns to be changed. (The only way I've found to do it is to create a new column and insert the new values, but this is not elegant.)
>
> My approach has been to add an 'initial value' key to the 'fields' array returned by hook_schema. If this value is set for a 'serial' field, the value will be the first in the sequence. Both PostgreSQL and SQL Server 2005 have ways to make an serial or IDENTITY column start at 0, but I haven't found a way that works for MySQL. (Adding AUTO_INCREMENT=0 to the end of the table definition silently fails, even with sqlmode=NO_AUTO_VALUE_ON_ZERO.) The attached patch against CVS works correctly for PostgreSQL but breaks on MySQL.
>
> I'm not attached to any alternative way of making this port work and would appreciate any input.
>
> Thanks,
>
> Christoph Otto (Volt)
> a-chotto at microsoft.com
> Microsoft Open Source Software Lab
>
>
>
More information about the development
mailing list