Symbian3/PDK/Source/GUID-B61EA8C5-0966-51DE-AC73-01DD34C7D3CC.dita
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
child 14 578be2adaf3e
equal deleted inserted replaced
4:4816d766a08a 5:f345bda72bc4
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept xml:lang="en" id="GUID-B61EA8C5-0966-51DE-AC73-01DD34C7D3CC"><title>Deleting Rows from a Table</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial describes how to delete rows from a database table. </p> <section><title>Introduction</title> <p>The deletion of a record from a database can be performed by executing the <codeph>DELETE</codeph> SQL statement. The query does not pass or return any data. </p> </section> <section><title>Basic procedure</title> <ul><li id="GUID-9C914C4E-72E0-5115-8C66-BE37C6DBD21A"><p>Configure the SQL statement </p> </li> <li id="GUID-6CA0261D-EE6B-53B5-921C-163AB03F0D04"><p>Execute the statement. </p> </li> </ul> </section> <section><title>Detailed steps</title> <p><b>Configure the SQL statement</b> </p> <p>Create a literal for your <codeph>DELETE</codeph> statement. You do not need to create a <xref href="GUID-0176BF07-DF94-3259-8F90-DE030E35CE9A.dita"><apiname>RSqlStatement</apiname></xref> object to run a <codeph>DELETE</codeph> statement. You need to just execute the query with the <xref href="GUID-4688F6B7-E1B0-37CF-BAA2-C6BD103D4FDF.dita"><apiname>RSqlDatabase</apiname></xref> object, which has its own <xref href="GUID-4688F6B7-E1B0-37CF-BAA2-C6BD103D4FDF.dita#GUID-4688F6B7-E1B0-37CF-BAA2-C6BD103D4FDF/GUID-6D2120DC-C193-3E2E-A802-B4CD180BDF11"><apiname>RSqlDatabase::Exec()</apiname></xref> function taking a query string as its parameter. </p> <codeblock id="GUID-16ECCA77-5B8D-5D64-AFF0-ED634323C1DD" xml:space="preserve">_LIT(kQueryString,"DELETE FROM countries WHERE population &lt; 2;"); 
    12 <concept id="GUID-B61EA8C5-0966-51DE-AC73-01DD34C7D3CC" xml:lang="en"><title>Deleting
    13 </codeblock> <p> <b>NOTE :</b> It is possible to call a <codeph>DELETE</codeph> statement from an <xref href="GUID-0176BF07-DF94-3259-8F90-DE030E35CE9A.dita"><apiname>RSqlStatement</apiname></xref> object, but it is computationally more expensive and you are recommended not to do so. </p> <p><b>Execute the statement</b> </p> <p>Execute the <codeph>DELETE</codeph> statement. This code assumes that the <codeph>countriesDatabase</codeph> object is open. </p> <codeblock id="GUID-E247DCDC-8EAA-5543-AB4C-C938CEAA51FB" xml:space="preserve">countriesDatabase.Exec(kQueryString);</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>Deleting Rows from a Table - This document </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> <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>
    13 Rows from a Table</title><shortdesc>This tutorial describes how to delete rows from a database table. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <section id="GUID-C621392D-0382-4F37-8A9E-01DD884A40C1"><title>Introduction</title> <p>The deletion of a record from a database
       
    15 can be performed by executing the <codeph>DELETE</codeph> SQL statement. The
       
    16 query does not pass or return any data. </p> </section>
       
    17 <section id="GUID-F6B8AD97-4118-414C-9A1C-CD8C0738731A"><title>Basic procedure</title> <ul>
       
    18 <li id="GUID-9C914C4E-72E0-5115-8C66-BE37C6DBD21A"><p>Configure the SQL statement </p> </li>
       
    19 <li id="GUID-6CA0261D-EE6B-53B5-921C-163AB03F0D04"><p>Execute the statement. </p> </li>
       
    20 </ul> </section>
       
    21 <section id="GUID-A578F91F-797E-4A43-A8A4-82CD416BB471"><title>Detailed steps</title> <p><b>Configure
       
    22 the SQL statement</b> </p> <p>Create a literal for your <codeph>DELETE</codeph> statement.
       
    23 You do not need to create a <xref href="GUID-0176BF07-DF94-3259-8F90-DE030E35CE9A.dita"><apiname>RSqlStatement</apiname></xref> object to run
       
    24 a <codeph>DELETE</codeph> statement. You need to just execute the query with
       
    25 the <xref href="GUID-4688F6B7-E1B0-37CF-BAA2-C6BD103D4FDF.dita"><apiname>RSqlDatabase</apiname></xref> object, which has its own <xref href="GUID-4688F6B7-E1B0-37CF-BAA2-C6BD103D4FDF.dita#GUID-4688F6B7-E1B0-37CF-BAA2-C6BD103D4FDF/GUID-6D2120DC-C193-3E2E-A802-B4CD180BDF11"><apiname>RSqlDatabase::Exec()</apiname></xref> function
       
    26 taking a query string as its parameter. </p> <codeblock id="GUID-16ECCA77-5B8D-5D64-AFF0-ED634323C1DD" xml:space="preserve">_LIT(kQueryString,"DELETE FROM countries WHERE population &lt; 2;"); 
       
    27 </codeblock> <p> <b>NOTE :</b> It is possible to call a <codeph>DELETE</codeph> statement
       
    28 from an <xref href="GUID-0176BF07-DF94-3259-8F90-DE030E35CE9A.dita"><apiname>RSqlStatement</apiname></xref> object, but it is computationally
       
    29 more expensive and you are recommended not to do so. </p> <p><b>Execute the statement</b> </p> <p>Execute the <codeph>DELETE</codeph> statement.
       
    30 This code assumes that the <codeph>countriesDatabase</codeph> object is open. </p> <codeblock id="GUID-E247DCDC-8EAA-5543-AB4C-C938CEAA51FB" xml:space="preserve">countriesDatabase.Exec(kQueryString);</codeblock> </section>
       
    31 <section id="GUID-B884F66D-1000-426D-850A-49CF5966F4AD"><title>See also</title> <p> <xref href="GUID-C60DAE3D-7FB9-5619-9E5D-476A430705AF.dita">Querying
       
    32 a Database</xref>  </p> <p> <xref href="GUID-CCB9C61B-FB28-5CD9-A366-4A9584097897.dita">Inserting
       
    33 a Row into a Table</xref>  </p> <p>Deleting Rows from a Table - This document </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> <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>
       
    34 </conbody></concept>