javaextensions/iapinfo/inc.s60/javacommdb.h
branchRCL_3
changeset 14 04becd199f91
child 25 ae942d28ec0e
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  JavaCommDB definition
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef JAVACOMMDB_H
       
    20 #define JAVACOMMDB_H
       
    21 
       
    22 #include <commsdattypesv1_1.h>
       
    23 #include <commsdat.h>
       
    24 #include <metadatabase.h>
       
    25 #include "com_nokia_mid_iapinfo_CommsTable.h"
       
    26 
       
    27 using namespace CommsDat;
       
    28 
       
    29 /**
       
    30  *  Class implements the native part of Java CommDB API.
       
    31  *
       
    32  *  @lib j9_23_commdb.lib
       
    33  *  @since S60 v3.0
       
    34  */
       
    35 class JavaCommDB
       
    36 //:
       
    37 //    public CJavaPeer<JavaCommDB>
       
    38 
       
    39 {
       
    40 
       
    41 public:
       
    42 
       
    43     ~ JavaCommDB();
       
    44 
       
    45     /**
       
    46      * Opens the given table.
       
    47      * @since S60 v3.0
       
    48      * @param aTablename name of the CommDB table to be opened
       
    49      * @return error code
       
    50      */
       
    51     void OpenL(const TDesC&);
       
    52 
       
    53     /**
       
    54      * Close the table and delete allocated member objects.
       
    55      * @since S60 v3.0
       
    56      * @return error code
       
    57      */
       
    58     TInt Close();
       
    59 
       
    60     /**
       
    61      * Get number of records in the current table.
       
    62      * @since S60 v3.0
       
    63      * @return record count
       
    64      */
       
    65     TInt GetRecordCount();
       
    66 
       
    67     /**
       
    68      * Retrieves the value of the given field from the actual record.
       
    69      * The field contains integer type value.
       
    70      * @since S60 v3.0
       
    71      * @param aFieldName name of the field.
       
    72      * @return integer value of the field
       
    73      */
       
    74     TInt GetIntFieldValueL(const TDesC& aFieldName);
       
    75 
       
    76     /**
       
    77      * Retrieves the value of the given field from the actual record.
       
    78      * The field contains string type value.
       
    79      * @since S60 v3.0
       
    80      * @param aFieldName name of the field.
       
    81      * @return String value of the field
       
    82      */
       
    83     HBufC* GetStringFieldValueL(const TDesC& aFieldName);
       
    84 
       
    85     /**
       
    86      * Moves the actual record pointer to the next record.
       
    87      * @since S60 v3.0
       
    88      * @return number of the actual record
       
    89      */
       
    90     TInt Next();
       
    91 
       
    92     /**
       
    93      * Moves the actual record pointer to the previous record.
       
    94      * @since S60 v3.0
       
    95      * @return number of the actual record
       
    96      */
       
    97     TInt Previous();
       
    98 
       
    99     /**
       
   100      * Finds a record in the current table by its name.
       
   101      * The search is case sensitive.
       
   102      * If the record exists the current record will be changed to this record.
       
   103      * @since S60 v3.0
       
   104      * @param aFieldName name of the record
       
   105      * @return with the RecordId of the found record, KErrNotFound if no record found with the given name.
       
   106      */
       
   107     TInt FindByNameL(const TDesC& aFieldName);
       
   108 
       
   109     /**
       
   110      * Finds a record in the current table by its RecordId. If the record exists
       
   111      * the current record will be changed to this record.
       
   112      * @since S60 v3.0
       
   113      * @param aId RecordId of the record
       
   114      * @return with the RecordId of the found record, KErrNotFound if no record found with the given RecordId.
       
   115      */
       
   116     TInt FindById(TInt aId);
       
   117 
       
   118 private:
       
   119 
       
   120     /**
       
   121      * Stores the number of the current record.
       
   122      */
       
   123     TInt iCurrentRecord;
       
   124 
       
   125     /**
       
   126      * Pointer to the actual DB Session object.
       
   127      * Initialized in the Open() function.
       
   128      */
       
   129     CMDBSession* iDb;
       
   130 
       
   131     /**
       
   132      * Pointer to the current RecordSet object.
       
   133      * Initialized in the Open() function.
       
   134      */
       
   135     CMDBRecordSet<CCDRecordBase>* iTable;
       
   136 };
       
   137 
       
   138 #endif // JAVACOMMDB_H
       
   139