Symbian3/PDK/Source/GUID-3CCA6503-54DA-5558-85DC-93A22A81F565.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-3CCA6503-54DA-5558-85DC-93A22A81F565" xml:lang="en"><title>Reading
       
    13 to Memory</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>This tutorial describes how to copy data from the table to a memory location. </p>
       
    15 <section><title>Introduction</title> <p>You can avoid making a local copy
       
    16 of the data by directly writing the retrieved data into a memory location.
       
    17 This can be achieved by copying to an object of the <xref href="GUID-5CD07A27-E3ED-3273-A560-680501468C91.dita"><apiname>TPtrC</apiname></xref> class.
       
    18 For more details on copying data to a buffer see <xref href="GUID-72511204-FC90-54AA-9E2E-833318020318.dita">Reading
       
    19 to a Buffer</xref>. </p> </section>
       
    20 <section><title>Basic procedure</title> <p>The high level steps to copy the
       
    21 data retrieved from a table to a memory location are shown below: </p> <ol id="GUID-E2B78DD5-841E-526B-A6BE-C8ACCF79FA6D">
       
    22 <li id="GUID-7F20C95F-0225-58A9-92EE-86DF83AD9C2B"><p>Configure your SQL statement. </p> </li>
       
    23 <li id="GUID-F4A653E4-571E-52D0-960E-98B995666B75"><p>Copy to memory. </p> </li>
       
    24 </ol> </section>
       
    25 <section><title>Detailed steps</title> <p><b>Configure your SQL statement</b> </p> <p>Instantiate
       
    26 an object of the <xref href="GUID-0176BF07-DF94-3259-8F90-DE030E35CE9A.dita"><apiname>RSqlStatement</apiname></xref> class and declare the required
       
    27 variables as shown. </p> <codeblock id="GUID-188E5840-729F-5F63-9498-086B8EE5C6D3" xml:space="preserve">RSqlStatement myStatement;
       
    28 TInt err;</codeblock> <p><b>Copy to memory</b> </p><p>To retrieve all the
       
    29 entries, use a loop.
       
    30 </p><p/><p>1.                Instantiate an object of the <xref href="GUID-E884CBEB-A5B5-308E-8E88-9A1543184899.dita"><apiname>TPtrc</apiname></xref> class.
       
    31 This object may be used to reference constant strings or data. </p><codeblock xml:space="preserve">...
       
    32 while((err = myStatement.Next()) == KSqlAtRow)
       
    33     	{
       
    34     	TPtrC myData;
       
    35  		TInt err;
       
    36 	</codeblock><p>2               Read the data into the specified memory location..</p><codeblock xml:space="preserve"> 		err = myStatement.ColumnBinary(myColumnIndex,myData);
       
    37  		// process data
       
    38  		}</codeblock> </section>
       
    39 <section><title>See also</title> <p> <xref href="GUID-F36E5978-29FC-57E8-8A45-2003E7767193.dita">Querying
       
    40 a Database</xref>  </p> <p> <xref href="GUID-CCB9C61B-FB28-5CD9-A366-4A9584097897.dita">Inserting
       
    41 a Row into a Table</xref>  </p> <p> <xref href="GUID-3ACF6C11-A9CC-517C-8C7D-578F41F3DDF7.dita">Deleting
       
    42 Rows from a Table</xref>  </p> <p> <xref href="GUID-72511204-FC90-54AA-9E2E-833318020318.dita">Reading
       
    43 to a Buffer</xref>  </p> <p>Reading to memory - This document </p> <p> <xref href="GUID-183280EE-0C57-54FE-8ABB-E1CC3BDE525B.dita">Reading to a Data Stream</xref>  </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>
       
    44 </conbody></concept>