commsconfig/commsdatabaseshim/commdbshim/SCDB/CDBDATA.CPP
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Table definitions and CCommsDatabase definitions
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @deprecated since v9.1. Functionality is replaced with commsdat.
       
    21 */
       
    22 
       
    23 #include <e32math.h>
       
    24 #include <f32file.h>
       
    25 #include <cdbpreftable.h>
       
    26 #include <e32property.h>
       
    27 #include "CDBSTD.H"
       
    28 #include "Commsdat_Log.h"
       
    29 #include "commdb_impl.H"
       
    30 #include <commsdattypesv1_1.h>
       
    31 #include <commsdat_partner.h>
       
    32 #include <commsdatutils.h>
       
    33 
       
    34 using namespace CommsDat;
       
    35 using namespace CommsDatUtils;
       
    36 
       
    37 const TInt KGlobalSettingsRecordID = 1;
       
    38 
       
    39 // TCommDbPublishSubscribeNotification definitions
       
    40 CCommsDatabaseBase::
       
    41 			TCommDbPublishSubscribeNotification::TCommDbPublishSubscribeNotification()
       
    42 	: iUid(KNullUid), iValue(0)
       
    43 /**
       
    44 Default Constructor for the publish and susbcribe notificaton which initialises the Uid to zero.
       
    45 */
       
    46 	{
       
    47 	}
       
    48 
       
    49 
       
    50 void CCommsDatabaseBase::
       
    51 			TCommDbPublishSubscribeNotification::Set(TUid aUid,TInt aVal)
       
    52 /**
       
    53 Sets the given values of aUid and aVal to the members iUid and aVal.
       
    54 
       
    55 @param aUid UID to be set
       
    56 @param aVal Value to be set
       
    57 */
       
    58 	{
       
    59 	iUid=aUid;
       
    60 	iValue=aVal;
       
    61 	}
       
    62 
       
    63 // TCommDbSystemAgentNotification definitions
       
    64 // we still support this class from 9.0 onwards, but to work with pubsub its initialisation
       
    65 // changes
       
    66 CCommsDatabaseBase::
       
    67 			TCommDbSystemAgentNotification::TCommDbSystemAgentNotification()
       
    68 	: iUid(KNullUid), iValue(0)
       
    69 /**
       
    70 Default Constructor for the publish and subscribe notification with the old System Agent
       
    71 name for compatibility which initialises the Uid to zero.
       
    72 */
       
    73 	{
       
    74 	}
       
    75 
       
    76 void CCommsDatabaseBase::
       
    77 			TCommDbSystemAgentNotification::Set(TUid aUid,TInt aVal)
       
    78 /**
       
    79 Sets the given values of aUid and aVal to the members iUid and aVal.
       
    80 
       
    81 @param aUid UID to be set
       
    82 @param aVal Value to be set
       
    83 */
       
    84 	{
       
    85 	iUid=aUid;
       
    86 	iValue=aVal;
       
    87 	}
       
    88 // CCommsDatabaseBase definitions
       
    89 EXPORT_C CCommsDatabaseBase::CCommsDatabaseBase():	iImplNotCreated(EFalse)
       
    90 /** Default constructor for internal use only. */
       
    91 	{
       
    92 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabaseBase::CCommsDatabaseBase()"));
       
    93 	TRAPD(err,iImpl = new(ELeave) CCommsDatabaseImpl());
       
    94 	if(err != KErrNone)
       
    95 		{
       
    96 		iImplNotCreated = ETrue;
       
    97 		__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("Creation of implementation class for CCommsDatabaseBase faild with Err:%d"),err);
       
    98 		}
       
    99 	}
       
   100 
       
   101 EXPORT_C CCommsDatabaseBase::~CCommsDatabaseBase()
       
   102 	{
       
   103 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabaseBase::~CCommsDatabaseBase()"));
       
   104 	delete iImpl;
       
   105 	}
       
   106 
       
   107 EXPORT_C TVersion CCommsDatabaseBase::Version() const
       
   108 /** Gets the version from CommsDat.
       
   109 
       
   110 @return The object containing the version information. */
       
   111 	{
       
   112 	if (iImplNotCreated)
       
   113 		{
       
   114 		__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("Warning!!! - > Implementation object is not created at this point"));
       
   115 		// return the most likely value
       
   116 		return KCDVersion1_1;
       
   117 		}
       
   118 
       
   119 	TVersion versionInUse;
       
   120 
       
   121 	versionInUse = iImpl->iDbs->VersionInUse();
       
   122 
       
   123 	__FLOG_STMT(TPtrC name = versionInUse.Name();)
       
   124 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("Version() - > Version Number %S"), &name);
       
   125 
       
   126 	return versionInUse;
       
   127 	}
       
   128 
       
   129 EXPORT_C TInt CCommsDatabaseBase::BeginTransaction()
       
   130 /** Marks the start of a transaction and gets a shared read-lock on the database.
       
   131 Other clients of the database can concurrently acquire a shared read-lock
       
   132 but no client can gain an exclusive write-lock until this transaction (and
       
   133 any transaction started by other clients) completes as a result of a call
       
   134 to either CommitTransaction() or RollbackTransaction().
       
   135 
       
   136 A transaction consists of one or more record updates and/or insertions and/or
       
   137 deletions. The process of making changes to records within a view is part
       
   138 of CCommsDbTableView behaviour.
       
   139 
       
   140 @see CCommsDbTableView::InsertRecord(), CCommsDbTableView::UpdateRecord(),
       
   141 CCommsDbTableView::DeleteRecord(), CCommsDbTableView::PutRecordChanges()
       
   142 and CCommsDbTableView::CancelRecordChanges().
       
   143 
       
   144 @return KErrNone if the database has been successfully locked; the transaction
       
   145 can start. KErrLocked if another client already has an exclusive write-lock
       
   146 on the database.
       
   147 @capability Dependent on table, see the guide page referenced below. */
       
   148 	{
       
   149 	if(iImplNotCreated)
       
   150 		{
       
   151 		return KErrNoMemory;
       
   152 		}
       
   153 
       
   154 	TRAPD(err, iImpl->iDbs->OpenTransactionL());
       
   155 
       
   156 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("BeginTransaction Err:%d"),err);
       
   157 	return err;
       
   158 	}
       
   159 
       
   160 EXPORT_C TInt CCommsDatabaseBase::CommitTransaction()
       
   161 /** Marks the end of a transaction and commits any changes made since the start
       
   162 of the transaction. The client's shared read-lock is removed if no write operations
       
   163 were performed, or the exclusive write-lock is removed if write operations
       
   164 were performed.
       
   165 
       
   166 @return KErrNone if successful, otherwise another of the system-wide error
       
   167 codes.
       
   168 @capability Dependent on table, see the guide page referenced below. */
       
   169 	{
       
   170 	if(iImplNotCreated)
       
   171 		{
       
   172 		return KErrNoMemory;
       
   173 		}
       
   174 
       
   175 	TInt i(0);
       
   176 	TInt err(KErrNone);
       
   177 
       
   178 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CommitTransaction Entry Point"));
       
   179 
       
   180 	TRAP(err, iImpl->iDbs->CommitTransactionL());
       
   181 
       
   182     if(err == KErrNone)
       
   183         {
       
   184         // update client side transaction logic in views
       
   185         TInt count = iImpl->iTableViews.Count();
       
   186         
       
   187         for(i=0;i<count;++i)
       
   188             {
       
   189             iImpl->iTableViews[i]->iTableExt->CommitTransaction();
       
   190             }
       
   191 
       
   192         count = iImpl->iConnPrefViews.Count();
       
   193         for(i=0;i<count;++i)
       
   194             {
       
   195             iImpl->iConnPrefViews[i]->iTableExt->CommitTransaction();
       
   196             }
       
   197 
       
   198         }
       
   199 
       
   200 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CommitTransaction Err:%d"),err);
       
   201 
       
   202 	return err;
       
   203 	}
       
   204 
       
   205 EXPORT_C void CCommsDatabaseBase::RollbackTransaction()
       
   206 /** Marks the end of a transaction and abandons any changes made since the start
       
   207 of the transaction. The database is, in effect, rolled back to the state it
       
   208 was in at the beginning of the transaction. The client's shared read-lock
       
   209 is removed if no write operations were performed, or the exclusive write-lock
       
   210 is removed if write operations were performed.
       
   211 @capability Dependent on table, see the guide page referenced below. */
       
   212 	{
       
   213 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("RollbackTransaction Entry Point"));
       
   214 
       
   215 	TInt err(KErrNone);
       
   216 
       
   217 	if(iImplNotCreated)
       
   218 		{
       
   219 		return;
       
   220 		}
       
   221 
       
   222     TRAP(err, iImpl->iDbs->RollbackTransactionL());
       
   223     if (err != KErrNone)
       
   224         {
       
   225         __FLOG_STATIC1(KLogComponent, KCommDbShim, _L("RollbackTransaction failed in commsdat Err:%d"),err);
       
   226         }
       
   227 
       
   228 		// update client side transaction logic in views
       
   229 		TInt count = iImpl->iTableViews.Count();
       
   230 		TInt i;
       
   231 		for(i=0;i<count;++i)
       
   232 			{
       
   233 			iImpl->iTableViews[i]->iTableExt->RollBackTransaction();
       
   234 			}
       
   235 
       
   236 		count = iImpl->iConnPrefViews.Count();
       
   237 		for(i=0;i<count;++i)
       
   238 			{
       
   239 			iImpl->iConnPrefViews[i]->iTableExt->RollBackTransaction();
       
   240 			}
       
   241 
       
   242     }
       
   243 
       
   244 EXPORT_C TBool CCommsDatabaseBase::InTransaction()
       
   245 /** Tests whether a transaction is in progress, i.e. whether a call to BeginTransaction()
       
   246 has been called.
       
   247 
       
   248 @return ETrue if a transaction is in progress (BeginTransaction() has been called but not
       
   249 CommitTransaction() or RollbackTransaction()); EFalse otherwise. */
       
   250 	{
       
   251 	if(iImplNotCreated)
       
   252 		{
       
   253 		return EFalse;
       
   254 		}
       
   255 
       
   256 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("InTransaction"));
       
   257 	return iImpl->iDbs->IsInTransaction();
       
   258 	}
       
   259 
       
   260 EXPORT_C TBool CCommsDatabaseBase::IsDatabaseWriteLockedL()
       
   261 /** Tests if the database is write locked.
       
   262 
       
   263 Tries to open a transaction from another client.
       
   264 
       
   265 @note Calling InTransaction() is not enough because if the transaction is automatic rather than
       
   266 explicit, this will still return EFalse.
       
   267 
       
   268 @return ETrue if the database is write locked, EFalse if not. */
       
   269 	{
       
   270 	if(iImplNotCreated)
       
   271 		{
       
   272 		User::Leave(KErrNoMemory);
       
   273 		}
       
   274 
       
   275 	TBool result = iImpl->iDbs->IsInTransaction();
       
   276 
       
   277 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("IsDatabaseWriteLockedL -> Result:%b"), result);
       
   278 
       
   279 	return result;
       
   280 	}
       
   281 
       
   282 EXPORT_C void CCommsDatabaseBase::ShowHiddenRecords()
       
   283 /** Ensures that hidden records are included in the search criteria when creating
       
   284 views using the member functions:
       
   285 
       
   286 OpenTableLC()
       
   287 
       
   288 OpenViewMatchingUintLC()
       
   289 
       
   290 OpenViewMatchingBoolLC()
       
   291 
       
   292 OpenViewMatchingTextLC()
       
   293 @capability Dependent on table, see the guide page referenced below. */
       
   294 	{
       
   295 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("ShowHiddenRecords"));
       
   296 	iShowHiddenRecords = ETrue;
       
   297 	// Set mask for hidden Attribute on CommsDat session
       
   298     iImpl->iDbs->SetAttributeMask(ECDHidden);
       
   299 	}
       
   300 
       
   301 EXPORT_C TInt CCommsDatabaseBase::RequestNotification(TRequestStatus& aStatus)
       
   302 /** Requests notification when any change is made to the database, whether by this
       
   303 client or any other.
       
   304 
       
   305 (If the notifier is not successfully opened the function simply returns an error
       
   306 code and none of the following applies).
       
   307 
       
   308 When any change is made to the database the outstanding notification request
       
   309 completes and TRequestStatus contains a value indicating what type of change
       
   310 has occurred. The value is one of the enumerators of the RDbNotifier::TEvent
       
   311 enumeration.
       
   312 
       
   313 Alternatively, if an outstanding notification request is cancelled by a call
       
   314 to this CCommsDatabase's CancelRequestNotification() member function, then
       
   315 the request completes with aStatus set to KErrCancel.
       
   316 
       
   317 An outstanding notification request is also cancelled if the connection to
       
   318 the DBMS is severed through a call to DoClose().
       
   319 
       
   320 This is an asynchonous request.
       
   321 
       
   322 @param aStatus A reference to the request status object. If the request is
       
   323 cancelled, this is set to KErrCancel. If the request completes normally, this
       
   324 is set to one of the enumerators of the RDbNotifier::TEvent enumeration.
       
   325 @return Any error from opening the notifier: KErrNone if successful, otherwise
       
   326 another of the system-wide error codes. */
       
   327 	{
       
   328 	if(iImplNotCreated)
       
   329 		{
       
   330 		return KErrNoMemory;
       
   331 		}
       
   332 
       
   333 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabaseBase::RequestNotification(TRequestStatus& aStatus)"));
       
   334 
       
   335 	return iImpl->RequestNotification(aStatus);
       
   336 	}
       
   337 
       
   338 EXPORT_C void CCommsDatabaseBase::CancelRequestNotification()
       
   339 /** Cancels an outstanding request for notification of changes to the communications
       
   340 database.
       
   341 
       
   342 An outstanding request completes with KErrCancel. */
       
   343 	{
       
   344 	if(iImplNotCreated)
       
   345 		{
       
   346 		return;
       
   347 		}
       
   348 
       
   349 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabaseBase::CancelRequestNotification()"));
       
   350 	
       
   351 	iImpl->CancelRequestNotification();
       
   352 	}
       
   353 
       
   354 EXPORT_C CCommsDbTableView* CCommsDatabaseBase::OpenTableLC(const TDesC& aTableName)
       
   355 /** Fills the container with all records from table and returns a pointer to view class. The view
       
   356 excludes hidden records, unless access to them has previously been explicitly
       
   357 requested by calling the ShowHiddenRecords() member function of this object.
       
   358 
       
   359 If the process is succesful, the function constructs and returns a pointer
       
   360 to a CCommsDbTableView object which encapsulates the information on that view.
       
   361 The pointer is also put onto the cleanup stack.
       
   362 
       
   363 @param aTableName A reference to a descriptor containing the name of the table
       
   364 in the communications database to be opened.
       
   365 @return A pointer to the view object.
       
   366 @capability Dependent on table, see the guide page referenced below. */
       
   367 	{
       
   368 	if(iImplNotCreated)
       
   369 		{
       
   370 		User::Leave(KErrNoMemory);
       
   371 		}
       
   372 
       
   373 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabaseBase::OpenTableLC Entry Point"));
       
   374 
       
   375 	CCommsDbTableView* tableView = CCommsDbTableView::NewLC(*this, aTableName);
       
   376     tableView->iTableExt->SetShowHiddenRecords(iShowHiddenRecords);
       
   377 
       
   378 	__FLOG_STATIC2(KLogComponent, KCommDbShim, _L("CCommsDatabaseBase::OpenTableLC -> TableName=%S, Hidden=%b"), &aTableName, iShowHiddenRecords);
       
   379 
       
   380 	return tableView;
       
   381 	}
       
   382 
       
   383 EXPORT_C CCommsDbTableView* CCommsDatabaseBase::OpenViewLC(const TDesC& /*aTableName*/,const TDesC& /*aSqlQuery*/)
       
   384 /**
       
   385 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
   386 
       
   387 @param aTableName A reference to a descriptor containing the name of a table
       
   388 in the communications database.
       
   389 @param aSqlQuery A reference to a descriptor containing the SQL query text.
       
   390 @return A pointer to the view object.
       
   391 @capability Dependent on table, see the guide page referenced below. */
       
   392 	{
       
   393 	User::Leave(KErrNotSupported);
       
   394 	return NULL;
       
   395 	}
       
   396 
       
   397 EXPORT_C CCommsDbTableView* CCommsDatabaseBase::OpenViewMatchingUintLC(const TDesC& aTableName,
       
   398 																	const TDesC& aColumnToMatch,
       
   399 																	TUint32 aValueToMatch)
       
   400 /** Opens a view onto a specified table based on a matching unsigned integer value,
       
   401 and returns a pointer to that view. The view includes all those records where
       
   402 the column, identified by aColumnToMatch, matches the unsigned integer value
       
   403 aValueToMatch.
       
   404 
       
   405 The view excludes hidden records, unless access to them has previously been
       
   406 explicitly requested by calling the ShowHiddenRecords() member function of
       
   407 this object.
       
   408 
       
   409 If the open process is succesful, the function constructs and returns a pointer
       
   410 to a CCommsDbTableView object which encapsulates the information on that view.
       
   411 The pointer is also put onto the cleanup stack.
       
   412 
       
   413 @param aTableName A reference to a descriptor containing the name of the table
       
   414 in the communications database on which a view is to be opened.
       
   415 @param aColumnToMatch A reference to a descriptor containing the name of the
       
   416 column to be used in the selection process.
       
   417 @param aValueToMatch The value to be matched with the content of column aColumnToMatch.
       
   418 
       
   419 @return A pointer to the view object.
       
   420 @capability Dependent on table, see the guide page referenced below. */
       
   421 	{
       
   422 	if(iImplNotCreated)
       
   423 		{
       
   424 		User::Leave(KErrNoMemory);
       
   425 		}
       
   426 
       
   427 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("OpenViewMatchingUintLC Entry Point"));
       
   428 	CCommsDbTableView* table = DoOpenViewMatchingUintL(aTableName,aColumnToMatch,aValueToMatch,iShowHiddenRecords);
       
   429 	CleanupStack::PushL(table);
       
   430 	return table;
       
   431 	}
       
   432 
       
   433 EXPORT_C CCommsDbTableView* CCommsDatabaseBase::OpenViewMatchingBoolLC(const TDesC& aTableName,
       
   434 																	const TDesC& aColumnToMatch,
       
   435 																	TBool aValueToMatch)
       
   436 /** Opens a view onto a specified table based on a matching boolean value, and
       
   437 returns a pointer to that view. The view includes all those records where
       
   438 the column, identified by aColumnToMatch, matches the boolean value aValueToMatch.
       
   439 
       
   440 The view excludes hidden records, unless access to them has previously been
       
   441 explicitly requested by calling the ShowHiddenRecords() member function.
       
   442 
       
   443 If the open process is successful, the function constructs and returns a pointer
       
   444 to a CCommsDbTableView object which encapsulates the information on that view.
       
   445 The pointer is also put onto the cleanup stack.
       
   446 
       
   447 @param aTableName A reference to a descriptor containing the name of the table of
       
   448 interest in the communications database.
       
   449 @param aColumnToMatch A reference to a descriptor containing the name of the
       
   450 column to be used in the selection process.
       
   451 @param aValueToMatch The value to be matched with the content of column aColumnToMatch.
       
   452 
       
   453 @return A pointer to the view object.
       
   454 @capability Dependent on table, see the guide page referenced below. */
       
   455 	{
       
   456 	if(iImplNotCreated)
       
   457 		{
       
   458 		User::Leave(KErrNoMemory);
       
   459 		}
       
   460 
       
   461 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("OpenViewMatchingBoolLC Entry Point"));
       
   462 	// create table
       
   463 	CCommsDbTableView* tableView = CCommsDbTableView::NewLC(*this, aTableName, aColumnToMatch, aValueToMatch);
       
   464 
       
   465 	__FLOG_STATIC3(KLogComponent, KCommDbShim, _L("OpenViewMatchingBoolLC -> TableName:%S, Column Name:%S, MatchingValue:%b"),
       
   466 					&aTableName, &aColumnToMatch, aValueToMatch);
       
   467 
       
   468 	return tableView;
       
   469 	}
       
   470 
       
   471 EXPORT_C CCommsDbTableView* CCommsDatabaseBase::OpenViewMatchingTextLC(const TDesC& aTableName,
       
   472 																	const TDesC& aColumnToMatch,
       
   473 																	const TDesC8& aValueToMatch)
       
   474 /** Opens a view onto a specified table based on a matching 8 bit text type, and
       
   475 returns a pointer to that view.
       
   476 
       
   477 The view includes all those records where the column, identified by aColumnToMatch,
       
   478 matches the narrow text supplied in the descriptor aValueToMatch.
       
   479 
       
   480 The view excludes hidden records, unless access to them has previously been
       
   481 explicitly requested by calling the ShowHiddenRecords() member function of
       
   482 this object.
       
   483 
       
   484 If the open process is succesful, the function constructs and returns a pointer
       
   485 to a CCommsDbTableView object which encapsulates the information on that view.
       
   486 The pointer is also put onto the cleanup stack.
       
   487 
       
   488 @param aTableName A reference to a descriptor containing the name of a table
       
   489 in the communications database.
       
   490 @param aColumnToMatch A reference to a descriptor containing the name of the
       
   491 column to be used in the selection process.
       
   492 @param aValueToMatch The narrow (ASCII) text to be matched with the content
       
   493 of column aColumnToMatch.
       
   494 @return A pointer to the view object.
       
   495 @capability Dependent on table, see the guide page referenced below. */
       
   496 	{
       
   497 	if(iImplNotCreated)
       
   498 		{
       
   499 		User::Leave(KErrNoMemory);
       
   500 		}
       
   501 
       
   502 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("OpenViewMatchingTextLC Entry Point"));
       
   503 	CCommsDbTableView* table = DoOpenViewMatchingTextL(aTableName,aColumnToMatch,aValueToMatch,iShowHiddenRecords);
       
   504 	CleanupStack::PushL(table);
       
   505 	return table;
       
   506 	}
       
   507 
       
   508 EXPORT_C CCommsDbTableView* CCommsDatabaseBase::OpenViewMatchingTextLC(const TDesC& aTableName,
       
   509 																	const TDesC& aColumnToMatch,
       
   510 																	const TDesC16& aValueToMatch)
       
   511 /** Opens a view onto a specified table based on a matching 16 bit text type, and
       
   512 returns a pointer to that view. The view includes all those records where
       
   513 the column, identified by aColumnToMatch, matches the wide text supplied in
       
   514 the descriptor aValueToMatch.
       
   515 
       
   516 The view excludes hidden records, unless access to them has previously been
       
   517 explicitly requested by calling the ShowHiddenRecords() member function of
       
   518 this object.
       
   519 
       
   520 If the open process is successful, the function constructs and returns a pointer
       
   521 to a CCommsDbTableView object which encapsulates the information on that view.
       
   522 The pointer is also put onto the cleanup stack.
       
   523 
       
   524 @param aTableName A reference to a descriptor containing the name of a table
       
   525 in the communications database.
       
   526 @param aColumnToMatch A reference to a descriptor containing the name of the
       
   527 column to be used in the selection process.
       
   528 @param aValueToMatch The wide (UNICODE) text to be matched with the content
       
   529 of column aColumnToMatch.
       
   530 @return A pointer to the view object.
       
   531 @capability Dependent on table, see the guide page referenced below. */
       
   532 	{
       
   533 	if(iImplNotCreated)
       
   534 		{
       
   535 		User::Leave(KErrNoMemory);
       
   536 		}
       
   537 
       
   538 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("OpenViewMatchingTextLC16 Entry Point"));
       
   539 	CCommsDbTableView* table = DoOpenViewMatchingTextL(aTableName,aColumnToMatch,aValueToMatch,iShowHiddenRecords);
       
   540 	CleanupStack::PushL(table);
       
   541 	return table;
       
   542 	}
       
   543 void CCommsDatabaseBase::DatabaseUpdateHasOccurred()
       
   544 /**
       
   545 Sets the flag to signal that a successful update has occurred
       
   546 */
       
   547 	{
       
   548 	}
       
   549 
       
   550 void CCommsDatabaseBase::DoClose()
       
   551 /**
       
   552 Close the database and close the notifier and the server
       
   553 */
       
   554 	{
       
   555 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("DoClose Entry Point"));
       
   556 	if(iImpl)
       
   557 		{
       
   558 		iImpl->iDbs->Close();
       
   559 		}
       
   560 	}
       
   561 
       
   562 CCommsDbTableView*	CCommsDatabaseBase::DoOpenViewMatchingUintL(const TDesC& aTableName,
       
   563 														const TDesC& aColumnToMatch,
       
   564 														TUint32 aValueToMatch,
       
   565 														TBool aIncludeHiddenRecords)
       
   566 /**
       
   567 Opens a view on the table aTableName containing all records where
       
   568 aColumnToMatch contains aValueToMatch
       
   569 
       
   570 @param aTableName A reference to a descriptor containing the name of a table in the communications database.
       
   571 @param aColumnToMatch A reference to a descriptor containing the name of a column in table aTableName.
       
   572 @param aValueToMatch  reference to an unsigned integer passed by the caller.
       
   573 @param includeHiddenRecords A boolean variable whether to include hidden records or not
       
   574 @return Pointer to CCommsDbTableView
       
   575 */
       
   576 	{
       
   577 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("DoOpenViewMatchingUintL Entry Point"));
       
   578 	CCommsDbTableView* tableView = CCommsDbTableView::NewL(*this, aTableName, aColumnToMatch, aValueToMatch);
       
   579 
       
   580     if(aIncludeHiddenRecords)
       
   581         {
       
   582         ShowHiddenRecords();
       
   583 	    tableView->iTableExt->SetShowHiddenRecords(iShowHiddenRecords);
       
   584         }
       
   585 
       
   586 	__FLOG_STATIC4(KLogComponent, KCommDbShim, _L("DoOpenViewMatchingUintL -> TableName:%S, ColumnName:%S, MatchingValue:%d Hidden:%b"), &aTableName, &aColumnToMatch, aValueToMatch,aIncludeHiddenRecords);
       
   587 
       
   588 	return tableView;
       
   589 	}
       
   590 
       
   591 CCommsDbTableView*	CCommsDatabaseBase::DoOpenViewMatchingTextL(const TDesC& aTableName,
       
   592 															const TDesC& aColumnToMatch,
       
   593 															const TDesC8& aValueToMatch,
       
   594 															TBool aIncludeHiddenRecords)
       
   595 /**
       
   596 Opens a view on the table aTableName containing all records where
       
   597 aColumnToMatch contains aValueToMatch
       
   598 
       
   599 @param aTableName A reference to a descriptor containing the name of a table in the communications database.
       
   600 @param aColumnToMatch A reference to a descriptor containing the name of a column in table aTableName.
       
   601 @param aValueToMatch  reference to an unsigned integer passed by the caller.
       
   602 @param includeHiddenRecords A boolean variable whether to include hidden records or not
       
   603 @return Pointer to CCommsDbTableView
       
   604 */
       
   605 	{
       
   606 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("DoOpenViewMatchingTextL Entry Point"));
       
   607 	CCommsDbTableView* tableView = CCommsDbTableView::NewL(*this, aTableName, aColumnToMatch, aValueToMatch);
       
   608 
       
   609     if(aIncludeHiddenRecords)
       
   610         {
       
   611         ShowHiddenRecords();
       
   612 	    tableView->iTableExt->SetShowHiddenRecords(iShowHiddenRecords);
       
   613         }
       
   614 
       
   615 	__FLOG_STATIC3(KLogComponent, KCommDbShim, _L("DoOpenViewMatchingTextL -> TableName:%S, ColumnName:%S, Hidden:%b"), &aTableName, &aColumnToMatch,aIncludeHiddenRecords);
       
   616 
       
   617 	return tableView;
       
   618 	}
       
   619 
       
   620 CCommsDbTableView*	CCommsDatabaseBase::DoOpenViewMatchingTextL(const TDesC& aTableName,
       
   621 															const TDesC& aColumnToMatch,
       
   622 															const TDesC16& aValueToMatch,
       
   623 															TBool aIncludeHiddenRecords)
       
   624 /**
       
   625 Opens a view on the table aTableName containing all records where
       
   626 aColumnToMatch contains aValueToMatch
       
   627 
       
   628 @param aTableName A reference to a descriptor containing the name of a table in the communications database.
       
   629 @param aColumnToMatch A reference to a descriptor containing the name of a column in table aTableName.
       
   630 @param aValueToMatch  reference to an unsigned integer passed by the caller.
       
   631 @param includeHiddenRecords A boolean variable whether to include hidden records or not
       
   632 @return Pointer to CCommsDbTableView
       
   633 */
       
   634 	{
       
   635 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("DoOpenViewMatchingTextL16 Entry Point"));
       
   636 	CCommsDbTableView* tableView = CCommsDbTableView::NewL(*this, aTableName, aColumnToMatch, aValueToMatch);
       
   637 
       
   638     if(aIncludeHiddenRecords)
       
   639         {
       
   640         ShowHiddenRecords();
       
   641 	    tableView->iTableExt->SetShowHiddenRecords(iShowHiddenRecords);
       
   642         }
       
   643 
       
   644 	__FLOG_STATIC4(KLogComponent, KCommDbShim, _L("DoOpenViewMatchingTextL -> TableName:%S, ColumnName:%S, MatchingValue:%S Hidden:%b"), &aTableName, &aColumnToMatch, &aValueToMatch, aIncludeHiddenRecords);
       
   645 
       
   646 	return tableView;
       
   647 	}
       
   648 
       
   649 CCommsDbTableView* CCommsDatabaseBase::DoOpenTableViewL(const TDesC& /*aTableName*/,const TDesC& /*aSqlQuery*/)
       
   650 /**
       
   651 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
   652 
       
   653 @param aTableName A reference to a descriptor containing the name of a table in the communications database.
       
   654 @param aSqlQuery A reference to a descriptor containing the SQL query text
       
   655 @return Pointer to CCommsDbTableView
       
   656 */
       
   657 	{
       
   658 	User::Leave(KErrNotSupported);
       
   659 	return NULL;
       
   660 	}
       
   661 
       
   662 CCommsDbTableView* CCommsDatabaseBase::DoOpenIAPTableViewL(const TDesC& /*aTableName*/,const TDesC& /*aSqlQuery*/)
       
   663 /**
       
   664 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
   665 
       
   666 @param aTableName A reference to a descriptor containing the name of a table in the communications database.
       
   667 @param aSqlQuery A reference to a descriptor containing the SQL query text
       
   668 @return Pointer to CCommsDbTableView
       
   669 */
       
   670 	{
       
   671 	User::Leave(KErrNotSupported);
       
   672 	return NULL;
       
   673 	}
       
   674 
       
   675 void CCommsDatabaseBase::BeginInternalTransactionL()
       
   676 /**
       
   677 Lock the database for internal use - begin a transaction if we can!
       
   678 */
       
   679     {
       
   680     __FLOG_STATIC0(KLogComponent, KCommDbShim, _L("BeginInternalTransaction() Entry Point"));
       
   681     if (!InTransaction() && !IsDatabaseWriteLockedL())
       
   682         {
       
   683         TInt ret = BeginTransaction();
       
   684         if (ret == KErrNone)
       
   685             {
       
   686             iInInternalTransaction = ETrue;
       
   687             __FLOG_STATIC0(KLogComponent, KCommDbShim, _L("BeginInternalTransaction()"));
       
   688             }
       
   689         else
       
   690             {
       
   691             iInInternalTransaction = EFalse;
       
   692             User::Leave(ret);
       
   693             }
       
   694         }
       
   695     }
       
   696 
       
   697 TInt CCommsDatabaseBase::CommitInternalTransaction()
       
   698 /**
       
   699 Unlocks the database from internal use - end a transaction.
       
   700 If the commit fails then do the rollback.
       
   701 
       
   702 @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   703 */
       
   704     {
       
   705     __FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CommitInternalTransaction() Entry Point"));
       
   706     TInt ret = KErrNone;
       
   707     if (iInInternalTransaction)
       
   708         {
       
   709         ret = CommitTransaction();
       
   710         iInInternalTransaction = EFalse;
       
   711         if (ret != KErrNone)
       
   712             {
       
   713             RollbackTransaction();
       
   714             }
       
   715         else
       
   716             {
       
   717             __FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CommitInternalTransaction()"));
       
   718             }
       
   719         }
       
   720     return ret;
       
   721     }
       
   722 
       
   723 void CCommsDatabaseBase::RollbackInternalTransaction()
       
   724 /**
       
   725 Rollback the database after internal use - end a transaction
       
   726 */
       
   727     {
       
   728     __FLOG_STATIC0(KLogComponent, KCommDbShim, _L("RollbackInternalTransaction() Entry Point"));
       
   729     if (iInInternalTransaction)
       
   730         {
       
   731         RollbackTransaction();
       
   732         iInInternalTransaction = EFalse;
       
   733 
       
   734         __FLOG_STATIC0(KLogComponent, KCommDbShim, _L("RollbackTransaction()"));
       
   735         }
       
   736     }
       
   737 
       
   738 void CCommsDatabaseBase::NotifyChangeL(const TDesC& /*aSetting*/, TUint32 /*aVal*/)
       
   739 /**
       
   740 Does the notification when the transaction is committed
       
   741 
       
   742 Nothing to do. Everything is done in CommsDat from v9.1
       
   743 
       
   744 @param aSetting Setting to get
       
   745 @param aVal Setting value.
       
   746 */
       
   747 	{
       
   748 	}
       
   749 
       
   750 
       
   751 TInt CCommsDatabaseBase::NotifyAllChanges()
       
   752 /**
       
   753 Does the notification for all the changes that are stored in the member variable iNotifications.
       
   754 
       
   755 Nothing to do. Everything is done in CommsDat from v9.1
       
   756 
       
   757 @return KErrNone if successful;
       
   758 		KErrPermissionDenied if the caller process failed the Write Policy;
       
   759 		KErrNotFound if a property was not found
       
   760 
       
   761 */
       
   762 	{
       
   763 	return KErrNone;
       
   764 	}
       
   765 
       
   766 void CCommsDatabaseBase::ConvertToUid(const TDesC& /*aSetting*/,
       
   767 								  TUint32 /*aVal*/,
       
   768 								  TCommDbPublishSubscribeNotification& /*aNotification*/)
       
   769 /**
       
   770 Checks for the type of the setting passed and sets the value in the Commdb publish subscribe notification appropriately.
       
   771 
       
   772 Nothing to do. Everything is done in CommsDat from v9.1
       
   773 
       
   774 @param aSetting Setting to get
       
   775 @param aVal Setting value.
       
   776 @param aNotification A reference to TCommDbSystemAgentNotification
       
   777 */
       
   778 	{
       
   779 	}
       
   780 
       
   781 TUint32 CCommsDatabaseBase::GetNewNumber(TUid /*aUid*/)
       
   782 /**
       
   783 Generates a new number for the given UID
       
   784 
       
   785 Nothing to do. Everything is done in CommsDat from v9.1
       
   786 
       
   787 @param aUid UID for which the new number is to be generated
       
   788 @return The new number generated
       
   789 */
       
   790 	{
       
   791 	return 0;
       
   792 	}
       
   793 /**
       
   794    Check that a given client has the capabilites required to perform the given operation on the given field
       
   795 
       
   796    @param aType     Specifies the requested operation (read or write)
       
   797    @param aField    Specifies the field to perform the operation on
       
   798    @param aMessage  Contains the capabilites of the client
       
   799    @return KErrNone on success, one of the system-wide error codes otherwise
       
   800 */
       
   801 TInt CCommsDatabaseBase::CheckDBCapability( RDbs::TPolicyType /*aType*/, const TDesC& /*aField*/, const RMessagePtr2* /*aMessage*/ )
       
   802 	{
       
   803 	/** TODO: Call Capability inside CommsDatUtil  */
       
   804 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CheckDBCapability()"));
       
   805 	return KErrNotFound;
       
   806 	}
       
   807 /**
       
   808    Check the capabilites required to read a field from the database
       
   809 
       
   810    @param aField the name of the field to be read
       
   811    @param aMessage Message indicating the capabilites to be checked
       
   812    @return KErrNone on success, one of the system-wide error codes otherwise
       
   813 */
       
   814 EXPORT_C TInt CCommsDatabaseBase::CheckReadCapability( const TDesC& aField, const RMessagePtr2* aMessage )
       
   815 	{
       
   816 	TInt ret = EFalse;
       
   817 	TRAPD(err, DoCheckReadCapabilityL(aField, aMessage));
       
   818 	if(err == KErrNone)
       
   819 		{
       
   820 		err = ret;
       
   821 		}
       
   822 
       
   823 	return err;
       
   824 	}
       
   825 
       
   826 TInt CCommsDatabaseBase::DoCheckReadCapabilityL( const TDesC& aField, const RMessagePtr2* aMessage )
       
   827 	{
       
   828 	CCommsDatUtils* commsUtils = CCommsDatUtils::NewL();
       
   829 	TInt ret = commsUtils->CheckReadCapability(aField, aMessage);
       
   830 	delete commsUtils;
       
   831 
       
   832 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CheckReadCapability(), ret:%d"), ret);
       
   833 
       
   834 	return ret;
       
   835 	}
       
   836 /**
       
   837    Check the capabilites required to write a field to the database
       
   838 
       
   839    @param aField the name of the field to be written
       
   840    @param aMessage Message indicating the capabilites to be checked
       
   841    @return KErrNone on success, one of the system-wide error codes otherwise
       
   842 */
       
   843 EXPORT_C TInt CCommsDatabaseBase::CheckWriteCapability( const TDesC& aField, const RMessagePtr2* aMessage )
       
   844 	{
       
   845 	TInt ret = EFalse;
       
   846 	TRAPD(err, ret = DoCheckWriteCapabilityL(aField, aMessage));
       
   847 	if(err == KErrNone)
       
   848 		{
       
   849 		err = ret;
       
   850 		}
       
   851 
       
   852 	return err;
       
   853 	}
       
   854 
       
   855 TInt CCommsDatabaseBase::DoCheckWriteCapabilityL( const TDesC& aField, const RMessagePtr2* aMessage )
       
   856 	{
       
   857 	CCommsDatUtils* commsUtils = CCommsDatUtils::NewL();
       
   858 	TInt ret = commsUtils->CheckWriteCapability(aField, aMessage);
       
   859 	delete commsUtils;
       
   860 
       
   861 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CheckWriteCapability(), ret:%d"), ret);
       
   862 
       
   863 	return ret;
       
   864 	}
       
   865 
       
   866 EXPORT_C TInt CCommsDatabaseBase::InitializeFilestore()
       
   867 /**
       
   868 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
   869 @internalTechnology
       
   870 */
       
   871 	{
       
   872 	return KErrNotSupported;
       
   873 	}
       
   874 
       
   875 
       
   876 // CCommsDatabase definitions
       
   877 EXPORT_C CCommsDatabase* CCommsDatabase::NewL()
       
   878 /** Allocates and constructs a new communications database object on the heap.
       
   879 If the database filestore does not exist the default filestore is duplicated.
       
   880 If no default filestore exists an empty database is created.
       
   881 
       
   882 If there is insufficient memory available to create the object, the function
       
   883 leaves. If allocation is successful, it returns a pointer to the new object.
       
   884 
       
   885 @return A pointer to a communications database object. */
       
   886 	{
       
   887 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL() Entry Point"));
       
   888 	CCommsDatabase* r = new(ELeave) CCommsDatabase();
       
   889 	CleanupStack::PushL(r);
       
   890 
       
   891 	if(r->iImplNotCreated)
       
   892 		{
       
   893 		User::Leave(KErrNoMemory);
       
   894 		}
       
   895 
       
   896 	TCommDbOpeningMethod openingMethod;
       
   897 	r->DoOpenL(openingMethod, ETrue);
       
   898 	CleanupStack::Pop(r);
       
   899 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL() Exit Point"));
       
   900 	return r;
       
   901 	}
       
   902 
       
   903 EXPORT_C CCommsDatabase* CCommsDatabase::NewL(TBool aUseDefaultDb)
       
   904 /** Creates a CCommsDatabase. If the database filestore exists and aUseDefaultDb
       
   905 is ETrue the default filestore is duplicated. Otherwise an empty database
       
   906 is created. If the commdb doesn't exist and this and aUseDefaultDb is EFalse
       
   907 the this function will leave.
       
   908 
       
   909 @param aUseDefaultDb Use the default database.
       
   910 @leave KErrNotSupported when aUseDefaultDb is EFalse and the database filestore
       
   911 does not exists.
       
   912 @return A pointer to a communications database object. */
       
   913 	{
       
   914 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL()[TBool] Entry Point"));
       
   915 	CCommsDatabase* r = new(ELeave) CCommsDatabase();
       
   916 	CleanupStack::PushL(r);
       
   917 
       
   918 	if(r->iImplNotCreated)
       
   919 		{
       
   920 		User::Leave(KErrNoMemory);
       
   921 		}
       
   922 
       
   923 	TCommDbOpeningMethod openingMethod;
       
   924 	r->DoOpenL(openingMethod, aUseDefaultDb);
       
   925 	CleanupStack::Pop(r);
       
   926 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL() Exit Point"));
       
   927 	return r;
       
   928 	}
       
   929 
       
   930 EXPORT_C CCommsDatabase* CCommsDatabase::NewL(TCommDbOpeningMethod& aOpeningMethod)
       
   931 /** Creates a CCommsDatabase as with NewL(). The method of opening (Created, CopiedDefault
       
   932 or Opened) is returned in aOpeningMethod.
       
   933 
       
   934 @param aOpeningMethod On return, the opening method.
       
   935 0@return A pointer to a communications database object. */
       
   936 	{
       
   937 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL()[TCommDbOpeningMethod] Entry Point"));
       
   938 	CCommsDatabase* r = new(ELeave) CCommsDatabase();
       
   939 
       
   940 	CleanupStack::PushL(r);
       
   941 
       
   942 	if(r->iImplNotCreated)
       
   943 		{
       
   944 		User::Leave(KErrNoMemory);
       
   945 		}
       
   946 
       
   947 	r->DoOpenL(aOpeningMethod, ETrue);
       
   948 	CleanupStack::Pop(r);
       
   949 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL() Exit Point"));
       
   950 	return r;
       
   951 	}
       
   952 
       
   953 EXPORT_C CCommsDatabase* CCommsDatabase::NewL(TCommDbDatabaseType /*aDbType*/)
       
   954 /**
       
   955  * Re-instated override variant of NewL function in order to maintain BC with 6.1
       
   956  * @param aDbType Whether Database is IAP or ISP version. All Db's are IAP type now.
       
   957  * @return CCommDbOverrideSettings* the calling function takes ownership of the returned object
       
   958  */
       
   959 	{
       
   960 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL()[TCommDbDatabaseType] Entry Point"));
       
   961 	return NewL();
       
   962 	}
       
   963 
       
   964 EXPORT_C CCommsDatabase* CCommsDatabase::NewL(TCommDbDatabaseType /*aDbType*/, TCommDbOpeningMethod& aOpeningMethod)
       
   965 /**
       
   966  * Re-instated override variant of NewL function in order to maintain BC with 6.1
       
   967  * Creates a CCommsDatabase and gets the method of opening (Created, CopiedDefault or Opened).
       
   968  * @param aDbType Whether Database is IAP or ISP version. All Db's are IAP type now.
       
   969  * @param aOpeningMethod On return, the method of opening.
       
   970  * @return CCommDbOverrideSettings* the calling function takes ownership of the returned object.
       
   971  */
       
   972 	{
       
   973 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::NewL() Entry Point"));
       
   974 	return NewL(aOpeningMethod);
       
   975 	}
       
   976 
       
   977 CCommsDatabase::CCommsDatabase()
       
   978 	: CCommsDatabaseBase()
       
   979 /**
       
   980 Default Constructor
       
   981 */
       
   982 	{
       
   983 	}
       
   984 
       
   985 
       
   986 EXPORT_C CCommsDatabase::~CCommsDatabase()
       
   987 /** Frees all resources owned by this object, prior to its destruction.
       
   988 
       
   989 In particular, the destructor closes the communications database and disconnects
       
   990 from the DBMS. */
       
   991 	{
       
   992 	}
       
   993 
       
   994 
       
   995 EXPORT_C void CCommsDatabase::GetGlobalSettingL(const TDesC& aSetting, TUint32& aVal)
       
   996 /** Gets a global settings table integer field.
       
   997 
       
   998 If a client attempts to get the default Dial Out IAP with a Version 6.1 database,
       
   999 the function gets the default IAP in the first connection preference for the
       
  1000 outgoing direction if it is a dial out ISP-type IAP and returns its ID, otherwise
       
  1001 an error is returned.
       
  1002 
       
  1003 If a client attempts to get the ASK_USER_BEFORE_DIAL field with a Version
       
  1004 6.1 database, the function returns a true value if CONNECT_PREF_DIALOG_PREF
       
  1005 in the first connection preference has been set to produce a prompt, otherwise
       
  1006 false.
       
  1007 
       
  1008 @param aSetting Setting to get.
       
  1009 @param aValue On return, the setting value.
       
  1010 @leave KErrNotSupported if aSetting is invalid; KErrNotFound if the global setting has not been set.
       
  1011 @capability Dependent on table, see the guide page referenced below. */
       
  1012 	{
       
  1013 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("GetGlobalSettingL(const TDesC& aSetting, TUint32& aVal)"));
       
  1014 
       
  1015 	CCDGlobalSettingsRecord* gsRec = static_cast<CCDGlobalSettingsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdGlobalSettingsRecord));
       
  1016 	CleanupStack::PushL(gsRec);
       
  1017 
       
  1018 	TInt tempType(0);
       
  1019 	CMDBField<TUint32>* ptrField = NULL;
       
  1020 	TRAPD(err, ptrField = static_cast<CMDBField<TUint32>*>(gsRec->GetFieldByNameL(aSetting, tempType)));
       
  1021 
       
  1022 	// To maintain CommDb behaviour
       
  1023 	if (err == KErrNotFound)
       
  1024 		{
       
  1025 		User::Leave(KErrNotSupported);
       
  1026 		}
       
  1027 
       
  1028 	ptrField->SetRecordId(KGlobalSettingsRecordID);
       
  1029 	ptrField->LoadL(*iImpl->iDbs);
       
  1030 
       
  1031 	if(ptrField->IsNull())
       
  1032 		{
       
  1033 		User::Leave(KErrNotFound);
       
  1034 		}
       
  1035 
       
  1036 	aVal = static_cast<TUint32&>(*ptrField);
       
  1037 
       
  1038 	__FLOG_STATIC2(KLogComponent, KCommDbShim, _L("CCommsDatabase::GetGlobalSettingL Setting=%S, Value=%d"),&aSetting,aVal);
       
  1039 
       
  1040 	CleanupStack::PopAndDestroy(gsRec);
       
  1041 	}
       
  1042 
       
  1043 
       
  1044 EXPORT_C void CCommsDatabase::GetGlobalSettingL(const TDesC& aSetting, TDes& aVal)
       
  1045 /** Gets a global settings table string field.
       
  1046 
       
  1047 @param aSetting Setting to get.
       
  1048 @param aValue On return, the setting value
       
  1049 @leave KErrNotSupported if aSetting is invalid; KErrNotFound if the global setting has not been set
       
  1050 @capability Dependent on table, see the guide page referenced below. */
       
  1051 	{
       
  1052 
       
  1053 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("GetGlobalSettingL(const TDesC& aSetting, TDes& aVal)"));
       
  1054 
       
  1055 	if (aSetting.CompareF(TPtrC(KCDTypeNameBearerAvailabilityCheckTSY)) == 0)
       
  1056 		{
       
  1057 		// load the field
       
  1058 		//
       
  1059 		CMDBField<TDesC>* descField = new(ELeave) CMDBField<TDesC>(KCDTIdBearerAvailabilityCheckTSY);
       
  1060 		CleanupStack::PushL(descField);
       
  1061 		descField->SetMaxLengthL(KMaxTextLength);
       
  1062 		descField->SetRecordId(KGlobalSettingsRecordID);
       
  1063 		descField->LoadL(*iImpl->iDbs);
       
  1064 		
       
  1065 		if(descField->IsNull())
       
  1066 			{
       
  1067 			__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::GetGlobalSettingL Setting leaves with KErrNotFound(Field has NULL value)"));
       
  1068 			User::Leave(KErrNotFound);
       
  1069 			}
       
  1070 		else
       
  1071 			{
       
  1072 			aVal = *descField;
       
  1073 			CleanupStack::PopAndDestroy(descField);
       
  1074 			}
       
  1075 		}
       
  1076 	else
       
  1077 		{
       
  1078 		// there is only one descriptor global setting so leave otherwise
       
  1079 		//
       
  1080 		__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CCommsDatabase::GetGlobalSettingL Setting=%S leaves with KErrNotSupported(Setting doesn't exist!)"), &aSetting);
       
  1081 		User::Leave(KErrNotSupported);
       
  1082 		}
       
  1083 
       
  1084 	__FLOG_STATIC2(KLogComponent, KCommDbShim, _L("CCommsDatabase::GetGlobalSettingL Setting=%S, Value=%S"), &aSetting, &aVal);
       
  1085 	}
       
  1086 
       
  1087 EXPORT_C void CCommsDatabase::SetGlobalSettingL(const TDesC& aSetting, TUint32 aVal)
       
  1088 
       
  1089 /** Sets a global settings table integer field.
       
  1090 
       
  1091 If a client attempts to set the default Dial Out IAP with a Version 6.1 database,
       
  1092 the function sets the default IAP in the first connection preference for the
       
  1093 outgoing direction to the specified IAP, and the bearer set to CSD.
       
  1094 
       
  1095 If a client attempts to set the ASK_USER_BEFORE_DIAL field with a Version
       
  1096 6.1 database, the function sets CONNECT_PREF_DIALOG_PREF in the first connection
       
  1097 preference to produce a prompt if true is specified, or do not prompt if false
       
  1098 is specified.
       
  1099 
       
  1100 @param aSetting Setting to get.
       
  1101 @param aValue Setting value.
       
  1102 @leave KErrNotSupported aSetting is invalid.
       
  1103 @capability Dependent on table, see the guide page referenced below. */
       
  1104 	{
       
  1105 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("SetGlobalSettingL(const TDesC& aSetting, TUint32 aVal)"));
       
  1106 
       
  1107 	iImpl->CheckGlobalSettingsTableExistsL();
       
  1108 
       
  1109 	CCDGlobalSettingsRecord* gsRec = static_cast<CCDGlobalSettingsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdGlobalSettingsRecord));
       
  1110 	CleanupStack::PushL(gsRec);
       
  1111 
       
  1112 	TInt tempType(0);
       
  1113 	CMDBField<TUint32>* ptrField = NULL;
       
  1114 	TRAPD(err, ptrField = static_cast<CMDBField<TUint32>*>(gsRec->GetFieldByNameL(aSetting, tempType)));
       
  1115 
       
  1116 	// To maintain CommDb behaviour.
       
  1117 	//
       
  1118 	if (err == KErrNotFound)
       
  1119 		{
       
  1120 		__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CCommsDatabase::SetGlobalSettingL Setting=%S is leaving with KErrNotSupported(Setting doesn't exist!)"), &aSetting);
       
  1121 		User::Leave(KErrNotSupported);
       
  1122 		}
       
  1123 
       
  1124 	*ptrField = aVal;
       
  1125 
       
  1126 	ptrField->SetRecordId(KGlobalSettingsRecordID);
       
  1127 	ptrField->ModifyL(*iImpl->iDbs);
       
  1128 
       
  1129 	__FLOG_STATIC3(KLogComponent, KCommDbShim, _L("CCommsDatabase::SetGlobalSettingL Setting=%S, ElementId = %08x, Value=%d"), &aSetting, *(ptrField->Data()), aVal);
       
  1130 
       
  1131 	CleanupStack::PopAndDestroy(gsRec);
       
  1132    }
       
  1133 
       
  1134 
       
  1135 EXPORT_C void CCommsDatabase::SetGlobalSettingL(const TDesC& aSetting, const TDesC& aVal)
       
  1136 /** Sets a global settings table string field.
       
  1137 
       
  1138 @param aSetting Setting to get.
       
  1139 @param aValue On return, the setting value.
       
  1140 @leave KErrNotSupported aSetting is invalid.
       
  1141 @capability Dependent on table, see the guide page referenced below. */
       
  1142 
       
  1143 	{
       
  1144 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("SetGlobalSettingL(const TDesC& aSetting, const TDesC& aVal)"));
       
  1145 
       
  1146 	iImpl->CheckGlobalSettingsTableExistsL();
       
  1147 
       
  1148 	CCDGlobalSettingsRecord* gsRec = static_cast<CCDGlobalSettingsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdGlobalSettingsRecord));
       
  1149 	CleanupStack::PushL(gsRec);
       
  1150 
       
  1151 	TInt tempType(0);
       
  1152 	CMDBField<TDesC>* ptrField = NULL;
       
  1153 	TRAPD(err, ptrField = static_cast<CMDBField<TDesC>*>(gsRec->GetFieldByNameL(aSetting, tempType)));
       
  1154 
       
  1155 	// To maintain CommDb behaviour.
       
  1156 	//
       
  1157 	if (err == KErrNotFound)
       
  1158 		{
       
  1159 		__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CCommsDatabase::SetGlobalSettingL Setting=%S is leaving with KErrNotSupported(Setting doesn't exist!)"), &aSetting);
       
  1160 		User::Leave(KErrNotSupported);
       
  1161 		}
       
  1162 
       
  1163 	ptrField->SetMaxLengthL(aVal.Length());
       
  1164 	*ptrField = aVal;
       
  1165 
       
  1166 	ptrField->SetRecordId(KGlobalSettingsRecordID);
       
  1167 	ptrField->ModifyL(*iImpl->iDbs);
       
  1168 
       
  1169 	__FLOG_STATIC2(KLogComponent, KCommDbShim, _L("CCommsDatabase::SetGlobalSettingL Setting=%S, Value=%S"), &aSetting, &aVal);
       
  1170 
       
  1171 	CleanupStack::PopAndDestroy(gsRec);
       
  1172 	}
       
  1173 
       
  1174 
       
  1175 EXPORT_C void CCommsDatabase::ClearGlobalSettingL(const TDesC& aSetting)
       
  1176 /** Clears a global settings table field.
       
  1177 
       
  1178 @param aSetting Setting to clear.
       
  1179 @leave KErrNotSupported aSetting is invalid
       
  1180 @capability Dependent on table, see the guide page referenced below. */
       
  1181 	{
       
  1182 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CCommsDatabase::ClearGlobalSettingL Entry Point"));
       
  1183 
       
  1184 	iImpl->CheckGlobalSettingsTableExistsL();
       
  1185 
       
  1186 	CCDGlobalSettingsRecord* gsRec = static_cast<CCDGlobalSettingsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdGlobalSettingsRecord));
       
  1187 	CleanupStack::PushL(gsRec);
       
  1188 
       
  1189 	TInt tempType(0);
       
  1190 	CMDBElement* ptrField(NULL);
       
  1191 	TRAPD(err, ptrField = gsRec->GetFieldByNameL(aSetting,tempType));
       
  1192 
       
  1193 	// To maintain CommDb behaviour.
       
  1194 	if (err == KErrNotFound)
       
  1195 		{
       
  1196 		__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CCommsDatabase::ClearGlobalSettingL Setting=%S is leaving with KErrNotSupported(Setting doesn't exist!)"), &aSetting);
       
  1197 		User::Leave(KErrNotSupported);
       
  1198 		}
       
  1199 
       
  1200 	ptrField->SetRecordId(KGlobalSettingsRecordID);
       
  1201 
       
  1202 	ptrField->DeleteL(*iImpl->iDbs);
       
  1203 
       
  1204 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("CCommsDatabase::ClearGlobalSettingL Setting=%S"), &aSetting);
       
  1205 
       
  1206 	CleanupStack::PopAndDestroy(gsRec);
       
  1207 	}
       
  1208 
       
  1209 
       
  1210 EXPORT_C void CCommsDatabase::GetDefaultTsyL(TDes& aValue)
       
  1211 /** Retrieves the default TSY used for bearer availibility, SMS and data services.
       
  1212 @capability Dependent on table, see the guide page referenced below. */
       
  1213 	{
       
  1214 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("GetDefaultTsyL Entry Point"));
       
  1215 	GetGlobalSettingL(TPtrC(KCDTypeNameBearerAvailabilityCheckTSY), aValue);
       
  1216 	}
       
  1217 
       
  1218 EXPORT_C void CCommsDatabase::GetCurrentDialOutSettingL(const TDesC& /*aSetting*/, TUint32& /*aValue*/)
       
  1219 /**
       
  1220 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1221 
       
  1222 @leave KErrNotSupported No longer supported.
       
  1223 @param aSetting Setting to get.
       
  1224 @param aValue On return, setting value.
       
  1225 */
       
  1226 	{
       
  1227 	User::Leave(KErrNotSupported);
       
  1228 	}
       
  1229 
       
  1230 EXPORT_C void CCommsDatabase::GetCurrentDialInSettingL(const TDesC& /*aSetting*/, TUint32& /*aValue*/)
       
  1231 /**
       
  1232 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1233 
       
  1234 Past use: Retrieve settings for the dial in IAP.
       
  1235 
       
  1236 @leave KErrNotSupported No longer supported.
       
  1237 @param aSetting Setting to get.
       
  1238 @param aValue On return, setting value. 
       
  1239 */
       
  1240     {
       
  1241 	User::Leave(KErrNotSupported);
       
  1242 	}
       
  1243 
       
  1244 EXPORT_C CCommsDbConnectionPrefTableView* CCommsDatabase::OpenConnectionPrefTableLC()
       
  1245 /** Opens a view on the whole Connection Preferences table and returns a pointer to it.
       
  1246 
       
  1247 Shows hidden records only if requested.
       
  1248 
       
  1249 When the use of the view object is complete it should be popped from the
       
  1250 cleanup stack, and deleted.
       
  1251 
       
  1252 @return The opened view
       
  1253 @capability Dependent on table, see the guide page referenced below. */
       
  1254 	{
       
  1255 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("GetCurrentDialInSettingL Entry Point"));
       
  1256 	// create instace of connection preference table
       
  1257 	CCommsDbConnectionPrefTableView* tableView = CCommsDbConnectionPrefTableView::NewLC(*this, ECommDbConnectionDirectionUnknown, EFalse);
       
  1258 
       
  1259 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("OpenConnectionPrefTableLC:  ConnectionPreferencesView is created"));
       
  1260 	return tableView;
       
  1261 	}
       
  1262 
       
  1263 EXPORT_C CCommsDbConnectionPrefTableView* CCommsDatabase::OpenConnectionPrefTableLC(TCommDbConnectionDirection aDirection)
       
  1264 /** Opens a view on the records in the Connection Preferences table with a specified
       
  1265 direction and return a pointer to it.
       
  1266 
       
  1267 Shows hidden records only if requested..
       
  1268 
       
  1269 When the use of the view object is complete, it should be popped from the
       
  1270 cleanup stack, and deleted.
       
  1271 
       
  1272 @param aDirection Direction of the records to include in the view
       
  1273 @return The opened view
       
  1274 @capability Dependent on table, see the guide page referenced below. */
       
  1275 	{
       
  1276 	// create instace of connection preference table
       
  1277 	CCommsDbConnectionPrefTableView* tableView = CCommsDbConnectionPrefTableView::NewLC(*this, aDirection, EFalse);
       
  1278 
       
  1279 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("OpenConnectionPrefTableLC: ConnectionPreferenceTable View is created with Direction:%d"),aDirection);
       
  1280 	return tableView;
       
  1281 	}
       
  1282 
       
  1283 EXPORT_C CCommsDbConnectionPrefTableView* CCommsDatabase::OpenConnectionPrefTableInRankOrderLC(TCommDbConnectionDirection aDirection)
       
  1284 /** Opens a view on the records in the Connection Preferences table with a specified
       
  1285 direction, and with records sorted into ranking order.
       
  1286 
       
  1287 Records are sorted in rank order from ranking 1 first. Records with rank 0
       
  1288 are not included.
       
  1289 
       
  1290 Shows hidden records only if requested.
       
  1291 
       
  1292 When the use of the view object is complete, it should be popped from the
       
  1293 cleanup stack, and deleted.
       
  1294 
       
  1295 @param aDirection Direction of the records to include in the view
       
  1296 @return The opened view
       
  1297 @capability Dependent on table, see the guide page referenced below. */
       
  1298 	{
       
  1299 	// create instace of connection preference table
       
  1300 	CCommsDbConnectionPrefTableView* tableView = CCommsDbConnectionPrefTableView::NewLC(*this, aDirection, ETrue);
       
  1301 
       
  1302 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("OpenConnectionPrefTableLC: ConnectionPreferenceTable View is created with direction:%d and sorted ranking"), aDirection);
       
  1303 	return tableView;
       
  1304 	}
       
  1305 
       
  1306 EXPORT_C CCommsDbConnectionPrefTableView* CCommsDatabase::OpenConnectionPrefTableViewOnRankLC(TCommDbConnectionDirection aDirection,
       
  1307 	TUint32 aRank)
       
  1308 /** Opens a view on the records in the Connection Preferences table with a specified
       
  1309 direction and ranking.
       
  1310 
       
  1311 When the use of the view object is complete, it should be popped from the
       
  1312 cleanup stack, and deleted.
       
  1313 
       
  1314 @param aDirection Direction of the records to include in the view
       
  1315 @param aRank Ranking of the records to include in the view
       
  1316 @return The opened view
       
  1317 @capability Dependent on table, see the guide page referenced below. */
       
  1318 	{
       
  1319 	//	there are no hidden field in the connection prefs table,
       
  1320 	//	therefore ignore iShowHiddenRecords member
       
  1321 
       
  1322 	// create instace of connection preference table
       
  1323 	CCommsDbConnectionPrefTableView* tableView = CCommsDbConnectionPrefTableView::NewL(*this, aDirection, aRank);
       
  1324 	CleanupStack::PushL(tableView);
       
  1325 
       
  1326 	__FLOG_STATIC2(KLogComponent, KCommDbShim, _L("OpenConnectionPrefTableViewOnRankLC: ConnectionPreferenceTable View is created with direction:%d ,rank:%d"), aDirection, aRank);
       
  1327 
       
  1328 	return tableView;
       
  1329 	}
       
  1330 
       
  1331 EXPORT_C void CCommsDatabase::SetAgentL(const TDesC& /*aService*/, const TDesC& /*aAgent*/)
       
  1332 /** 
       
  1333 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1334 Agent table has been removed.
       
  1335 
       
  1336 @leave KErrNotSupported No longer supported.
       
  1337 
       
  1338 @param aService The service that will use the agent. This is one of DIAL OUT ISP TABLE,
       
  1339 DIAL IN ISP TABLE, OUTGOING WCDMA TABLE.
       
  1340 @param aAgent The agent to use.
       
  1341 */
       
  1342 	{
       
  1343 	User::Leave(KErrNotSupported);
       
  1344 	}
       
  1345 
       
  1346 EXPORT_C void CCommsDatabase::SetAgentExtL(const TDesC& /*aService*/, const TDesC& /*aAgentExt*/)
       
  1347 /** 
       
  1348 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1349 Agent table has been removed.
       
  1350 @leave KErrNotSupported No longer supported.
       
  1351 
       
  1352 Past use: Sets the agent extension to be used when accessing the specified service.
       
  1353 
       
  1354 @param aService The service that will use the agent. This is one of DIAL OUT ISP TABLE,
       
  1355 DIAL IN ISP TABLE, OUTGOING WCDMA TABLE.
       
  1356 @param aAgentExt The agent extention to use.
       
  1357 */
       
  1358 	{
       
  1359 	User::Leave(KErrNotSupported);
       
  1360 	}
       
  1361 
       
  1362 EXPORT_C void CCommsDatabase::SetAgentClientTimeoutL(const TDesC& /*aService*/, TInt /*aClientTimeout*/)
       
  1363 /** 
       
  1364 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1365 Timeout names have been changed and agent table has been removed.
       
  1366 @leave KErrNotSupported No longer supported.
       
  1367 
       
  1368 Past use: Sets the client timeout associated with the specified service.
       
  1369 
       
  1370 @param aService The service that the client timeout is associated with. This is one of
       
  1371 DIAL OUT ISP TABLE, DIAL IN ISP TABLE, OUTGOING WCDMA TABLE. 
       
  1372 @param aClientTimeout The client timeout.
       
  1373 */
       
  1374 	{
       
  1375 	User::Leave(KErrNotSupported);
       
  1376 	}
       
  1377 
       
  1378 EXPORT_C void CCommsDatabase::SetAgentRouteTimeoutL(const TDesC& /*aService*/, TInt /*aRouteTimeout*/)
       
  1379 /** 
       
  1380 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1381 Timeout names have been changed and agent table has been removed.
       
  1382 @leave KErrNotSupported No longer supported.
       
  1383 
       
  1384 Past use: Sets the route timeout associated with the specified service.
       
  1385 
       
  1386 @param aService The service that the client route timeout is associated with. This is one of
       
  1387 DIAL OUT ISP TABLE, DIAL IN ISP TABLE, OUTGOING WCDMA TABLE. 
       
  1388 @param aRouteTimeout The route timeout.
       
  1389 */
       
  1390 	{
       
  1391 	User::Leave(KErrNotSupported);
       
  1392 	}
       
  1393 
       
  1394 
       
  1395 EXPORT_C void CCommsDatabase::GetAgentL(const TDesC& /*aService*/, TDes& /*aAgent*/)
       
  1396 /** 
       
  1397 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1398 Agent table has been removed.
       
  1399 @leave KErrNotSupported No longer supported.
       
  1400 
       
  1401 Past use: Gets the agent associated with the specified service.
       
  1402 
       
  1403 @param aService The service that will use the agent. This is one of DIAL OUT ISP TABLE,
       
  1404 DIAL IN ISP TABLE, OUTGOING WCDMA TABLE. 
       
  1405 @param aAgent On return, the agent.
       
  1406 */
       
  1407 	{
       
  1408 	User::Leave(KErrNotSupported);
       
  1409 	}
       
  1410 
       
  1411 EXPORT_C void CCommsDatabase::GetAgentExtL(const TDesC& /*aService*/, TDes& /*aAgentExt*/)
       
  1412 /** 
       
  1413 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1414 Agent table has been removed.
       
  1415 @leave KErrNotSupported No longer supported.
       
  1416 
       
  1417 Past use: Gets the agent extension associated with the specified service.
       
  1418 
       
  1419 @param aService The service that will use the agent. This is one of DIAL OUT ISP TABLE,
       
  1420 DIAL IN ISP TABLE, OUTGOING WCDMA TABLE.
       
  1421 @param aAgentExt On return, the agent extension.
       
  1422 */
       
  1423 	{
       
  1424 	User::Leave(KErrNotSupported);
       
  1425 	}
       
  1426 
       
  1427 EXPORT_C TInt CCommsDatabase::GetAgentClientTimeoutL(const TDesC& /*aService*/)
       
  1428 /** 
       
  1429 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1430 Agent table has been removed.
       
  1431 @leave KErrNotSupported No longer supported.
       
  1432 
       
  1433 Past use: Gets the client timeout associated with the specified service.
       
  1434 
       
  1435 @param aService The service that the timeout is associated with. This is one of DIAL
       
  1436 OUT ISP TABLE, DIAL IN ISP TABLE, OUTGOING WCDMA TABLE.
       
  1437 @return The agent timeout setting.
       
  1438 */
       
  1439 	{
       
  1440 	User::Leave(KErrNotSupported);
       
  1441 	return KErrNotSupported;
       
  1442 	}
       
  1443 
       
  1444 EXPORT_C TInt CCommsDatabase::GetAgentRouteTimeoutL(const TDesC& /*aService*/)
       
  1445 /** 
       
  1446 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1447 Agent table has been removed.
       
  1448 @leave KErrNotSupported No longer supported.
       
  1449 
       
  1450 Past use: Gets the route timeout associated with the specified service.
       
  1451 
       
  1452 @param aService The service that the route timeout is associated with. This is one of DIAL
       
  1453 OUT ISP TABLE, DIAL IN ISP TABLE, OUTGOING WCDMA TABLE.
       
  1454 @return The route timeout.
       
  1455 */
       
  1456 	{
       
  1457 	User::Leave(KErrNotSupported);
       
  1458 	return KErrNotSupported;
       
  1459 	}
       
  1460 
       
  1461 EXPORT_C void CCommsDatabase::ClearAgentAndExtL(const TDesC& /*aService*/)
       
  1462 /**
       
  1463 @deprecated This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
       
  1464 
       
  1465 @publishedAll
       
  1466 @deprecated
       
  1467 @param aService The service that will be cleared of all the agent settings.
       
  1468 */
       
  1469 	{
       
  1470 	User::Leave(KErrNotSupported);
       
  1471 	}
       
  1472 
       
  1473 EXPORT_C CCommsDbTableView* CCommsDatabase::OpenIAPTableViewMatchingBearerSetLC(TUint32 aBearerSet,
       
  1474 												TCommDbConnectionDirection aDirection)
       
  1475 /** Opens a view on records in the IAP table with a specified range of service
       
  1476 types.
       
  1477 
       
  1478 IAP records are included that have the specified bearers and direction, as read
       
  1479 from the Connection preference table.
       
  1480 
       
  1481 When the use of the view object is complete, it should be popped from the
       
  1482 cleanup stack, and deleted.
       
  1483 
       
  1484 @param aBearerSet Bearers to match. For suitable values, see CONNECT_PREF_BEARER_SET
       
  1485 in the Connection preferences table. Bitwise mask of the TCommDbBearer.
       
  1486 @param aDirection Direction to match.
       
  1487 @leave KErrArgument if either aBearerSet or aDirection is invalid; other DBMS-related error codes.
       
  1488 @return The opened view.
       
  1489 @capability Dependent on table, see the guide page referenced below. */
       
  1490 	{
       
  1491 	// BearerSet checkings
       
  1492    	if ((aBearerSet & (KCommDbBearerCSD|KCommDbBearerPSD|KCommDbBearerLAN|KCommDbBearerPAN|KCommDbBearerVirtual|KCommDbBearerWLAN)) == 0)
       
  1493    		{
       
  1494 		User::Leave(KErrArgument);
       
  1495 		}
       
  1496 	// Direction checkings
       
  1497 	if (aDirection < ECommDbConnectionDirectionUnknown || aDirection > ECommDbConnectionDirectionIncoming)
       
  1498 		{
       
  1499 		User::Leave(KErrArgument);
       
  1500 		}
       
  1501 
       
  1502 	CCommsDbTableView* tableView = CCommsDbTableView::NewLC(*this, aBearerSet, aDirection);
       
  1503 
       
  1504 	__FLOG_STATIC2(KLogComponent, KCommDbShim, _L("OpenIAPTableViewMatchingBearerSetLC: BearerSet=%d ,Direction=%d"), aBearerSet, aDirection);
       
  1505 
       
  1506 	return tableView;
       
  1507 	}
       
  1508 
       
  1509 EXPORT_C CCommsDbTableView* CCommsDatabase::OpenIAPTableViewMatchingNetworkLC(TUint32 aNetworkId)
       
  1510 /** Opens a view on the IAP table containing records which match
       
  1511 the specified network.
       
  1512 @capability Dependent on table, see the guide page referenced below. */
       
  1513 	{
       
  1514 	CCommsDbTableView* tableView = CCommsDbTableView::NewLC(*this, aNetworkId);
       
  1515 
       
  1516 	__FLOG_STATIC1(KLogComponent, KCommDbShim, _L("OpenIAPTableViewMatchingNetworkLC: Network=%d ,Direction=%d"), aNetworkId);
       
  1517 
       
  1518 	return tableView;
       
  1519 	}
       
  1520 
       
  1521 
       
  1522 EXPORT_C CCommsDbTableView* CCommsDatabase::OpenViewOnProxyRecordLC(TUint32 aServiceId, const TDesC& aServiceType)
       
  1523 /** Opens a view on records in the Proxies table containing records	that match
       
  1524 the service ID and service type specified.
       
  1525 
       
  1526 When the use of the view object is complete, it should be popped from the cleanup
       
  1527 stack, and deleted.
       
  1528 
       
  1529 @param aServiceId ID of the service to match
       
  1530 @param aServiceType Service type to match
       
  1531 @leave KErrArgument if either aServiceId or aServiceType is invalid; other DBMS-related error codes.
       
  1532 @return The opened view
       
  1533 @capability Dependent on table, see the guide page referenced below. */
       
  1534 	{
       
  1535 	CCommsDbTableView* tableView = CCommsDbTableView::NewLC(*this, aServiceId, aServiceType);
       
  1536 
       
  1537 	return tableView;
       
  1538 	}
       
  1539 
       
  1540 
       
  1541 void CCommsDatabase::CreateDatabaseL()
       
  1542 /**
       
  1543 @deprecated This method is deprecated
       
  1544 
       
  1545 Function not supported
       
  1546 */
       
  1547 	{
       
  1548 	User::Leave(KErrNotSupported);
       
  1549 	}
       
  1550 
       
  1551 void CCommsDatabase::DoOpenL(TCommDbOpeningMethod& aOpeningMethod, TBool /*aUseDefaultDb*/)
       
  1552 /**
       
  1553 Connects to the Commsdat and set version number
       
  1554 
       
  1555 @param aOpeningMethod
       
  1556 */
       
  1557 	{
       
  1558 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CommsDat Session is created!, before"));
       
  1559 	iImpl->iDbs = CMDBSession::NewL(KCDVersion1_1);
       
  1560 
       
  1561 	// allow client to see everything that it's capabilities allow
       
  1562 	iImpl->iDbs->SetAttributeMask( ECDPrivate );
       
  1563 
       
  1564 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("CommsDat Session is created!"));
       
  1565 
       
  1566 	aOpeningMethod = ECommDbOpened;
       
  1567 	}
       
  1568 
       
  1569 CCommsDbTableView* CCommsDatabase::OpenGlobalSettingsTableLC(const TDesC& aSetting, TBool& aExists)
       
  1570 /**
       
  1571 Opens a view on the global settings table showing the entry (if it exists)
       
  1572 called aSetting. Global settings are hidden therfore require the
       
  1573 `aIncludeHiddenRecords` argument set to True.
       
  1574 
       
  1575 @param aSetting
       
  1576 @param aExists On return, will have ETrue if Successful else EFalse
       
  1577 @return pointer to CCommsDbTableView
       
  1578 */
       
  1579 	{
       
  1580 	aExists = EFalse;
       
  1581 	CCommsDbTableView* view = DoOpenViewMatchingTextL(TPtrC(KCDTypeNameGlobalSettings),TPtrC(KCDTypeNameRecordName),aSetting, ETrue);
       
  1582 	CleanupStack::PushL(view);
       
  1583 
       
  1584 	aExists = ETrue;
       
  1585 
       
  1586 	__FLOG_STATIC0(KLogComponent, KCommDbShim, _L("OpenGlobalSettingsTableLC"));
       
  1587 
       
  1588 	return view;
       
  1589 	}
       
  1590 
       
  1591 CCommsDatabase::TGlobalSettingType CCommsDatabase::GlobalSettingTypeL(const TDesC& aSetting) const
       
  1592 /**
       
  1593 Returns whether aSetting is a known global setting, a former global
       
  1594 setting supported for compatibility reasons or not known.
       
  1595 These are rougly in the optimal order.....
       
  1596 
       
  1597 @param aSetting
       
  1598 @return The type of global setting
       
  1599 */
       
  1600 	{
       
  1601 	TGlobalSettingType ret = ENotASetting;
       
  1602 	 //	Real global settings
       
  1603 	if (aSetting.CompareF(TPtrC(KCDTypeNameMaxConnectionAttempts)) == 0)
       
  1604 		{
       
  1605 		ret = EGlobalSetting;
       
  1606 		}
       
  1607 	else if (aSetting.CompareF(TPtrC(KCDTypeNameMaxRedialAttempts)) == 0)
       
  1608 		{
       
  1609 		ret = EGlobalSetting;
       
  1610 		}
       
  1611 	else if (aSetting.CompareF(TPtrC(KCDTypeNameSMSBearer)) == 0)
       
  1612 		{
       
  1613 		ret = EGlobalSetting;
       
  1614 		}
       
  1615 	else if (aSetting.CompareF(TPtrC(KCDTypeNameSMSReceiveMode)) == 0)
       
  1616 		{
       
  1617 		ret = EGlobalSetting;
       
  1618 		}
       
  1619 	else if (aSetting.CompareF(TPtrC(KCDTypeNameGPRSAttachMode)) == 0)
       
  1620 		{
       
  1621 		ret = EGlobalSetting;
       
  1622 		}
       
  1623 	else if (aSetting.CompareF(TPtrC(KCDTypeNameAcceptIncomingGPRS)) == 0)
       
  1624 		{
       
  1625 		ret = EGlobalSetting;
       
  1626 		}
       
  1627 	else if (aSetting.CompareF(TPtrC(KCDTypeNameGPRSClassCBearer)) == 0)
       
  1628 		{
       
  1629 		ret = EGlobalSetting;
       
  1630 		}
       
  1631 	else if (aSetting.CompareF(TPtrC(KCDTypeNameModemDataFax)) == 0)
       
  1632 		{
       
  1633 		ret = EGlobalSetting;
       
  1634 		}
       
  1635 	else if (aSetting.CompareF(TPtrC(KCDTypeNameModemPhoneServicesSMS)) == 0)
       
  1636 		{
       
  1637 		ret = EGlobalSetting;
       
  1638 		}
       
  1639 	else if (aSetting.CompareF(TPtrC(KCDTypeNameLocationDataFax)) == 0)
       
  1640 		{
       
  1641 		ret = EGlobalSetting;
       
  1642 		}
       
  1643 	else if (aSetting.CompareF(TPtrC(KCDTypeNameLocationPhoneServicesSMS)) == 0)
       
  1644 		{
       
  1645 		ret = EGlobalSetting;
       
  1646 		}
       
  1647 	else if (aSetting.CompareF(TPtrC(KCDTypeNameDefaultNetwork)) == 0)
       
  1648 		{
       
  1649 		ret = EGlobalSetting;
       
  1650 		}
       
  1651 	else if (aSetting.CompareF(TPtrC(KCDTypeNameMaxMBufHeap)) == 0)
       
  1652 		{
       
  1653 		ret = EGlobalSetting;
       
  1654 		}
       
  1655 	else if (aSetting.CompareF(TPtrC(KCDTypeNameDefaultAgent)) == 0)
       
  1656 		{
       
  1657 		ret = EGlobalSetting;
       
  1658 		}
       
  1659 	else if (aSetting.CompareF(TPtrC(KCDTypeNameBearerAvailabilityCheckTSY)) == 0)
       
  1660 		{
       
  1661 		ret = EGlobalSetting;
       
  1662 		}
       
  1663 	else
       
  1664 		{
       
  1665 		User::Leave(KErrNotSupported);
       
  1666 		}
       
  1667 
       
  1668 	return ret;
       
  1669 	}
       
  1670