Quantcast

Multiple statement SQL possible?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Multiple statement SQL possible?

scottk
Hi,
Using against Sqlite which does not support truncate table. To do
truncate I need to execute both of the following:

DELETE FROM <table>
DELETE FROM sqlite_sequence WHERE name="<table>"

Is it possible to put multiple statements into a mapper such as:

<delete id="truncate">
   DELETE FROM sqlite_sequence WHERE name="item";
   DELETE FROM item;
</delete>

MyBatis doesn't complain but it only executes the first statement. I
know I can create two mappers and execute them sequentially, but was
hoping for a cleaner solution.

Thank
Scott
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Multiple statement SQL possible?

Eduardo Macarron
Scott, it depends on the db driver. MyBatis will pass both statements
to it

On 2 abr, 05:09, scottk <[hidden email]> wrote:

> Hi,
> Using against Sqlite which does not support truncate table. To do
> truncate I need to execute both of the following:
>
> DELETE FROM <table>
> DELETE FROM sqlite_sequence WHERE name="<table>"
>
> Is it possible to put multiple statements into a mapper such as:
>
> <delete id="truncate">
>    DELETE FROM sqlite_sequence WHERE name="item";
>    DELETE FROM item;
> </delete>
>
> MyBatis doesn't complain but it only executes the first statement. I
> know I can create two mappers and execute them sequentially, but was
> hoping for a cleaner solution.
>
> Thank
> Scott
Loading...