(FYI for everyone):

you can also email the group posting (with an attachment, e.g. a patch) by
mailing to:

[email protected]

with a subject line matching the thread topic.

On Thu, Oct 1, 2009 at 8:33 AM, mdipierro <[email protected]> wrote:

>
> Thank you. Could you please email this to me?
>
> On Oct 1, 7:48 am, Nico de Groot <[email protected]> wrote:
> > The DAL generates update code for table fields like this.
> >
> >     ALTER TABLE auth_permission ADD group_id__tmp INT, ADD
> > CONSTRAINT ... ;
> >
> > The ', ADD' generates a SQL syntax error for SQLServer (at least for
> > version 2005) this syntax should be
> >
> >     ALTER TABLE auth_permission ADD group_id__tmp INT; ALTER TABLE ADD
> > CONSTRAINT ...
> >
> > My suggested patch is below, I'll send the patch by direct mail.
> >
> > Nico de Groot
> >
> > web2py (Version 1.67.1) gluon/sql.py
> >
> > lines 1414-1416
> >
> >             if not key in sql_fields_old:
> >                 query = ['ALTER TABLE %s ADD %s %s;' %
> > (self._tablename,
> >                         key, sql_fields_aux[key].replace(', ', ', ADD
> > '))]
> >
> > replace by
> >
> >             if not key in sql_fields_old:
> >                 if self._db._dbname == 'mssql':
> >                     query = ['ALTER TABLE %s ADD %s %s;' %
> > (self._tablename,
> >                             key, sql_fields_aux[key].replace(', ', ';
> > ALTER TABLE %s ADD '%self._tablename))]
> >                 else:
> >                     query = ['ALTER TABLE %s ADD %s %s;' %
> > (self._tablename,
> >                             key, sql_fields_aux[key].replace(', ', ',
> > ADD '))]
> >
> > and
> >
> > lines(1429-1436)
> >
> >                 t = self._tablename
> >                 tt = sql_fields_aux[key].replace(', ', ', ADD ')
> >                 query = ['ALTER TABLE %s ADD %s__tmp %s;' % (t, key,
> > tt),
> >                          'UPDATE %s SET %s__tmp=%s;' % (t, key, key),
> >                          'ALTER TABLE %s DROP COLUMN %s;' % (t, key),
> >                          'ALTER TABLE %s ADD %s %s;' % (t, key, tt),
> >                          'UPDATE %s SET %s=%s__tmp;' % (t, key, key),
> >                          'ALTER TABLE %s DROP COLUMN %s__tmp;' % (t,
> > key)]
> > replace by
> >
> >                 t = self._tablename
> >                 if self._db._dbname == 'mssql':
> >                     tt = sql_fields_aux[key].replace(', ', '; ALTER
> > TABLE %s ADD '% (self._tablename))
> >                 else:
> >                     tt = sql_fields_aux[key].replace(', ', ', ADD ')
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to