Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_d_b_m_s_engine_8h_source.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: examples/ForumNokia/DBMS/inc/DBMSEngine.h Source File</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 -->
<h1>examples/ForumNokia/DBMS/inc/DBMSEngine.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright © 2008 Nokia Corporation.</span>
<a name="l00003"></a>00003 <span class="comment"> */</span>
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="preprocessor">#ifndef __BOOKDBENGINE_H__</span>
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define __BOOKDBENGINE_H__</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;e32std.h&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;badesca.h&gt;</span>    <span class="comment">// CDesCArrayFlat (cannot be forward declarated)</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;d32dbms.h&gt;</span>    <span class="comment">// RDbStoreDatabase</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;f32file.h&gt;</span>    <span class="comment">// RFs</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="comment">// Forward declarations</span>
<a name="l00016"></a>00016 <span class="keyword">class </span>CFileStore;
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="comment">// Constants</span>
<a name="l00019"></a>00019 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KBooksTable, <span class="stringliteral">&quot;Books&quot;</span>);                <span class="comment">/* Name of the one table       */</span>
<a name="l00020"></a>00020 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KBooksAuthorCol, <span class="stringliteral">&quot;Author&quot;</span>);           <span class="comment">/* First column                */</span>
<a name="l00021"></a>00021 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KBooksTitleCol, <span class="stringliteral">&quot;Title&quot;</span>);             <span class="comment">/* Second column               */</span>
<a name="l00022"></a>00022 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KBooksDescriptionCol, <span class="stringliteral">&quot;Description&quot;</span>); <span class="comment">/* Third column                */</span>
<a name="l00023"></a>00023 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KBooksDateCol,<span class="stringliteral">&quot;PublishDate&quot;</span>);         <span class="comment">/* Dynamic optional column     */</span>
<a name="l00024"></a>00024 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KBooksIndexName,<span class="stringliteral">&quot;BooksIndex&quot;</span>);        <span class="comment">/* Name of the one index       */</span>
<a name="l00025"></a>00025 <span class="keyword">const</span> <span class="keywordtype">int</span> KTitleMaxLength = 60;            <span class="comment">/* Max length of title column  */</span>
<a name="l00026"></a>00026 <span class="keyword">const</span> <span class="keywordtype">int</span> KDescriptionMaxLength = 128;     <span class="comment">/* Max length of descr. column */</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 
<a name="l00033"></a>00033 <span class="keyword">const</span> <span class="keywordtype">int</span> KBookItemMaxLength = 256;
<a name="l00034"></a>00034 
<a name="l00039"></a>00039 <a class="code" href="secureclientandserver_8h.html#a5eadd4429627d82193b37536d4faa03a">_LIT</a>(KSeparator,<span class="stringliteral">&quot;|&quot;</span>);
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 
<a name="l00074"></a><a class="code" href="class_c_book_db.html">00074</a> <span class="keyword">class </span><a class="code" href="class_c_book_db.html">CBookDb</a> : <span class="keyword">public</span> CBase
<a name="l00075"></a>00075     {
<a name="l00076"></a>00076 <span class="keyword">public</span>: <span class="comment">// Creation and destruction</span>
<a name="l00077"></a>00077 
<a name="l00083"></a>00083     <span class="keyword">static</span> <a class="code" href="class_c_book_db.html">CBookDb</a>* <a class="code" href="class_c_book_db.html#a87b80f9d2487d6ad27c109293c7d6bdd">NewL</a>();
<a name="l00084"></a>00084 
<a name="l00090"></a>00090     <a class="code" href="class_c_book_db.html#a1cff43523b8c167b07ab7cd530f06cf2">~CBookDb</a>();
<a name="l00091"></a>00091 
<a name="l00092"></a>00092 
<a name="l00093"></a>00093 <span class="keyword">public</span>: <span class="comment">// Public API for database operations</span>
<a name="l00094"></a>00094 
<a name="l00110"></a>00110     TInt <a class="code" href="class_c_book_db.html#adad67a3cd76d53b953e568e6800d39fa">OpenDb</a>(<span class="keyword">const</span> TFileName&amp; aExistingBookFile);
<a name="l00111"></a>00111 
<a name="l00130"></a>00130     TInt <a class="code" href="class_c_book_db.html#a63294e77864336caff068a0d8328084c">CreateDb</a>(<span class="keyword">const</span> TFileName&amp; aNewBookFile);
<a name="l00131"></a>00131 
<a name="l00145"></a>00145     TInt <a class="code" href="class_c_book_db.html#a2a68483e682d42b6cbde02dc2abaf7b1">RemoveDb</a>(<span class="keyword">const</span> TFileName&amp; aExistingBookFile);
<a name="l00146"></a>00146 
<a name="l00157"></a>00157     TInt <a class="code" href="class_c_book_db.html#a3487424c728056eb2a95b0108dd46473">Close</a>();
<a name="l00158"></a>00158 
<a name="l00165"></a>00165     TBool <a class="code" href="class_c_book_db.html#adf1b55c6f6f22739b4546dd180f39967">IsOpen</a>() <span class="keyword">const</span>;
<a name="l00166"></a>00166 
<a name="l00183"></a>00183     TInt <a class="code" href="class_c_book_db.html#a3137b55dcff9d2135230a40211321476">AddBookWithSql</a>(<span class="keyword">const</span> TDesC&amp; aAuthor,
<a name="l00184"></a>00184                          <span class="keyword">const</span> TDesC&amp; aTitle,
<a name="l00185"></a>00185                          <span class="keyword">const</span> TDesC&amp; aDescription);
<a name="l00186"></a>00186 
<a name="l00203"></a>00203     TInt <a class="code" href="class_c_book_db.html#aef6806bae5307151073caedaea88e81f">AddBookWithCppApiL</a>(<span class="keyword">const</span> TDesC&amp; aAuthor,
<a name="l00204"></a>00204                             <span class="keyword">const</span> TDesC&amp; aTitle,
<a name="l00205"></a>00205                             <span class="keyword">const</span> TDesC&amp; aDescription);
<a name="l00206"></a>00206 
<a name="l00217"></a>00217     CDesCArrayFlat* <a class="code" href="class_c_book_db.html#a748adb83e450c321b2c9af57eaf029e4">GetAllBooksL</a>();
<a name="l00218"></a>00218 
<a name="l00235"></a>00235     CDesCArrayFlat* <a class="code" href="class_c_book_db.html#a6b153d0c0eb9d365b1163ec1301be78e">GetBooksByKeyL</a>(<span class="keyword">const</span> TDesC&amp; aColumnName,
<a name="l00236"></a>00236         <span class="keyword">const</span> TDesC&amp; aSearchString);
<a name="l00237"></a>00237 
<a name="l00252"></a>00252     TInt <a class="code" href="class_c_book_db.html#a3f4fd01c0f549c6c564955f2faa6ee62">GetABookFast</a>(<span class="keyword">const</span> TDesC&amp; aTitle, TDes&amp; aResult);
<a name="l00253"></a>00253 
<a name="l00267"></a>00267     TInt <a class="code" href="class_c_book_db.html#ac4a202bf6ebb76155ef0dc65ece5a386">RemoveBooks</a>(<span class="keyword">const</span> TDesC&amp; aTitle, TInt&amp; aResultCount);
<a name="l00268"></a>00268 
<a name="l00278"></a>00278     TInt <a class="code" href="class_c_book_db.html#a96f6946ac8885c20f831300cbf0d55b0">RemoveAllBooks</a>(TInt&amp; aResultCount);
<a name="l00279"></a>00279 
<a name="l00280"></a>00280 
<a name="l00293"></a>00293     TInt <a class="code" href="class_c_book_db.html#a558090a1a44e419fd420f7113e80b310">UpdateBookTitle</a>(<span class="keyword">const</span> TDesC&amp; aOldTitleKey, <span class="keyword">const</span> TDesC&amp; aNewTitle);
<a name="l00294"></a>00294 
<a name="l00295"></a>00295 
<a name="l00296"></a>00296 
<a name="l00307"></a>00307     CDesCArrayFlat* <a class="code" href="class_c_book_db.html#a5f13ae296de4d79beed916a416e67530">ColumnNamesAndSizesL</a>();
<a name="l00308"></a>00308 
<a name="l00316"></a>00316     TInt <a class="code" href="class_c_book_db.html#a60d34d3250835e8341808b33d09733bc">HasDateColumn</a>(TBool&amp; aReturnValue);
<a name="l00317"></a>00317 
<a name="l00327"></a>00327     TInt <a class="code" href="class_c_book_db.html#a72ca4025b97842c2e743b93cbf2b013a">AddDateColumn</a>();
<a name="l00328"></a>00328 
<a name="l00338"></a>00338     TInt <a class="code" href="class_c_book_db.html#a470d106d843cea950d8c5bb8ccfeb122">RemoveDateColumn</a>();
<a name="l00339"></a>00339 
<a name="l00340"></a>00340 <span class="keyword">private</span>: <span class="comment">// Construction</span>
<a name="l00341"></a>00341 
<a name="l00348"></a>00348     <span class="keywordtype">void</span> ConstructL();
<a name="l00349"></a>00349 
<a name="l00355"></a>00355     <a class="code" href="class_c_book_db.html">CBookDb</a>();
<a name="l00356"></a>00356 
<a name="l00357"></a>00357 <span class="keyword">private</span>: <span class="comment">// Helpers</span>
<a name="l00358"></a>00358 
<a name="l00359"></a>00359     <span class="keywordtype">void</span> CreateBooksTableL();     <span class="comment">/* Create the Books table                  */</span>
<a name="l00360"></a>00360     <span class="keywordtype">void</span> CreateBooksIndexL();     <span class="comment">/* Create the BooksIndex for Books table   */</span>
<a name="l00361"></a>00361     <span class="keywordtype">void</span> DropBooksTable();       <span class="comment">/* Drop Books table (DDL example)          */</span>
<a name="l00362"></a>00362 
<a name="l00363"></a>00363 <span class="keyword">private</span>: <span class="comment">// Member data</span>
<a name="l00364"></a>00364 
<a name="l00365"></a>00365     RFs              iFsSession;  <span class="comment">/* For use of iFileStore                   */</span>
<a name="l00366"></a>00366     RDbStoreDatabase iBookDb;<span class="comment">/* For database operations                 */</span>
<a name="l00367"></a>00367     CFileStore*      iFileStore;  <span class="comment">/* For creating and opening database files */</span>
<a name="l00368"></a>00368     TBool            iOpen;       <span class="comment">/* Flag indicating iBookDb open status*/</span>
<a name="l00369"></a>00369     };
<a name="l00370"></a>00370 
<a name="l00371"></a>00371 <span class="preprocessor">#endif // __BOOKDBENGINE_H__</span>
<a name="l00372"></a>00372 <span class="preprocessor"></span>
<a name="l00373"></a>00373 
</pre></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>