refresh with delete

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

refresh with delete

Paolo DiCanio
Hi,

I was reading about DbUnit's refresh operation which almost does what I need. This will insert any rows that are in the XML file but not in the DB and update any rows that are in both the DB and the file.

However, I would also like to delete any rows that are in the DB but not in the file. Is there any way to achieve this?

Thanks,
Paolo


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: refresh with delete

Luiz Eduardo Guida Valmont-2
If I'm not mistaken, you're looking for CLEAN_INSERT. Take a loot at:

http://www.dbunit.org/apidocs/org/dbunit/operation/DatabaseOperation.html

CLEAN_INSERT will perform a DELETE_ALL, followed by a INSERT.

Regards,
Luiz

2009/8/20 Donal Murtagh <[hidden email]>
Hi,

I was reading about DbUnit's refresh operation which almost does what I need. This will insert any rows that are in the XML file but not in the DB and update any rows that are in both the DB and the file.

However, I would also like to delete any rows that are in the DB but not in the file. Is there any way to achieve this?

Thanks,
Paolo


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: refresh with delete

Paolo DiCanio
Thanks for the response, but that's not what I'm looking for. The behaviour I'm looking for is:

1. Rows that are in both the DB and file are updated (not deleted then inserted)
2. Rows that are in the file but not in the DB are inserted
3. Rows that are in the DB but not the file are deleted

If I use CLEAN_INSERT this will delete all the rows then insert them which violates (1).

If I use REFRESH, this will accomlish (1) and (2), but not 3.


From: Luiz Eduardo Guida Valmont <[hidden email]>
To: [hidden email]
Sent: Thursday, 20 August, 2009 15:24:42
Subject: Re: [dbunit-user] refresh with delete

If I'm not mistaken, you're looking for CLEAN_INSERT. Take a loot at:

http://www.dbunit.org/apidocs/org/dbunit/operation/DatabaseOperation.html

CLEAN_INSERT will perform a DELETE_ALL, followed by a INSERT.

Regards,
Luiz

2009/8/20 Donal Murtagh <[hidden email]>
Hi,

I was reading about DbUnit's refresh operation which almost does what I need. This will insert any rows that are in the XML file but not in the DB and update any rows that are in both the DB and the file.

However, I would also like to delete any rows that are in the DB but not in the file. Is there any way to achieve this?

Thanks,
Paolo


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: refresh with delete

Matthias Gommeringer
In reply to this post by Paolo DiCanio
Hi Donald,

to me this sounds more like a theoretical problem. The final result state of the DB that you wish to have should exactly be reached via a CLEAN_INSERT. Or do you have a special reason for not updating rows instead of delete and re-insert rows? (maybe because of some special DB trigger that fires on updates only)

rgds,
matthias

> -----Ursprüngliche Nachricht-----
> Von: "Donal Murtagh" <[hidden email]>
> Gesendet: 20.08.09 22:00:14
> An: [hidden email]
> Betreff: Re: [dbunit-user] refresh with delete


> Thanks for the response, but that's not what I'm looking for. The
> behaviour I'm looking for is:
>
> 1. Rows that are in both the DB and file are updated (not deleted
> then inserted)
> 2. Rows that are in the file but not in the DB are inserted
> 3. Rows that are in the DB but not the file are deleted
>
> If I use CLEAN_INSERT this will delete all the rows then insert them
> which violates (1).
>
> If I use REFRESH, this will accomlish (1) and (2), but not 3.
>
> From: Luiz Eduardo Guida Valmont <[hidden email]>
> To: [hidden email]
> Sent: Thursday, 20 August, 2009 15:24:42
> Subject: Re: [dbunit-user] refresh with delete
>
> If I'm not mistaken, you're looking for CLEAN_INSERT. Take a loot at:
>
> http://www.dbunit.org/apidocs/org/dbunit/operation/DatabaseOperation.
> html
>
> CLEAN_INSERT will perform a DELETE_ALL, followed by a INSERT.
>
> Regards,
> Luiz
>
> 2009/8/20 Donal Murtagh <[hidden email]>
>
> Hi,
>
> I was reading about DbUnit's refresh operation which almost does what
> I need. This will insert any rows that are in the XML file but not in
> the DB and update any rows that are in both the DB and the file.
>
> However, I would also like to delete any rows that are in the DB but
> not in the file. Is there any way to achieve this?
>
> Thanks,
> Paolo
>
> ----------------------------------------------------------------------
> --------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>
> ----------------------------------------------------------------------
> -------- Let Crystal Reports handle the reporting - Free Crystal
> Reports 2008 30-Day trial. Simplify your report design, integration
> and deployment - and focus on what you do best, core application
> coding. Discover what's new with Crystal Reports now. http://p.sf.net/
> sfu/bobj-july_______________________________________________ dbunit-
> user mailing list [hidden email] https://lists.
>
> sourceforge.net/lists/listinfo/dbunit-user


