Article View: borland.public.jbuilder.database
Article #371Re: QueryDataSet.deleteAllRows fails
From: Whym Junction
Date: Tue, 12 Dec 2006 08:38
Date: Tue, 12 Dec 2006 08:38
72 lines
3751 bytes
3751 bytes
Hi John,
Thanks for your helpful advice. I'm still learning to use the dx
library.
I found a solution for this problem. There were had duplicate records
in my dataset, and there was no key set. Dx breaks the above query into
smaller pieces; it tries to delete records one at a time. The solution
is to make sure the records are different in at least one field or by
adding a unique key field. I'll report here if I find a way to prevent
the one-at-a-time delete strategy.
Thanks again,
Wim
John Moore (TeamB) schreef:
> Whym,
>
> Frankly I would never have included the line..
>
> queryDataSet1.setResolver(new QueryResolver());
>
> I default resolver is created as part of the QueryDataSet. Unless you
> require special resolution functions (which seems you do not) I don't
> see a reason for that line, (and it may be mucking things up..??)
>
> Another possible addition is:
>
> queryDataSet1.setRowId("CaseID", true);
>
> It could be that the driver you are using is not reporting the metadata
> correctly and therefore you need to give DX a bit more help. Otherwise
> It will use ALL or SOME rows to locate the desired record to delete that
> are not really key fields, depending on what has been reported by the
> driver. This is not a DX problem but a driver issue.
>
> John...
>
>
> Whym Junction wrote:
> > I'm trying to empty a table with the following code (some lines
> > regarding metadataupdate, tablename and rowid removed for brevity):
> >
> >
> > queryDataSet1.setQuery(new QueryDescriptor(database1, "select *
> > from some_table", null, false,Load.ALL));
> > queryDataSet1.setResolver(new QueryResolver());
> > queryDataSet1.executeQuery();
> > queryDataSet1.deleteAllRows();
> > queryDataSet1.saveChanges();
> >
> > The code raises a runtime DataSetException, error code BASE+38:
> > More than one row was affected by resolution query:DELETE FROM
> > `some_table` WHERE `CaseID` = ?
> >
> > I'm stumped. The resolution query seems OK. Did I forget something
> > obvious?
> >
> > Thanks in advance,
> > Wim
> >
>
>
> --
> =============================================
> TeamB are volunteer helpers. Please DO NOT REPLY VIA EMAIL!
> Post all questions and replies to this newsgroup ONLY
> For papers on DataExpress, Applets, JSP, and Web Development go to:
> http://www.microps.com/mps/paperFAQ.html
> ====================================================
Technical Details
Message-ID:
<1165912689.617825.255200@f1g2000cwa.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!f1g2000cwa.googlegroups.com!not-for-mailReferences:
<1165485180.366318.31740@80g2000cwy.googlegroups.com> <4579d5c6$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1073da,1997d4d7825938bd X-Google-Attributes: gid1073da,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!f1g2000cwa.googlegroups.com!not-for-mail From: "Whym Junction" <wmjanssen@gmail.com> Newsgroups: borland.public.jbuilder.database Subject: Re: QueryDataSet.deleteAllRows fails Date: 12 Dec 2006 00:38:09 -0800 Organization: http://groups.google.com Lines: 73 Message-ID: <1165912689.617825.255200@f1g2000cwa.googlegroups.com> References: <1165485180.366318.31740@80g2000cwy.googlegroups.com> <4579d5c6$1@newsgroups.borland.com> NNTP-Posting-Host: 194.151.158.193 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1165912697 18524 127.0.0.1 (12 Dec 2006 08:38:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 12 Dec 2006 08:38:17 +0000 (UTC) In-Reply-To: <4579d5c6$1@newsgroups.borland.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: f1g2000cwa.googlegroups.com; posting-host=194.151.158.193; posting-account=Pz9y0w0AAADXMEg--RwOLJkBx8iyvRj3