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 mimy17 <ni...@hotmail.com> on 2008/07/07 11:46:22 UTC
create table in a mapping file??
Hi,
I would like to know if it's possible to create a temporary table in mapping
file and how?
Thanks
--
View this message in context: http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18313227.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: create table in a mapping file??
Posted by Michael Schall <mi...@gmail.com>.
I think you will have to escape the # in #temp
So references to your temp table would be ##temp. In some databases ##
means something, but if trace what is actually sent to the database and it
should be a single #. If you need ## sent to the database, you will have
double each so you would have #### in the statement.
Your map should look like
<insert id="xxx" parameterClass="xxx">
create table if not exist ##temp
(
...
)
INSERT INTO ##temp
(...)
VALUES(...)
</insert>
On Mon, Jul 7, 2008 at 10:10 AM, Larry Meadors <la...@gmail.com>
wrote:
> How doesn't it work? Silent failure? SQLException?
>
> Larry
>
>
> On Mon, Jul 7, 2008 at 9:08 AM, mimy17 <ni...@hotmail.com> wrote:
> >
> > Yes, I tried like this:
> >
> > <insert id="xxx" parameterClass="xxx">
> > create table if not exist #temp
> > (
> > ...
> > )
> >
> > INSERT INTO #temp
> > (...)
> > VALUES(...)
> > </insert>
> >
> > But it doesn't work.
> > I looked in the documentation, but I didn't find a tag like "<create id""
> > ...>
> >
> >
> >
> > Larry Meadors wrote:
> >>
> >> If you can do it with JDBC, you can probably do it with iBATIS.
> >>
> >> Did you try it?
> >>
> >> Larry
> >>
> >>
> >> On Mon, Jul 7, 2008 at 3:46 AM, mimy17 <ni...@hotmail.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I would like to know if it's possible to create a temporary table in
> >>> mapping
> >>> file and how?
> >>>
> >>> Thanks
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18313227.html
> >>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >
> > --
> > View this message in context:
> http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18318965.html
> > Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >
> >
>
Re: create table in a mapping file??
Posted by Larry Meadors <la...@gmail.com>.
How doesn't it work? Silent failure? SQLException?
Larry
On Mon, Jul 7, 2008 at 9:08 AM, mimy17 <ni...@hotmail.com> wrote:
>
> Yes, I tried like this:
>
> <insert id="xxx" parameterClass="xxx">
> create table if not exist #temp
> (
> ...
> )
>
> INSERT INTO #temp
> (...)
> VALUES(...)
> </insert>
>
> But it doesn't work.
> I looked in the documentation, but I didn't find a tag like "<create id""
> ...>
>
>
>
> Larry Meadors wrote:
>>
>> If you can do it with JDBC, you can probably do it with iBATIS.
>>
>> Did you try it?
>>
>> Larry
>>
>>
>> On Mon, Jul 7, 2008 at 3:46 AM, mimy17 <ni...@hotmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I would like to know if it's possible to create a temporary table in
>>> mapping
>>> file and how?
>>>
>>> Thanks
>>> --
>>> View this message in context:
>>> http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18313227.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18318965.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
Re: create table in a mapping file??
Posted by mimy17 <ni...@hotmail.com>.
Yes, I tried like this:
<insert id="xxx" parameterClass="xxx">
create table if not exist #temp
(
...
)
INSERT INTO #temp
(...)
VALUES(...)
</insert>
But it doesn't work.
I looked in the documentation, but I didn't find a tag like "<create id""
...>
Larry Meadors wrote:
>
> If you can do it with JDBC, you can probably do it with iBATIS.
>
> Did you try it?
>
> Larry
>
>
> On Mon, Jul 7, 2008 at 3:46 AM, mimy17 <ni...@hotmail.com> wrote:
>>
>> Hi,
>>
>> I would like to know if it's possible to create a temporary table in
>> mapping
>> file and how?
>>
>> Thanks
>> --
>> View this message in context:
>> http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18313227.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18318965.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: create table in a mapping file??
Posted by Larry Meadors <la...@gmail.com>.
If you can do it with JDBC, you can probably do it with iBATIS.
Did you try it?
Larry
On Mon, Jul 7, 2008 at 3:46 AM, mimy17 <ni...@hotmail.com> wrote:
>
> Hi,
>
> I would like to know if it's possible to create a temporary table in mapping
> file and how?
>
> Thanks
> --
> View this message in context: http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18313227.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
Re: R: create table in a mapping file??
Posted by mimy17 <ni...@hotmail.com>.
Hi,
It works very well with the <statement> tag and # character to escape.
Many thanks
Davide Rogora wrote:
>
> We create tables with iBatis <statement> tag and it works perfectly
>
> I.e.:
> <statement id="createTableFoo">
> CREATE TABLE [dbo].[FooTable]
> .....
> </statement>
>
> Remember that if the table name contains # character, you have to escape
> it,
> otherwhise iBatis will treat it like a field placeholder.
>
> Davide.
>
>
> -----Messaggio originale-----
> Da: mimy17 [mailto:ninny12@hotmail.com]
> Inviato: lunedi 7 luglio 2008 11.46
> A: user-java@ibatis.apache.org
> Oggetto: create table in a mapping file??
>
>
>
> Hi,
>
> I would like to know if it's possible to create a temporary table in
> mapping
> file and how?
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18313227.h
> tml
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
>
>
>
--
View this message in context: http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18335639.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
R: create table in a mapping file??
Posted by Davide Rogora <dr...@unionefiduciaria.it>.
We create tables with iBatis <statement> tag and it works perfectly
I.e.:
<statement id="createTableFoo">
CREATE TABLE [dbo].[FooTable]
.....
</statement>
Remember that if the table name contains # character, you have to escape it,
otherwhise iBatis will treat it like a field placeholder.
Davide.
-----Messaggio originale-----
Da: mimy17 [mailto:ninny12@hotmail.com]
Inviato: lunedi 7 luglio 2008 11.46
A: user-java@ibatis.apache.org
Oggetto: create table in a mapping file??
Hi,
I would like to know if it's possible to create a temporary table in mapping
file and how?
Thanks
--
View this message in context:
http://www.nabble.com/create-table-in-a-mapping-file---tp18313227p18313227.h
tml
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.