You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Mark Cooke <ma...@yahoo.co.uk> on 2006/10/31 14:42:46 UTC

Abator: column override (@ in column names in MSSQL Server DB)

Hi,
I've tried using abator against a MSSQL server, where
some of the tables' column names begin with a @.
I've put a column override for each of the columns to
force the java property name (i.e. drop the @), which
works fine.  The problem comes with the generated
SQL...the bad column names are interpreted as
variables (that's what MSSQL's error says it thinks it
is).
For MSSQL - The column name should be delimited with
either a single or double quote (I Think).

I don't suppose there are any undocumented options on
the column or SQL generator elements with which I can
force the column names to be delimited in the SQL?

Thanks in Advance,
Mark.

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: Abator: column override (@ in column names in MSSQL Server DB)

Posted by Mark Cooke <ma...@yahoo.co.uk>.
Jeff,
  Cool! It's nice to be listened to!

So, the inevitable questions:
Is that what you're going to implement? and
When (roughly) will it be available?

Mark.

--- Jeff Butler <je...@gmail.com> wrote:

> You're not being stupid - I really value this kind
> of feedback.
> 
> I think it's a good idea to put it in the context
> and then enable/disable by
> table and possibly column.
> 
> Jeff Butler
> 
> 
> On 11/2/06, Mark Cooke <ma...@yahoo.co.uk>
> wrote:
> >
> > I was sure you'd be aware of that - but it doesn't
> > hurt to make sure, eh?
> >
> > Tell me to stop being stupid if you want but...
> > ...seeing as how the delimiters are database(or
> > rather, connection, specific) would it be better
> to
> > specify what they are once (in abatorContext or
> > jdbcConnection maybe) and have a boolean attribute
> in
> > tables and/or columns (useDelimiters)?
> > This would have the advantage that those
> unfortunate
> > souls that have to deal with stupidly named
> > columns/tables (surely it's not just me) don't
> have to
> > type the same thing many times.
> > (and the SQL won't look so cluttered either)
> >
> > Mark.
> >
> >
> >
> 



	
	
		
___________________________________________________________ 
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine 
http://uk.docs.yahoo.com/nowyoucan.html

Re: Abator: column override (@ in column names in MSSQL Server DB)

Posted by Jeff Butler <je...@gmail.com>.
You're not being stupid - I really value this kind of feedback.

I think it's a good idea to put it in the context and then enable/disable by
table and possibly column.

Jeff Butler


On 11/2/06, Mark Cooke <ma...@yahoo.co.uk> wrote:
>
> I was sure you'd be aware of that - but it doesn't
> hurt to make sure, eh?
>
> Tell me to stop being stupid if you want but...
> ...seeing as how the delimiters are database(or
> rather, connection, specific) would it be better to
> specify what they are once (in abatorContext or
> jdbcConnection maybe) and have a boolean attribute in
> tables and/or columns (useDelimiters)?
> This would have the advantage that those unfortunate
> souls that have to deal with stupidly named
> columns/tables (surely it's not just me) don't have to
> type the same thing many times.
> (and the SQL won't look so cluttered either)
>
> Mark.
>
>
>

Re: Abator: column override (@ in column names in MSSQL Server DB)

Posted by Mark Cooke <ma...@yahoo.co.uk>.
I was sure you'd be aware of that - but it doesn't
hurt to make sure, eh?

Tell me to stop being stupid if you want but...
...seeing as how the delimiters are database(or
rather, connection, specific) would it be better to
specify what they are once (in abatorContext or
jdbcConnection maybe) and have a boolean attribute in
tables and/or columns (useDelimiters)?
This would have the advantage that those unfortunate
souls that have to deal with stupidly named
columns/tables (surely it's not just me) don't have to
type the same thing many times.
(and the SQL won't look so cluttered either)

Mark.

--- Jeff Butler <je...@gmail.com> wrote:

> Yeah - different databases have different
> delimiters.  DB2 uses double
> quotes.  So it will have to be configurable.
> 
> Right now I'm considering adding an option like
> this:
> 
> <table tableName="some table"
> identifierDelimiters="[]"/>
> 
> This would deal with the case where there are
> strange characters in the
> table name too.  In the generated SQL, EVERY
> identifier would be delimited.
> 
> Jeff Butler
> 
> 
> On 11/1/06, Mark Cooke <ma...@yahoo.co.uk>
> wrote:
> >
> > Jeff,
> >    Great, that's brilliant!
> > However...I just realised I was wrong about the
> > required delimiters - the column should be
> enclosed in
> > [] in the queries, not " or '...
> >
> > Mark.
> > --- Jeff Butler <je...@gmail.com> wrote:
> >
> > > There's no solution for this now in Abator. 
> I'll
> > > work on something.
> > >
> > > Jeff Butler
> > >
> > >
> > >
> > > On 10/31/06, Mark Cooke
> <ma...@yahoo.co.uk>
> > > wrote:
> > > >
> > > > Hi,
> > > > I've tried using abator against a MSSQL
> server,
> > > where
> > > > some of the tables' column names begin with a
> @.
> > > > I've put a column override for each of the
> columns
> > > to
> > > > force the java property name (i.e. drop the
> @),
> > > which
> > > > works fine.  The problem comes with the
> generated
> > > > SQL...the bad column names are interpreted as
> > > > variables (that's what MSSQL's error says it
> > > thinks it
> > > > is).
> > > > For MSSQL - The column name should be
> delimited
> > > with
> > > > either a single or double quote (I Think).
> > > >
> > > > I don't suppose there are any undocumented
> options
> > > on
> > > > the column or SQL generator elements with
> which I
> > > can
> > > > force the column names to be delimited in the
> SQL?
> > > >
> > > > Thanks in Advance,
> > > > Mark.
> > > >
> > > > Send instant messages to your online friends
> > > http://uk.messenger.yahoo.com
> > > >
> > >
> >
> >
> > Send instant messages to your online friends
> http://uk.messenger.yahoo.com
> >
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: Abator: column override (@ in column names in MSSQL Server DB)

Posted by Jeff Butler <je...@gmail.com>.
Yeah - different databases have different delimiters.  DB2 uses double
quotes.  So it will have to be configurable.

Right now I'm considering adding an option like this:

<table tableName="some table" identifierDelimiters="[]"/>

This would deal with the case where there are strange characters in the
table name too.  In the generated SQL, EVERY identifier would be delimited.

Jeff Butler


On 11/1/06, Mark Cooke <ma...@yahoo.co.uk> wrote:
>
> Jeff,
>    Great, that's brilliant!
> However...I just realised I was wrong about the
> required delimiters - the column should be enclosed in
> [] in the queries, not " or '...
>
> Mark.
> --- Jeff Butler <je...@gmail.com> wrote:
>
> > There's no solution for this now in Abator.  I'll
> > work on something.
> >
> > Jeff Butler
> >
> >
> >
> > On 10/31/06, Mark Cooke <ma...@yahoo.co.uk>
> > wrote:
> > >
> > > Hi,
> > > I've tried using abator against a MSSQL server,
> > where
> > > some of the tables' column names begin with a @.
> > > I've put a column override for each of the columns
> > to
> > > force the java property name (i.e. drop the @),
> > which
> > > works fine.  The problem comes with the generated
> > > SQL...the bad column names are interpreted as
> > > variables (that's what MSSQL's error says it
> > thinks it
> > > is).
> > > For MSSQL - The column name should be delimited
> > with
> > > either a single or double quote (I Think).
> > >
> > > I don't suppose there are any undocumented options
> > on
> > > the column or SQL generator elements with which I
> > can
> > > force the column names to be delimited in the SQL?
> > >
> > > Thanks in Advance,
> > > Mark.
> > >
> > > Send instant messages to your online friends
> > http://uk.messenger.yahoo.com
> > >
> >
>
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>

Re: Abator: column override (@ in column names in MSSQL Server DB)

Posted by Mark Cooke <ma...@yahoo.co.uk>.
Jeff,
    Great, that's brilliant!
However...I just realised I was wrong about the
required delimiters - the column should be enclosed in
[] in the queries, not " or '...

Mark.
--- Jeff Butler <je...@gmail.com> wrote:

> There's no solution for this now in Abator.  I'll
> work on something.
> 
> Jeff Butler
> 
> 
> 
> On 10/31/06, Mark Cooke <ma...@yahoo.co.uk>
> wrote:
> >
> > Hi,
> > I've tried using abator against a MSSQL server,
> where
> > some of the tables' column names begin with a @.
> > I've put a column override for each of the columns
> to
> > force the java property name (i.e. drop the @),
> which
> > works fine.  The problem comes with the generated
> > SQL...the bad column names are interpreted as
> > variables (that's what MSSQL's error says it
> thinks it
> > is).
> > For MSSQL - The column name should be delimited
> with
> > either a single or double quote (I Think).
> >
> > I don't suppose there are any undocumented options
> on
> > the column or SQL generator elements with which I
> can
> > force the column names to be delimited in the SQL?
> >
> > Thanks in Advance,
> > Mark.
> >
> > Send instant messages to your online friends
> http://uk.messenger.yahoo.com
> >
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: Abator: column override (@ in column names in MSSQL Server DB)

Posted by Jeff Butler <je...@gmail.com>.
There's no solution for this now in Abator.  I'll work on something.

Jeff Butler



On 10/31/06, Mark Cooke <ma...@yahoo.co.uk> wrote:
>
> Hi,
> I've tried using abator against a MSSQL server, where
> some of the tables' column names begin with a @.
> I've put a column override for each of the columns to
> force the java property name (i.e. drop the @), which
> works fine.  The problem comes with the generated
> SQL...the bad column names are interpreted as
> variables (that's what MSSQL's error says it thinks it
> is).
> For MSSQL - The column name should be delimited with
> either a single or double quote (I Think).
>
> I don't suppose there are any undocumented options on
> the column or SQL generator elements with which I can
> force the column names to be delimited in the SQL?
>
> Thanks in Advance,
> Mark.
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>