refresh with delete

View: New views
5 Messages — Rating Filter:   Alert me  

refresh with delete

by Paolo DiCanio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user

Re: refresh with delete

by Luiz Eduardo Guida Valmont-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <domurtag@...>
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
dbunit-user@...
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
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user

Re: refresh with delete

by Paolo DiCanio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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 <legvalmont@...>
To: dbunit-user@...
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 <domurtag@...>
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
dbunit-user@...
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
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user

Parent Message unknown Re: refresh with delete

by Matthias Gommeringer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" <domurtag@...>
> Gesendet: 20.08.09 22:00:14
> An: dbunit-user@...
> 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 <legvalmont@...>
> To: dbunit-user@...
> 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 <domurtag@...>
>
> 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
> dbunit-user@...
> 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 dbunit-user@... 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
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user

Re: refresh with delete

by Paolo DiCanio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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 <Matthias.Gommeringer@...>
To: dbunit-user@...
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" <domurtag@...>
> Gesendet: 20.08.09 22:00:14
> An: dbunit-user@...
> 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 <legvalmont@...>
> To: dbunit-user@...
> 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 <domurtag@...>
>
> 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
> dbunit-user@...
> 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 dbunit-user@... 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
dbunit-user@...
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
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user