Ah!  Bill -

I didn't see your post before sending mine.

Thanks for this.  This mapping seems general...  but leaves a special case
for "id" - I supposed if DAL tolerated a  "SQLFILED(id...)   to do no more
than a way for setting external_name, that would be consistent.


The problem this seems to present for me is that it seems tedious:  I would
prefer building a mapping table some other way.... where I intend to do it
to map to an existing db;

In the case of reserved-word conflicts (as I stated) I don't want to have to
change my code every time I try to change the db (in the case of reserved
words)...

I still need to think about this, see more good ideas like this before I'll
be done "thinking out loud" --- but it does feel like we might be on to
something useful.

Regards,
Yarko


On Mon, Nov 10, 2008 at 11:16 AM, billf <[EMAIL PROTECTED]>wrote:

>
> Yarko
>
> I actually meant the following 2 cases:
>
> 1) if T2 uses the name "password" and that is a reserved word in
> Firebird then T2.person can redefined in db.py with the password
> something like
> SQLField('password','password',external_name='some_word_firebird_allows')
>
> 2) if a legacy table has a column called 'field12' that contains a
> salary then in db.py we could say
> SQLField('salary','integer',external_name='field12')
>
> external_name defaults to fieldname.
>
> On Nov 10, 4:35 pm, "Yarko T" <[EMAIL PROTECTED]> wrote:
> > yes...  something about   if "foo" is reserved, the form "foo_" is
> > guarenteed to never be a reserved word.... (something like that).
> > I made to argument that in web2py we should use whatever words we want,
> with
> > no worries, and KNOW, announce, have the DAL uniformly convert ALL
> database
> > field names to the form "foo_"
> >
> > Massimo made some argument against that ... I don't remember what it was
> or
> > it's strenghth... .but maybe this is enough context to start from if you
> > want to re-visit this.
> >
> > Yarko
> >
> > On Mon, Nov 10, 2008 at 9:22 AM, billf <[EMAIL PROTECTED]>
> wrote:
> >
> > > I don't think you can.  I'd be happy to be proved wrong.
> >
> > > There was a thread a while ago about how it would be really nice to be
> > > able to map a database column name to an 'internal' name.  This was
> > > primarily to help with legacy tables that had unfriendly column
> > > names.  In the context of Firebird/T2, I guess you could redefine the
> > > T2.person table with a column name other than password and map it to
> > > 'password' internally.
> >
> > > Having said that we don't have an "map" facility yet :-)
> >
> > > On Nov 10, 2:47 pm, Jose <[EMAIL PROTECTED]> wrote:
> > > > Hello.
> >
> > > > How can I change the name of some fields when I use T2?
> > > > There are some of them that correspond to words reserved of Firebird,
> > > > for example password.
> >
> > > > Regards
> > > > Jose
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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