Symbian3/SDK/Source/GUID-B9A3B17E-BDEB-5F66-968C-080335A721AC.dita
changeset 7 51a74ef9ed63
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-B9A3B17E-BDEB-5F66-968C-080335A721AC.dita	Wed Mar 31 11:11:55 2010 +0100
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-B9A3B17E-BDEB-5F66-968C-080335A721AC" xml:lang="en"><title>Writing
+from a Data Stream</title><shortdesc>This tutorial describes how to write data from a data stream to
+a database. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
+<section id="GUID-76439F61-1909-4A9A-8CC9-B47E4424025C"><title>Introduction</title> <p>This is useful when populating your
+database with the results of some other operation. </p> </section>
+<section id="GUID-91278D72-532F-4F5D-8601-7FDB848E1D27"><title>Basic procedure</title> <p>The high level steps to write from
+a data stream to a database table are shown here: </p> <ol id="GUID-FDE9AAB3-C033-5700-B173-75F229BFA230">
+<li id="GUID-117F41A0-B71D-5327-A053-F9C458636D48"><p>Instantiate the necessary
+objects. </p> </li>
+<li id="GUID-6999251A-C025-5F3C-AEEF-B9FBED0C5AF5"><p>Write data into the
+table. </p> </li>
+<li id="GUID-4E8B4501-9EAF-5B31-8C6D-6D28BAB82445"><p>Commit the stream. </p> </li>
+</ol> </section>
+<section id="GUID-DF93842E-37AF-4A3F-A252-39E3EA905922"><title>Writing from a data stream into a table</title> <p>The process
+of writing data from a data stream into a table can be explained as follows: </p> <p><b> Instantiate the necessary objects</b> </p> <ol id="GUID-9EDAB491-57F6-59E9-A7FA-ADB5F1E7E8F7">
+<li id="GUID-C21DE9E5-6A8D-5B18-9D95-D978BC1ABF20"><p>Instantiate an object
+of the <xref href="GUID-0176BF07-DF94-3259-8F90-DE030E35CE9A.dita"><apiname>RSqlStatement</apiname></xref> and <xref href="GUID-6313887C-8DE0-3702-BF4B-0622BAB2EE8E.dita"><apiname>RSqlParamWriteStream</apiname></xref> class.
+Also declare the variables as shown. </p> <codeblock id="GUID-83A9423B-4CC6-5965-B25A-01748EFA85C8" xml:space="preserve">RSqlStatement myStatement;
+TInt err;
+TInt myParameterIndex;
+RSqlParamWriteStream myStream;
+RBuf buf;
+</codeblock> </li>
+<li id="GUID-5C911C98-E0DB-5DE8-9FDB-A154F6C4746E"><p>Clean up the stack. </p> <codeblock id="GUID-F5445748-B8A6-50F5-9066-ECFC2CC8A866" xml:space="preserve">CleanupClosePushL(myStream);</codeblock> </li>
+</ol> <p><b> Write
+data into the table</b> </p> <ol id="GUID-0AA1F57B-13A2-5E13-8D42-7B0A4FE6F36B">
+<li id="GUID-38F8CC09-123A-59B5-B51B-01AD770A4F19"><p>Obtain access to the
+data as a stream of characters. </p> <codeblock id="GUID-61291241-3C46-5624-A355-FA370B3142D0" xml:space="preserve">User::LeaveIfErrormyStream.BindTextL(myStatement,myParameterIndex));</codeblock> </li>
+<li id="GUID-C5D72E6D-935B-5708-B05F-24F1C3B3FFE1"><p>Write the buffer. </p> <codeblock id="GUID-92F8A3E8-D0F6-5065-9983-64453465BF18" xml:space="preserve">myStream.WriteL(buf);</codeblock> </li>
+</ol> <p><b> Commit
+the stream</b> </p> <p>Commit the stream. This ensures that the streamed data
+is written into the table and cannot be rolled back. </p> <codeblock id="GUID-426B03C1-A1DE-5D03-92B5-C79C3BD0ADA9" xml:space="preserve">myStream.CommitL();</codeblock> </section>
+<section id="GUID-AEF1E047-3F45-4707-9A2A-1F0F4D6EB632"><title>See also</title> <p> <xref href="GUID-C60DAE3D-7FB9-5619-9E5D-476A430705AF.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-B61EA8C5-0966-51DE-AC73-01DD34C7D3CC.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> <xref href="GUID-183280EE-0C57-54FE-8ABB-E1CC3BDE525B.dita">Reading
+to a Data Stream</xref>  </p> <p>Writing from a Data Stream - This document </p> <p> <xref href="GUID-C474376E-1766-5781-B5BF-3786C5B4D72E.dita">Performing Scalar Queries</xref>  </p> </section>
+</conbody></concept>
\ No newline at end of file