Symbian3/PDK/Source/GUID-183280EE-0C57-54FE-8ABB-E1CC3BDE525B.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 14 578be2adaf3e
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     6
<!-- Initial Contributors:
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     7
    Nokia Corporation - initial contribution.
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     8
Contributors: 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     9
-->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    10
<!DOCTYPE concept
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    12
<concept xml:lang="en" id="GUID-183280EE-0C57-54FE-8ABB-E1CC3BDE525B"><title>Reading to a Data Stream</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial describes how to copy data from a database into a data stream. </p> <section><title>Introduction</title> <p>You can read data from the table into a data stream in one chunk or in bits as desired. </p> </section> <section><title>Basic procedure</title> <p>The high level steps to read the data into a data stream are shown here: </p> <ol id="GUID-E30DA5B1-CC4E-59CD-ADF0-8C8A36BB5F3F"><li id="GUID-61A9000A-4915-51DF-9F85-8D99BDF5B526"><p>Configure your SQL statement and data stream. </p> </li> <li id="GUID-63659491-43A0-5020-9A95-F41124A14D5B"><p>Read data to a stream. </p> </li> <li id="GUID-750CC613-90F8-5832-B75D-28B7EC00A1D0"><p>Clean up. </p> </li> </ol> </section> <section><title>Detailed steps</title> <p>To read the data into a data stream, do the following: </p> <p><b>Configure your SQL statement and data stream</b> </p> <ol id="GUID-DBC563EC-623B-547A-B3F8-56AF2CAF9A40"><li id="GUID-2206671E-AA58-561D-ACA9-4636DE315D72"><p>As a first step instantiate an object of the <xref href="GUID-0176BF07-DF94-3259-8F90-DE030E35CE9A.dita"><apiname>RSqlStatement</apiname></xref> and <xref href="GUID-35BF7B4A-C4F7-3215-B5DF-6D0682247976.dita"><apiname>RSqlColumnReadStream</apiname></xref> class. Also declare the variables as required. </p> <codeblock id="GUID-B752FF8C-23C3-564D-ADEE-29110F302E0B" xml:space="preserve">RSqlStatement myStatement;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    13
TInt err;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    14
TInt myColumnIndex;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    15
RSqlColumnReadStream myStream;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    16
</codeblock> </li> <li id="GUID-E5804513-1415-57F8-8672-A37E5510D749"><p>Clean up the stack. </p> <codeblock id="GUID-5EE16CEF-EFA0-5502-A6E8-4B79902FCE08" xml:space="preserve">CleanupClosePushL(myStream);</codeblock> </li> </ol> <p><b>Read data to a stream</b> </p> <ol id="GUID-0F218E4B-5A86-5F4B-A9E3-E9269FB35337"><li id="GUID-8B1F5CBB-98EC-541C-8808-3CF0A81FABFF"><p>Open the stream for read and associate the data with it. </p> <codeblock id="GUID-216077E0-F2C9-5933-8A19-EBCD7BDE65CC" xml:space="preserve">User::LeaveIfError(myStream.ColumnBinary(myStatement,myColumnIndex));</codeblock> </li> <li id="GUID-CD79E4F4-3EE4-54F9-BB8A-C37C5BC22FDB"><p>Determine the column size. </p> <codeblock id="GUID-B0D283A9-B8E7-560E-80CA-13E8DB845BA7" xml:space="preserve">TInt size = myStatement.ColumnSize(myColumnIndex);</codeblock> </li> <li id="GUID-0DFC9A61-78CA-5FB3-B949-01CB10B5D3B0"><p>Instantiate an object of the <xref href="GUID-BFBC574B-EFF6-37A4-9189-B71DA1505BC8.dita"><apiname>RBuf</apiname></xref> class. Create a buffer of the size of the column. Then read the data into the buffer. </p> <codeblock id="GUID-6BBE596B-7C9B-540B-966D-90547E4ACDD8" xml:space="preserve">RBuf buf;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    17
        buf.CreateL(size);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    18
        CleanupClosePushL(buf);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    19
        myStream.ReadL(buf,size);
1
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    20
</codeblock> </li> <li id="GUID-526F67C0-B219-509A-8B4F-328527C3984F"><p>Close the buffer. </p> <codeblock id="GUID-9D50E196-598F-51CC-B3D8-830E26C1B2B6" xml:space="preserve">CleanupStack::PopAndDestroy();</codeblock> </li> </ol> <p><b> Clean up</b> </p> <p>Close the stream. </p> <codeblock id="GUID-EF2E397B-7176-58CE-B577-011A0DB7191D" xml:space="preserve">CleanupStack::PopAndDestroy();</codeblock> </section> <section><title>See also</title> <p> <xref href="GUID-F36E5978-29FC-57E8-8A45-2003E7767193.dita">Querying a Database</xref>  </p> <p> <xref href="GUID-CCB9C61B-FB28-5CD9-A366-4A9584097897.dita">Inserting a Row into a Table</xref>  </p> <p> <xref href="GUID-3ACF6C11-A9CC-517C-8C7D-578F41F3DDF7.dita">Deleting Rows from a Table</xref>  </p> <p> <xref href="GUID-72511204-FC90-54AA-9E2E-833318020318.dita">Reading to a Buffer</xref>  </p> <p> <xref href="GUID-3CCA6503-54DA-5558-85DC-93A22A81F565.dita"> Reading to Memory </xref>  </p> <p>Reading to a Data Stream - This document </p> <p> <xref href="GUID-B9A3B17E-BDEB-5F66-968C-080335A721AC.dita">Writing to a Data Stream</xref>  </p> <p> <xref href="GUID-C474376E-1766-5781-B5BF-3786C5B4D72E.dita">Performing Scalar Queries</xref>  </p> </section> </conbody></concept>