Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/class_c_sql_example.html
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 6 43e37759235e
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TB9.2 Example Applications: CSqlExample Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="contents">
<h1>CSqlExample Class Reference</h1><!-- doxytag: class="CSqlExample" -->
<p><a href="class_c_sql_example-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#a81cffca804968549ed3523230f28408f">~CSqlExample</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#af0523fb9c7a711a2c7745e8d2e96faa7">CreateNonSecureDBL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#a2d2358e96bba71900cedd067fe44192b">CreateAndOpenSecureDBL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#a1a6247133748297a2a8877381583e51c">CopyDatabaseL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#adf02168d537e9e1650d5f379522a6b2e">AttachDatabasesL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#a49067abc75f826bfd43be44c07460c7b">DataTypesQueryL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#a7fac459ccd95278c1af4eb50e5453812">ScalarFullSelectL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#a12e036a57115aceb1c64545fc9dee052">ColumnBinaryStreamL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8c17fed004a0fcb1453325f45219e82d"></a><!-- doxytag: member="CSqlExample::DeleteL" ref="a8c17fed004a0fcb1453325f45219e82d" args="()" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>DeleteL</b> ()</td></tr>
<tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="class_c_sql_example.html">CSqlExample</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sql_example.html#a8b115210a3fbfa19de5c7f6a0abf3e43">NewLC</a> ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Demonstrates some uses of the Symbian platform SQL component.</p>
<p>The class demonstrates how to</p>
<ul>
<li>Create and open secure and non secure databases</li>
<li>Copy a database</li>
<li>Attach two databases together</li>
<li>Execute a simple query (RSqlDatabase::Exec)</li>
<li>Prepare and execute a query with parameters (RSqlStatement)</li>
<li>Prepare and execute a query with a large parameter, writing that parameter using streaming (RParamWriteStream)</li>
<li>Prepare and execute a query which returns data, and read that data</li>
<li>Prepare and execute a query which returns data, and read that data using streaming (RColumnReadStream)</li>
<li>Query for a single value (TSqlScalarFullSelectQuery) </li>
</ul>

<p>Definition at line <a class="el" href="sqlexample_8h_source.html#l00040">40</a> of file <a class="el" href="sqlexample_8h_source.html">sqlexample.h</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a81cffca804968549ed3523230f28408f"></a><!-- doxytag: member="CSqlExample::~CSqlExample" ref="a81cffca804968549ed3523230f28408f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CSqlExample::~CSqlExample </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Destructor </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00086">86</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a8b115210a3fbfa19de5c7f6a0abf3e43"></a><!-- doxytag: member="CSqlExample::NewLC" ref="a8b115210a3fbfa19de5c7f6a0abf3e43" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_c_sql_example.html">CSqlExample</a> * CSqlExample::NewLC </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Allocates and constructs a <a class="el" href="class_c_sql_example.html">CSqlExample</a> object and leaves it on the cleanup stack. Initialises all member data to their default values. </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00061">61</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="af0523fb9c7a711a2c7745e8d2e96faa7"></a><!-- doxytag: member="CSqlExample::CreateNonSecureDBL" ref="af0523fb9c7a711a2c7745e8d2e96faa7" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSqlExample::CreateNonSecureDBL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates a non secure database, which has a table with two integers, and closes it. It is deleted at a later point of time after the copy operation.  KErrNotFound, KErrAbort, KErrPermissionDenied, KErrArgument, system-wide error codes. </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00100">100</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a2d2358e96bba71900cedd067fe44192b"></a><!-- doxytag: member="CSqlExample::CreateAndOpenSecureDBL" ref="a2d2358e96bba71900cedd067fe44192b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSqlExample::CreateAndOpenSecureDBL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates a secure database with a table and a certain security policy. Inserts a record, opens it and closes the database. The database is reopened later and hence not deleted here.  KErrNone, KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00127">127</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a1a6247133748297a2a8877381583e51c"></a><!-- doxytag: member="CSqlExample::CopyDatabaseL" ref="a1a6247133748297a2a8877381583e51c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSqlExample::CopyDatabaseL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Essentially a file copy to allow users to copy a database from one file to another. SQL provides a mechanism to copy secure databases, (which live in the SQL private datacage) as a user is not allowed to do that. The source database is then deleted after copying it to the destination.  KErrAbort, KErrPermissionDenied, KErrArgument, system-wide error codes. </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00171">171</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="adf02168d537e9e1650d5f379522a6b2e"></a><!-- doxytag: member="CSqlExample::AttachDatabasesL" ref="adf02168d537e9e1650d5f379522a6b2e" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSqlExample::AttachDatabasesL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Opens a secure database and attaches a non secure database to it. Database has to be open before an attach can be executed.  KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00217">217</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a49067abc75f826bfd43be44c07460c7b"></a><!-- doxytag: member="CSqlExample::DataTypesQueryL" ref="a49067abc75f826bfd43be44c07460c7b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSqlExample::DataTypesQueryL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Prepares and executes both a simple query and a query with parameters.  KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes. </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00257">257</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a7fac459ccd95278c1af4eb50e5453812"></a><!-- doxytag: member="CSqlExample::ScalarFullSelectL" ref="a7fac459ccd95278c1af4eb50e5453812" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSqlExample::ScalarFullSelectL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>1) Prepares and executes a query with a large parameter, writing that parameter using streaming (RParamWriteStream) 2) Creates a database with a table containing integer, 64-bit integer, float, text and Blob fields. 3) Inserts two records. 4) Implements TSqlScalarFullSelectQuery functions for 64 bit integer and text fields and checks the returned value.  KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00328">328</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a12e036a57115aceb1c64545fc9dee052"></a><!-- doxytag: member="CSqlExample::ColumnBinaryStreamL" ref="a12e036a57115aceb1c64545fc9dee052" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSqlExample::ColumnBinaryStreamL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Prepare and execute a query which returns data, and read that data using streaming (RColumnReadStream)  KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes. </p>

<p>Definition at line <a class="el" href="sqlexample_8cpp_source.html#l00447">447</a> of file <a class="el" href="sqlexample_8cpp_source.html">sqlexample.cpp</a>.</p>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>