Re: Rowsets

Mark Dawson <[email protected]> Tue, 4 Feb 2003 09:24:05 -0000
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <090ED6DFF3D5D611A81400508B8B5A3F0C3576@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_01C2CC2F.2C99AF16
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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=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_01C2CC2F.2C99AF16
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=20
class=3D643571609-04022003>Alan,</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D643571609-04022003>Off=20
the top of my head I can think of 2 ways of doing =
this.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D643571609-04022003>The=20
first is to use ADO to build a new recordset that matches the original; =
copy=20
accross the data and then grab hold of the Recordset objects internal =
Rowset=20
pointer.&nbsp; This gives you a Client Cursor Engine Rowset that =
contains the=20
data you requested.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D643571609-04022003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D643571609-04022003>The=20
second it to write yourself a Rowset object using the ATL templates =
that does=20
effectively the same thing: you give your rowset class a pointer to =
another=20
rowset which it copies the column definitions of.&nbsp; You could also =
have this=20
rowset initialise itself with the data you want populated by applying a =
filter=20
to the rowset beforehand and passing the chapter handle to the =
initialisation=20
routine (assuming the&nbsp;records you want _can_ be filtered out and =
that=20
you're using a source rowset that supports =
filters).</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D643571609-04022003>Both=20
methods are relatively simple to do, but can be quite time consuming =
with large=20
data sets.&nbsp; Obviously in this case, applying filters in CCE is =
going to be=20
far more efficient than scanning rowsets on your own.&nbsp; Other than =
this I=20
honestly can't say which is 'best' as it depends on what your intended =
use of=20
the copied rowset actually is.&nbsp; In fact what is a better solution =
than both=20
of these is if you don't actually need a 'copy' of the rowset and can =
simply get=20
away with applying filters to the original and keeping hold of the =
chapter=20
handles for later use.&nbsp; 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 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> 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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 records=20
  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, =
Inc.</FONT>=20
  </P>You can read messages from the OLEDB_DEV archive, unsubscribe =
from=20
  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_01C2CC2F.2C99AF16--