Re: Rowsets
Mark Dawson <[email protected]> Tue, 4 Feb 2003 15:59:41 -0000
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <090ED6DFF3D5D611A81400508B8B5A3F0C35A1@SKYLLA> |
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------ =_NextPart_001_01C2CC66.6ED27714
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Yes, but you should be careful otherwise you may end up deleting rows
out of the server table which I assume is not what you want to =
happen.=A0
In this case you should make sure you ask for 'IRowsetUpdate' so you =
can
control when updates are committed to the data store.=A0 You can then =
just
discard the changes later on.=A0 In ADO you ask for a client cursor
recordset, perform your deletes but then don't call 'Update' to commit
the changes.
=A0
Mark=20
--------------------------------------------------------------=20
Mark Dawson ([email protected])=20
Software Project Leader=20
SRH Systems Ltd.=20
Lowesmoor Wharf, Worcester.=20
WR1 2RS. UK=20
+44 (0)1905 613361=20
-----Original Message-----
From: Alan Gamboa [mailto:[email protected]]
Sent: 04 February 2003 15:40
To: [email protected]
Subject: Re: [OLEDB_DEV] Rowsets
Just another thought can a row be removed from a rowset? or a record
from an ADO Recordset?
-----Original Message-----
From: Mark Dawson [mailto:[email protected]]
Sent: Tuesday, February 04, 2003 4:24 AM
To: [email protected]
Subject: Re: [OLEDB_DEV] Rowsets
Alan,
=A0
Off the top of my head I can think of 2 ways of doing this.
=A0
The first is to use ADO to build a new recordset that matches the
original; copy accross the data and then grab hold of the Recordset
objects internal Rowset pointer.=A0 This gives you a Client Cursor =
Engine
Rowset that contains the data you requested.
=A0
The second it to write yourself a Rowset object using the ATL templates
that does effectively the same thing: you give your rowset class a
pointer to another rowset which it copies the column definitions of.=A0
You could also have this rowset initialise itself with the data you =
want
populated by applying a filter to the rowset beforehand and passing the
chapter handle to the initialisation routine (assuming the=A0records =
you
want _can_ be filtered out and that you're using a source rowset that
supports filters).
=A0
Both methods are relatively simple to do, but can be quite time
consuming with large data sets.=A0 Obviously in this case, applying
filters in CCE is going to be far more efficient than scanning rowsets
on your own.=A0 Other than this I honestly can't say which is 'best' as =
it
depends on what your intended use of the copied rowset actually is.=A0 =
In
fact what is a better solution than both of these is if you don't
actually need a 'copy' of the rowset and can simply get away with
applying filters to the original and keeping hold of the chapter =
handles
for later use.=A0 I do this frequently.
Mark=20
--------------------------------------------------------------=20
Mark Dawson ([email protected])=20
Software Project Leader=20
SRH Systems Ltd.=20
Lowesmoor Wharf, Worcester.=20
WR1 2RS. UK=20
+44 (0)1905 613361=20
-----Original Message-----
From: Alan Gamboa [mailto:[email protected]]
Sent: 03 February 2003 15:32
To: [email protected]
Subject: [OLEDB_DEV] Rowsets
I have a query:=20
=A0=A0=A0=A0=A0=A0=A0 select f1,f2,f3 from t1 where f1 =3D 1=20
this query returns a rowset of 50 records.=20
I want create a new rowset that contains some of the records in the
above rowset, what is the best way to do this?=20
thanks.=20
Alan Gamboa=20
CCG Systems, Inc.=20
You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.=20
________________________________________________________________________=
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________=
________________________________________________________________________=
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________=
You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.=20
You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.=20
________________________________________________________________________=
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________=
________________________________________________________________________
This=20email=20has=20been=20scanned=20for=20all=20viruses=20by=20the=20Mes=
sageLabs=20SkyScan
service.=20For=20more=20information=20on=20a=20proactive=20anti-virus=20se=
rvice=20working
around=20the=20clock,=20around=20the=20globe,=20visit=20http://www.message=
labs.com
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.
________________________________________________________________________
------ =_NextPart_001_01C2CC66.6ED27714
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Rowsets</TITLE>
<META content=3D"MSHTML 5.00.3105.105" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D375340016-04022003>Yes,=20
but you should be careful otherwise you may end up deleting rows out of =
the=20
server table which I assume is not what you want to happen. In =
this case=20
you should make sure you ask for 'IRowsetUpdate' so you can control =
when updates=20
are committed to the data store. You can then just discard the =
changes=20
later on. In ADO you ask for a client cursor recordset, perform =
your=20
deletes but then don't call 'Update' to commit the =
changes.</SPAN></FONT></DIV>
<DIV> </DIV>
<P><FONT face=3DArial size=3D2>Mark</FONT> <BR><FONT face=3DArial=20
size=3D2>--------------------------------------------------------------<=
/FONT>=20
<BR><FONT face=3DArial size=3D2>Mark Dawson =
([email protected])</FONT>=20
<BR><FONT face=3DArial size=3D2>Software Project Leader</FONT> =
<BR><FONT face=3DArial=20
size=3D2>SRH Systems Ltd.</FONT> <BR><FONT face=3DArial =
size=3D2>Lowesmoor Wharf,=20
Worcester.</FONT> <BR><FONT face=3DArial size=3D2>WR1 2RS. UK</FONT> =
<BR><FONT=20
face=3DArial size=3D2>+44 (0)1905 613361</FONT> </P>
<BLOCKQUOTE>
<DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> Alan Gamboa=20
[mailto:[email protected]]<BR><B>Sent:</B> 04 February 2003=20
15:40<BR><B>To:</B> [email protected]<BR><B>Subject:</B> =
Re:=20
[OLEDB_DEV] Rowsets<BR><BR></DIV></FONT>
<DIV><SPAN class=3D234124115-04022003><FONT color=3D#0000ff =
face=3DArial size=3D2>Just=20
another thought can a row be removed from a rowset? or a record from =
an ADO=20
Recordset?</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> Mark Dawson=20
[mailto:[email protected]]<BR><B>Sent:</B> Tuesday, February =
04, 2003=20
4:24 AM<BR><B>To:</B> =
[email protected]<BR><B>Subject:</B> Re:=20
[OLEDB_DEV] Rowsets<BR><BR></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003>Alan,</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003></SPAN></FONT> </DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003>Off the top of my head I can think of 2 =
ways of=20
doing this.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003></SPAN></FONT> </DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003>The first is to use ADO to build a new =
recordset=20
that matches the original; copy accross the data and then grab hold =
of the=20
Recordset objects internal Rowset pointer. This gives you a =
Client=20
Cursor Engine Rowset that contains the data you=20
requested.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003></SPAN></FONT> </DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003>The second it to write yourself a Rowset =
object=20
using the ATL templates that does effectively the same thing: you =
give your=20
rowset class a pointer to another rowset which it copies the column =
definitions of. You could also have this rowset initialise =
itself with=20
the data you want populated by applying a filter to the rowset =
beforehand=20
and passing the chapter handle to the initialisation routine =
(assuming=20
the records you want _can_ be filtered out and that you're =
using a=20
source rowset that supports filters).</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003>Both methods are relatively simple to =
do, but can=20
be quite time consuming with large data sets. Obviously in =
this case,=20
applying filters in CCE is going to be far more efficient than =
scanning=20
rowsets on your own. Other than this I honestly can't say =
which is=20
'best' as it depends on what your intended use of the copied rowset =
actually=20
is. In fact what is a better solution than both of these is =
if you=20
don't actually need a 'copy' of the rowset and can simply get away =
with=20
applying filters to the original and keeping hold of the chapter =
handles for=20
later use. I do this frequently.</SPAN></FONT></DIV>
<P><FONT face=3DArial size=3D2>Mark</FONT> <BR><FONT face=3DArial=20
=
size=3D2>--------------------------------------------------------------<=
/FONT>=20
<BR><FONT face=3DArial size=3D2>Mark Dawson =
([email protected])</FONT>=20
<BR><FONT face=3DArial size=3D2>Software Project Leader</FONT> =
<BR><FONT=20
face=3DArial size=3D2>SRH Systems Ltd.</FONT> <BR><FONT =
face=3DArial=20
size=3D2>Lowesmoor Wharf, Worcester.</FONT> <BR><FONT face=3DArial =
size=3D2>WR1=20
2RS. UK</FONT> <BR><FONT face=3DArial size=3D2>+44 (0)1905 =
613361</FONT> </P>
<BLOCKQUOTE>
<DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> Alan Gamboa=20
[mailto:[email protected]]<BR><B>Sent:</B> 03 February 2003=20
15:32<BR><B>To:</B> =
[email protected]<BR><B>Subject:</B>=20
[OLEDB_DEV] Rowsets<BR><BR></DIV></FONT>
<P><FONT size=3D2>I have a query:</FONT> </P>
<P> <FONT =
size=3D2>select f1,f2,f3=20
from t1 where f1 =3D 1</FONT> </P>
<P><FONT size=3D2>this query returns a rowset of 50 =
records.</FONT> </P>
<P><FONT size=3D2>I want create a new rowset that contains some =
of the=20
records in the above rowset, what is the best way to do =
this?</FONT> </P>
<P><FONT size=3D2>thanks.</FONT> </P>
<P><FONT size=3D2>Alan Gamboa</FONT> <BR><FONT size=3D2>CCG =
Systems,=20
Inc.</FONT> </P>You can read messages from the OLEDB_DEV archive, =
unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor =
lists at=20
http://discuss.develop.com.=20
=
<BR>____________________________________________________________________=
____<BR>This=20
email has been scanned for all viruses by the MessageLabs=20
SkyScan<BR>service. For more information on a proactive =
anti-virus service=20
working<BR>around the clock, around the globe, visit=20
=
http://www.messagelabs.com<BR>__________________________________________=
______________________________<BR></BLOCKQUOTE><BR>_____________________=
___________________________________________________<BR>This=20
email has been scanned for all viruses by the MessageLabs=20
SkyScan<BR>service. For more information on a proactive anti-virus =
service=20
working<BR>around the clock, around the globe, visit=20
=
http://www.messagelabs.com<BR>__________________________________________=
______________________________<BR>You=20
can read messages from the OLEDB_DEV archive, unsubscribe from =
OLEDB_DEV, or=20
subscribe to other DevelopMentor lists at =
http://discuss.develop.com.=20
</BLOCKQUOTE>You can read messages from the OLEDB_DEV archive, =
unsubscribe=20
from OLEDB_DEV, or subscribe to other DevelopMentor lists at=20
http://discuss.develop.com.=20
=
<BR>____________________________________________________________________=
____<BR>This=20
email has been scanned for all viruses by the MessageLabs =
SkyScan<BR>service.=20
For more information on a proactive anti-virus service =
working<BR>around the=20
clock, around the globe, visit=20
=
http://www.messagelabs.com<BR>__________________________________________=
______________________________<BR></BLOCKQUOTE></BODY></HTML>
<HTML><BODY><BR>
________________________________________________________________________<B=
R>
This=20email=20has=20been=20scanned=20for=20all=20viruses=20by=20the=20Mes=
sageLabs=20SkyScan<BR>
service.=20For=20more=20information=20on=20a=20proactive=20anti-virus=20se=
rvice=20working<BR>
around=20the=20clock,=20around=20the=20globe,=20visit=20http://www.message=
labs.com<BR>
________________________________________________________________________<B=
R>
</BODY></HTML>
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.
------ =_NextPart_001_01C2CC66.6ED27714--