Should quoting fields like this be the responsibility of Fluent
NHibernate? What about using hbm2ddl.keywords and
SchemaMetadataUpdater as demonstrated in
http://fabiomaulo.blogspot.com/2009/06/auto-quote-tablecolumn-names.html
?

With an opt-in/out option for its use as part of the fluent
configuration.

On 28 Jan, 21:56, "David R. Longnecker" <drlongnec...@gmail.com>
wrote:
> Oh, I should read my email... damn gmail filters. I wouldn't have
> twit-tormented James about this earlier. ;)
>
> Anyway, I've updated the XmlColumnWriter in my fork and things are dandy.
> "`" + name + "`" == evil.
>
> I can see value in being able to auto-quote, but I'm not sure how to get at
> it.  Someone with more experience with the deep bits of
> MappingBase/IMappingProvider (maybe adding a 'WithQuotes' bool or something)
> and apply to OneToOneMapping and ClassMap.
>
> -dl
>
> ---
> David R. Longnecker
> blog:http://blog.drlongnecker.com
> twitter: dlongnecker
>
> On Thu, Jan 28, 2010 at 1:20 PM, James Gregory <jagregory....@gmail.com>wrote:
>
>
>
> > Yeah, I was thinking of something similar. I think for the time being I'll
> > just undo the offending change until we can come up with a less harmful
> > change.
>
> > On Thu, Jan 28, 2010 at 7:16 PM, Pci <pablo.r...@gmail.com> wrote:
>
> >> Yeah, this quoting thing it's an issue too when using things like
> >> Formulas and/or Checks..
>
> >> Specially on PostgreSQL which is case sensitive when using quotes, but
> >> insensitive when not. This forces us to quote every identifier on each
> >> formular definition, but then NH get's confused and makes weird things
> >> like this:
>
> >> Formula: "(SELECT SUM(b.`Credit`) FROM `BusinessUnits` b WHERE
> >> b.`OwnerId`=`Id`)"
>
> >> Result: (SELECT SUM(b.this_."Credit") FROM this_."BusinessUnits" b
> >> WHERE b.this_."OwnerId"=this_."Id")
>
> >> W/o quoting tables/columns there's no need to quote identifiers on
> >> formulas.. and so there's no problem at all.
>
> >> Initally I thoung on adding some kind of global property to
> >> FluentConfiguration which disabled quoting at all, but AFAIK from
> >> XmlColumnWriter you cannot access FluentConfiguration nor any other
> >> global structure.. so I have nothing on which I can really to know if
> >> the user wants quoting or not.
>
> >> On Jan 23, 9:10 pm, Doron Yaacoby <ya.do...@gmail.com> wrote:
> >> > Sure thing. Thanks for the tip.
>
> >> > On Jan 23, 10:08 pm, James Gregory <jagregory....@gmail.com> wrote:
>
> >> > > Looks like I need to review this again then. In the mean time you'll
> >> need to
> >> > > modify the code yourself to undo my change :(
>
> >> > > XmlColumnWriter is the class you need to change, you should see the
> >> code for
> >> > > writing out the name attribute appends the backticks.
>
> >> > > I'll try to come up with a more manageable solution; maybe a setting
> >> or
> >> > > something.
>
> >> > > On Sat, Jan 23, 2010 at 8:03 PM, Doron Yaacoby <ya.do...@gmail.com>
> >> wrote:
> >> > > > Well,
> >> > > > In Oracle quoting a table or a column name makes it case-sensitive.
> >> > > > So select * from "Customer" != select * from customer. Hence, the
> >> > > > failing queries.
>
> >> > > > I also noticed that FNHquotestable names as well, but that can be
> >> > > > overcome by explicitly specifing the table name in the mappings. It
> >> > > > doesn't work for columns, though.
>
> >> > > > On Jan 23, 9:48 pm, James Gregory <jagregory....@gmail.com> wrote:
> >> > > > > Your queries shouldn't fail, unless oracle is really badly
> >> designed. The
> >> > > > > quoting simply affects the queries, and is used to escape
> >> keywords. At
> >> > > > least
> >> > > > > in SQL Server [Customer] is exactly the same as Customer in a
> >> query, and
> >> > > > has
> >> > > > > no effect to the underlying schema.
>
> >> > > > > On Sat, Jan 23, 2010 at 7:28 PM, Doron Yaacoby <
> >> ya.do...@gmail.com>
> >> > > > wrote:
> >> > > > > > Since all my queries now fail, as my tables in the database
> >> (Oracle)
> >> > > > > > were created withoutquotesin the field names. Is there a way to
> >> turn
> >> > > > > > the quoting off?
>
> >> > > > > > On Jan 23, 9:22 pm, James Gregory <jagregory....@gmail.com>
> >> wrote:
> >> > > > > > > Yep, by design. Why?
>
> >> > > > > > > On Sat, Jan 23, 2010 at 7:21 PM, Doron Yaacoby <
> >> ya.do...@gmail.com>
> >> > > > > > wrote:
> >> > > > > > > > Hi,
> >> > > > > > > > Using the latest trunk version of FNH, it seems to be
> >> quoting all
> >> > > > > > > > field names in the mappings. This doesn't happen in the
> >> version 1
> >> > > > RTM.
> >> > > > > > > > Is this by design?
>
> >> > > > > > > > Thanks,
> >> > > > > > > > Doron
>
> >> > > > > > > > --
> >> > > > > > > > You received this message because you are subscribed to the
> >> Google
> >> > > > > > Groups
> >> > > > > > > > "Fluent NHibernate" group.
> >> > > > > > > > To post to this group, send email to
> >> > > > > > fluent-nhibern...@googlegroups.com.
> >> > > > > > > > To unsubscribe from this group, send email to
> >> > > > > > > > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2Bunsubscr
> >> > > > > > > >  i...@googlegroups.com><fluent-nhibernate%2Bunsubscr
> >> i...@googlegroups.com>
> >> > > > <fluent-nhibernate%2bunsubscr...@googlegroups.com<fluent-nhibernate%252Buns
> >> > > >  ubscr...@googlegroups.com><fluent-nhibernate%252Buns
> >> ubscr...@googlegroups.com>
>
> >> > > > > > <fluent-nhibernate%2bunsubscr...@googlegroups.com<fluent-nhibernate%252Buns
> >> > > > > >  ubscr...@googlegroups.com><fluent-nhibernate%252Buns
> >> ubscr...@googlegroups.com>
> >> > > > <fluent-nhibernate%252bunsubscr...@googlegroups.com<fluent-nhibernate%25252
> >> > > >  bunsubscr...@googlegroups.com><fluent-nhibernate%25252
> >> bunsubscr...@googlegroups.com>
>
> >> > > > > > > > .
> >> > > > > > > > For more options, visit this group at
> >> > > > > > > >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> >> > > > > > --
> >> > > > > > You received this message because you are subscribed to the
> >> Google
> >> > > > Groups
> >> > > > > > "Fluent NHibernate" group.
> >> > > > > > To post to this group, send email to
> >> > > > fluent-nhibern...@googlegroups.com.
> >> > > > > > To unsubscribe from this group, send email to
> >> > > > > > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2Bunsubscr
> >> > > > > >  i...@googlegroups.com><fluent-nhibernate%2Bunsubscr
> >> i...@googlegroups.com>
> >> > > > <fluent-nhibernate%2bunsubscr...@googlegroups.com<fluent-nhibernate%252Buns
> >> > > >  ubscr...@googlegroups.com><fluent-nhibernate%252Buns
> >> ubscr...@googlegroups.com>
>
> >> > > > > > .
> >> > > > > > For more options, visit this group at
> >> > > > > >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> >> > > > --
> >> > > > You received this message because you are subscribed to the Google
> >> Groups
> >> > > > "Fluent NHibernate" group.
> >> > > > To post to this group, send email to
> >> fluent-nhibern...@googlegroups.com.
> >> > > > To unsubscribe from this group, send email to
> >> > > > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2Bunsubscr
> >> > > >  i...@googlegroups.com><fluent-nhibernate%2Bunsubscr
> >> i...@googlegroups.com>
> >> > > > .
> >> > > > For more options, visit this group at
> >> > > >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Fluent NHibernate" group.
> >> To post to this group, send email to fluent-nhibern...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2Bunsubscr
> >>  i...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to fluent-nhibern...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2Bunsubscr 
> > i...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to