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 Warren <wa...@clarksnutrition.com> on 2007/06/14 21:40:01 UTC

table name and quotes:

I am using the copy command of postgres and have an sql map like this:

   <statement id="importTextFile" parameterClass="java.util.Map">
     COPY sometable FROM #filename#
   </statement>

I would like to use something like this:

   <statement id="importTextFile" parameterClass="java.util.Map">
     COPY #tablename# FROM #filename#
   </statement>

The sql map at the top works, but the one below it does not. It 
constructs the statement as:

     COPY 'sometable' FROM 'somefile'

I need the quotes removed around the table name.

-- 
Thanks,

Warren

Re: table name and quotes:

Posted by Warren <wa...@clarksnutrition.com>.
Thanks

Brandon Goodin wrote:
> you would need to use the literal notation of $tablename$. Caution, it 
> opens you to the possibility of of SQL injection.
> 
> Brandon
> 
> On 6/14/07, *Warren* <warren@clarksnutrition.com 
> <ma...@clarksnutrition.com>> wrote:
> 
>     I am using the copy command of postgres and have an sql map like this:
> 
>        <statement id="importTextFile" parameterClass="java.util.Map">
>          COPY sometable FROM #filename#
>        </statement>
> 
>     I would like to use something like this:
> 
>        <statement id="importTextFile" parameterClass="java.util.Map">
>          COPY #tablename# FROM #filename#
>        </statement>
> 
>     The sql map at the top works, but the one below it does not. It
>     constructs the statement as:
> 
>          COPY 'sometable' FROM 'somefile'
> 
>     I need the quotes removed around the table name.
> 
>     -- 
>     Thanks,
> 
>     Warren
> 
> 


-- 
Thanks,

Warren Bell
Systems Administrator
Clark's Nutritional Centers
4225 Market St.
Riverside, CA 92501
951-321-1960 ext. 142
909-645-8864 mobile

Re: table name and quotes:

Posted by Brandon Goodin <br...@gmail.com>.
you would need to use the literal notation of $tablename$. Caution, it opens
you to the possibility of of SQL injection.

Brandon

On 6/14/07, Warren <wa...@clarksnutrition.com> wrote:
>
> I am using the copy command of postgres and have an sql map like this:
>
>    <statement id="importTextFile" parameterClass="java.util.Map">
>      COPY sometable FROM #filename#
>    </statement>
>
> I would like to use something like this:
>
>    <statement id="importTextFile" parameterClass="java.util.Map">
>      COPY #tablename# FROM #filename#
>    </statement>
>
> The sql map at the top works, but the one below it does not. It
> constructs the statement as:
>
>      COPY 'sometable' FROM 'somefile'
>
> I need the quotes removed around the table name.
>
> --
> Thanks,
>
> Warren
>