______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: refresh with delete

Paolo DiCanio
I want to update the rows because deleting and re-inserting them will break foreign key constraints.
This is because the PK of these rows is automatically generated so there is no way to delete them and re-insert them with the same PK value.


From: Matthias Gommeringer <[hidden email]>
To: [hidden email]
Sent: Thursday, 20 August, 2009 16:14:06
Subject: Re: [dbunit-user] refresh with delete

Hi Donald,

to me this sounds more like a theoretical problem. The final result state of the DB that you wish to have should exactly be reached via a CLEAN_INSERT. Or do you have a special reason for not updating rows instead of delete and re-insert rows? (maybe because of some special DB trigger that fires on updates only)

rgds,
matthias

> -----Ursprüngliche Nachricht-----
> Von: "Donal Murtagh" <[hidden email]>
> Gesendet: 20.08.09 22:00:14
> An: [hidden email]
> Betreff: Re: [dbunit-user] refresh with delete


> Thanks for the response, but that's not what I'm looking for. The
> behaviour I'm looking for is:
>
> 1. Rows that are in both the DB and file are updated (not deleted
> then inserted)
> 2. Rows that are in the file but not in the DB are inserted
> 3. Rows that are in the DB but not the file are deleted
>
> If I use CLEAN_INSERT this will delete all the rows then insert them
> which violates (1).
>
> If I use REFRESH, this will accomlish (1) and (2), but not 3.
>
> From: Luiz Eduardo Guida Valmont <[hidden email]>
> To: [hidden email]
> Sent: Thursday, 20 August, 2009 15:24:42
> Subject: Re: [dbunit-user] refresh with delete
>
> If I'm not mistaken, you're looking for CLEAN_INSERT. Take a loot at:
>
> http://www.dbunit.org/apidocs/org/dbunit/operation/DatabaseOperation.
> html
>
> CLEAN_INSERT will perform a DELETE_ALL, followed by a INSERT.
>
> Regards,
> Luiz
>
> 2009/8/20 Donal Murtagh <[hidden email]>
>
> Hi,
>
> I was reading about DbUnit's refresh operation which almost does what
> I need. This will insert any rows that are in the XML file but not in
> the DB and update any rows that are in both the DB and the file.
>
> However, I would also like to delete any rows that are in the DB but
> not in the file. Is there any way to achieve this?
>
> Thanks,
> Paolo
>
> ----------------------------------------------------------------------
> --------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p..sf.net/sfu/bobj-july
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists..sourceforge.net/lists/listinfo/dbunit-user
>
> ----------------------------------------------------------------------
> -------- Let Crystal Reports handle the reporting - Free Crystal
> Reports 2008 30-Day trial. Simplify your report design, integration
> and deployment - and focus on what you do best, core application
> coding. Discover what's new with Crystal Reports now. http://p.sf.net/
> sfu/bobj-july_______________________________________________ dbunit-
> user mailing list [hidden email] https://lists.
>
> sourceforge.net/lists/listinfo/dbunit-user


______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial.. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists..sourceforge.net/lists/listinfo/dbunit-user


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user