persistentstorage/dbms/inc/D32DBMS.INL
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 1998-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 //
       
    15 
       
    16 // Class TDbCol
       
    17 inline TDbCol::TDbCol(const TDesC &aName)
       
    18 	: iName(aName)
       
    19 	{
       
    20 	}
       
    21 
       
    22 /**
       
    23 TDbCol copy constructor.
       
    24 @param aSrcCol This TDbCol object will be constructed as an exact copy of aSrcCol object.
       
    25 */
       
    26 inline TDbCol::TDbCol(const TDbCol& aSrcCol) :
       
    27 	iType(aSrcCol.iType),
       
    28 	iMaxLength(aSrcCol.iMaxLength),
       
    29 	iAttributes(aSrcCol.iAttributes),
       
    30 	iName(static_cast <const TDesC&> (aSrcCol.iName))
       
    31 	{
       
    32 	}
       
    33 	
       
    34 /**
       
    35 TDbCol "=" operator.
       
    36 @param aSrcCol This TDbCol object will be made to be an exact copy of aSrcCol object.
       
    37 */
       
    38 inline TDbCol& TDbCol::operator=(const TDbCol& aSrcCol)
       
    39 	{
       
    40 	iType = aSrcCol.iType;
       
    41 	iMaxLength = aSrcCol.iMaxLength;
       
    42 	iAttributes = aSrcCol.iAttributes;
       
    43 	iName = static_cast <const TDesC&> (aSrcCol.iName);
       
    44 	return *this;
       
    45 	}
       
    46 
       
    47 /** Tests if a column is of the Long column type, i.e. one of the EDbColLongXxxx 
       
    48 types.
       
    49 
       
    50 @param aType The column type to test.
       
    51 @return ETrue if the aType is a Long column type, EFalse otherwise. */
       
    52 inline TBool TDbCol::IsLong(TDbColType aType)
       
    53 	{
       
    54 	return aType>=EDbColLongText8;
       
    55 	}
       
    56 
       
    57 // Class CDbColSet
       
    58 /** Returns the number of column definitions in the set.
       
    59 
       
    60 Note that using a TDbColSetIter is another way to iterate through the contents 
       
    61 of a CDbColSet.
       
    62 
       
    63 @return The number of columns in the columns set. */
       
    64 inline TInt CDbColSet::Count() const
       
    65 	{
       
    66 	return iColumns.Count();
       
    67 	}
       
    68 
       
    69 /** Removes all of the columns from the column set. */
       
    70 inline void CDbColSet::Clear()
       
    71 	{
       
    72 	iColumns.Reset();
       
    73 	}
       
    74 
       
    75 /** Returns a column definition by its ordinal number in the set.
       
    76 
       
    77 Note that using a TDbColSetIter is another way to iterate through the contents 
       
    78 of a CDbColSet.
       
    79 
       
    80 @param aCol The ordinal number of the column in the set. Columns in a column 
       
    81 set are numbered from 1 to Count(), unlike Symbian OS array classes. Ordinal 
       
    82 0 is reserved to represent the invalid column number KDbNullColNo.
       
    83 @return The column definition requested. */
       
    84 inline const TDbCol& CDbColSet::operator[](TDbColNo aCol) const
       
    85 	{
       
    86 	return iColumns[aCol-1];// 1-based column ids 
       
    87 	}
       
    88 
       
    89 // Class TDbColSetIter
       
    90 inline TDbColSetIter::operator TAny* () const
       
    91 	{
       
    92 	return CONST_CAST(TDbCol*,iColumn);
       
    93 	}
       
    94 
       
    95 /** Dereferences the iterator on the current column definition.
       
    96 
       
    97 @return A const reference to the current column definition. */
       
    98 inline const TDbCol& TDbColSetIter::operator*() const
       
    99 	{
       
   100 	__ASSERT_DEBUG(iIndex<iArray->Count(),User::Invariant());
       
   101 	return *iColumn;
       
   102 	}
       
   103 
       
   104 /** Gets a member of the currently referenced column definition. This enables the 
       
   105 use of the following constructs:
       
   106 
       
   107 if (iter->iType==EDbColText && iter->iMaxLength<50) 
       
   108 
       
   109 @return A const pointer to the current column definition. */
       
   110 inline const TDbCol* TDbColSetIter::operator->() const
       
   111 	{
       
   112 	__ASSERT_DEBUG(iIndex<iArray->Count(),User::Invariant());
       
   113 	return iColumn;
       
   114 	}
       
   115 
       
   116 /** Returns a column ordinal in the set for the currently referenced column definition.
       
   117 
       
   118 @return The column ordinal of the current column definition. */
       
   119 inline TDbColNo TDbColSetIter::Col() const
       
   120 	{
       
   121 	__ASSERT_DEBUG(iIndex<iArray->Count(),User::Invariant());
       
   122 	return iIndex+1;
       
   123 	}
       
   124 
       
   125 /** Moves the iterator to the next column in the set post increment operator.
       
   126 
       
   127 Note that this is implemented in terms of the pre-increment operator, and 
       
   128 is less efficient.
       
   129 
       
   130 @param Unused: required for the C++ compiler to resolve the ambiguity with 
       
   131 the pre-increment operator.
       
   132 @return A copy of this iterator, referring to the column definition before 
       
   133 the increment operation is performed. */
       
   134 inline TDbColSetIter TDbColSetIter::operator++(TInt)
       
   135 	{
       
   136 	TDbColSetIter tmp(*this);
       
   137 	++(*this);
       
   138 	return tmp;
       
   139 	}
       
   140 
       
   141 /**
       
   142 TDbKeyCol copy constructor.
       
   143 @param aSrcKeyCol This TDbKeyCol object will be constructed as an exact copy of aSrcKeyCol object.
       
   144 */
       
   145 inline TDbKeyCol::TDbKeyCol(const TDbKeyCol& aSrcKeyCol) :
       
   146 	iOrder(aSrcKeyCol.iOrder),
       
   147 	iLength(aSrcKeyCol.iLength),
       
   148 	iName(static_cast <const TDesC&> (aSrcKeyCol.iName))
       
   149 	{
       
   150 	}
       
   151 	
       
   152 /**
       
   153 TDbKeyCol "=" operator.
       
   154 @param aSrcKeyCol This TDbKeyCol object will be made to be an exact copy of aSrcKeyCol object.
       
   155 */
       
   156 inline TDbKeyCol& TDbKeyCol::operator=(const TDbKeyCol& aSrcKeyCol)
       
   157 	{
       
   158 	iOrder = aSrcKeyCol.iOrder;
       
   159 	iLength = aSrcKeyCol.iLength;
       
   160 	iName = static_cast <const TDesC&> (aSrcKeyCol.iName);
       
   161 	return *this;
       
   162 	}
       
   163 
       
   164 
       
   165 // Class CDbKey
       
   166 inline TInt CDbKey::Count() const
       
   167 	{
       
   168 	return iKeys.Count();
       
   169 	}
       
   170 
       
   171 /** Returns a key column by its position in the key.
       
   172 
       
   173 @param aCol The position of the column in the key. These are numbered from 
       
   174 0 to Count()-1.
       
   175 @return The key column requested. */
       
   176 inline const TDbKeyCol& CDbKey::operator[](TInt aCol) const
       
   177 	{
       
   178 	return iKeys[aCol];
       
   179 	}
       
   180 
       
   181 /** Makes the key unique. This ensures that every key value in the index is distinct 
       
   182 from every other. */
       
   183 inline void CDbKey::MakeUnique()
       
   184 	{
       
   185 	iAttributes|=EUnique;
       
   186 	}
       
   187 
       
   188 /** Tests whether the key is unique.
       
   189 
       
   190 @return ETrue, if the key is unique; EFalse, otherwise. */
       
   191 inline TBool CDbKey::IsUnique() const
       
   192 	{
       
   193 	return iAttributes&EUnique;
       
   194 	}
       
   195 
       
   196 /** Tests whether the key is the primary key.
       
   197 
       
   198 @return ETrue, if the key is unique; EFalse, otherwise. */
       
   199 inline TBool CDbKey::IsPrimary() const
       
   200 	{
       
   201 	return iAttributes&EPrimary;
       
   202 	}
       
   203 
       
   204 /** Sets the way in which Text columns are compared for the key. All Text columns 
       
   205 in the key are compared in the same way.
       
   206 
       
   207 @param aComparison The comparison type to use. */
       
   208 inline void CDbKey::SetComparison(TDbTextComparison aComparison)
       
   209 	{
       
   210 	iComparison=aComparison;
       
   211 	}
       
   212 
       
   213 /** Returns the method used to compare Text columns in this key.
       
   214 
       
   215 @return The comparison type used for the key. */
       
   216 inline TDbTextComparison CDbKey::Comparison() const
       
   217 	{
       
   218 	return iComparison;
       
   219 	}
       
   220 
       
   221 inline void CDbKey::MakePrimary()
       
   222 	{
       
   223 	iAttributes|=EPrimary;
       
   224 	}
       
   225 
       
   226 // Class TDbQuery
       
   227 /** Constructs a query object from an SQL string and a text comparison mode.
       
   228 
       
   229 Note that no copy is made of the descriptor passed; it is stored by reference 
       
   230 in the query object.
       
   231 
       
   232 @param aQuery The SQL string as a descriptor.
       
   233 @param aComparison The type of text comparison to use in evaluation of the 
       
   234 SQL. If not supplied, normal comparison is used. */
       
   235 inline TDbQuery::TDbQuery(const TDesC& aQuery,TDbTextComparison aComparison):
       
   236 	iQuery(aQuery), 
       
   237 	iComparison(aComparison)
       
   238 	{
       
   239 	}
       
   240 
       
   241 /** Returns the SQL string in the query object.
       
   242 
       
   243 @return A descriptor containing the SQL string. */
       
   244 inline const TDesC& TDbQuery::Query() const
       
   245 	{
       
   246 	return iQuery;
       
   247 	}
       
   248 
       
   249 /** Returns the text comparison mode for the query object.
       
   250 
       
   251 @return The text comparison mode. */
       
   252 inline TDbTextComparison TDbQuery::Comparison() const
       
   253 	{
       
   254 	return iComparison;
       
   255 	}
       
   256 
       
   257 // Class RDbHandleBase
       
   258 inline RDbHandleBase::RDbHandleBase():
       
   259 	iObject(0)
       
   260 	{
       
   261 	}
       
   262 
       
   263 // Class RDbRowSet
       
   264 
       
   265 /** Positions the cursor at the beginning of the rowset. 
       
   266 
       
   267 @capability Note For a secure shared database, the caller must satisfy the read
       
   268             access policy for the table.
       
   269 */
       
   270 inline void RDbRowSet::BeginningL()
       
   271 	{
       
   272 	GotoL(EBeginning);
       
   273 	}
       
   274 
       
   275 /** Positions the cursor at the end of the rowset. 
       
   276 
       
   277 @capability Note For a secure shared database, the caller must satisfy the read
       
   278             access policy for the table.
       
   279 */
       
   280 inline void RDbRowSet::EndL()
       
   281 	{
       
   282 	GotoL(EEnd);
       
   283 	}
       
   284 
       
   285 /** Positions the cursor on the first row in the rowset. If there are no rows, 
       
   286 the cursor is positioned at the end.
       
   287 
       
   288 @return ETrue if the cursor is now at a row, EFalse if it is at the end. 
       
   289 
       
   290 @capability Note For a secure shared database, the caller must satisfy the read
       
   291             access policy for the table.
       
   292 */
       
   293 inline TBool RDbRowSet::FirstL()
       
   294 	{
       
   295 	return GotoL(EFirst);
       
   296 	}
       
   297 
       
   298 /** Positions the cursor on the last row in the rowset. If there are no rows, the 
       
   299 cursor is positioned at the beginning.
       
   300 
       
   301 @return ETrue if the cursor is now at a row, EFalse if it is at the beginning. 
       
   302 
       
   303 @capability Note For a secure shared database, the caller must satisfy the read
       
   304             access policy for the table.
       
   305 */
       
   306 inline TBool RDbRowSet::LastL()
       
   307 	{
       
   308 	return GotoL(ELast);
       
   309 	}
       
   310 
       
   311 /** Moves the cursor to the next row in the rowset. If there are no more rows, 
       
   312 the cursor is positioned to the end.
       
   313 
       
   314 If the cursor is at the beginning prior to the function, it is equivalent 
       
   315 to FirstL().
       
   316 
       
   317 @capability Note For a secure shared database, the caller must satisfy the read
       
   318             access policy for the table.
       
   319 */
       
   320 inline TBool RDbRowSet::NextL()
       
   321 	{
       
   322 	return GotoL(ENext);
       
   323 	}
       
   324 
       
   325 /** Moves the cursor to the previous row in the rowset. If there are no more rows, 
       
   326 the cursor is positioned to the beginning.
       
   327 
       
   328 If the cursor is at the end prior to the function, it is equivalent to LastL().
       
   329 
       
   330 @return ETrue if the cursor is now at a row, EFalse if it is at the beginning. 
       
   331 
       
   332 @capability Note For a secure shared database, the caller must satisfy the read
       
   333             access policy for the table.
       
   334 */
       
   335 inline TBool RDbRowSet::PreviousL()
       
   336 	{
       
   337 	return GotoL(EPrevious);
       
   338 	}
       
   339 
       
   340 /** Tests whether a column has the NULL value.
       
   341 
       
   342 Columns which have the NULL value can still be extracted with the correct 
       
   343 accessor function, in which case numerical columns will return a 0 (or equivalent) 
       
   344 value, and text and binary columns will have a zero length.
       
   345 
       
   346 @param aCol The column ordinal for the column to test.
       
   347 @return ETrue if column aCol is NULL, otherwise EFalse. */
       
   348 inline TBool RDbRowSet::IsColNull(TDbColNo aCol) const
       
   349 	{
       
   350 	return ColSize(aCol)==0;
       
   351 	}
       
   352 
       
   353 /** Extracts a signed integer column value. The type should fit within a TInt.
       
   354 
       
   355 @param aCol The column ordinal of the column to extract.
       
   356 @return The value of column aCol. */
       
   357 inline TInt RDbRowSet::ColInt(TDbColNo aCol) const
       
   358 	{
       
   359 	return ColInt32(aCol);
       
   360 	}
       
   361 
       
   362 /** Extracts an unsigned integer column value.
       
   363 
       
   364 @param aCol The column ordinal of the column to extract.
       
   365 @return The value of column aCol. */
       
   366 inline TUint RDbRowSet::ColUint(TDbColNo aCol) const
       
   367 	{
       
   368 	return ColUint32(aCol);
       
   369 	}
       
   370 
       
   371 /** Extracts a TReal64 column value.
       
   372 
       
   373 @param aCol The column ordinal of the column to extract.
       
   374 @return The value of column aCol. */
       
   375 inline TReal RDbRowSet::ColReal(TDbColNo aCol) const
       
   376 	{
       
   377 	return ColReal64(aCol);
       
   378 	}
       
   379 
       
   380 /** Sets a signed integer column value. The type should fit into a TInt.
       
   381 
       
   382 @param aCol The column ordinal of the column to set.
       
   383 @param aValue The new column value. */
       
   384 inline void RDbRowSet::SetColL(TDbColNo aCol,TInt aValue)
       
   385 	{
       
   386 	SetColL(aCol, TInt32(aValue));
       
   387 	}
       
   388 
       
   389 /** Sets a signed integer column value. The type should fit into a TInt.
       
   390 
       
   391 @param aCol The column ordinal of the column to set.
       
   392 @param aValue The new column value. */
       
   393 inline void RDbRowSet::SetColL(TDbColNo aCol,TUint aValue)
       
   394 	{
       
   395 	SetColL(aCol,TUint32(aValue));
       
   396 	}
       
   397 
       
   398 // Class TDbWindow
       
   399 /** Constructs this object with a size of ENone. This can be used to request a 
       
   400 view with no pre-evaluation window. */
       
   401 inline TDbWindow::TDbWindow():
       
   402 	iSize(ENone)
       
   403 	{
       
   404 	}
       
   405 
       
   406 /** Constructs this object with a size of EUnlimited. This is used to request a 
       
   407 completely pre-evaluated view. The constant KDbUnlimitedWindow is an instance 
       
   408 of such a TDbWindow.
       
   409 
       
   410 @param The argument is only used to direct the compiler to construct an unlimited 
       
   411 window. */
       
   412 inline TDbWindow::TDbWindow(TUnlimited):
       
   413 	iSize(EUnlimited)
       
   414 	{
       
   415 	}
       
   416 
       
   417 /** Returns the number of rows stored by the view.
       
   418 
       
   419 @return The number of rows stored by the window. This could be one of the 
       
   420 special values ENone or EUnlimited. */
       
   421 inline TInt TDbWindow::Size() const
       
   422 	{
       
   423 	return iSize;
       
   424 	}
       
   425 
       
   426 /** Returns the preferred position in the window of the current row marker. i.e. 
       
   427 the position with the forward and backward slots as requested.
       
   428 
       
   429 @return The preferred position in the window. It is undefined if this is not 
       
   430 a limited window. */
       
   431 inline TInt TDbWindow::PreferredPos() const
       
   432 	{
       
   433 	return iPreferredPos;
       
   434 	}
       
   435 
       
   436 // Class TUnion
       
   437 template <class T>
       
   438 inline TUnion<T>::operator const T&() const
       
   439 	{
       
   440 	return *(const T*)&iRep[0];
       
   441 	}
       
   442 
       
   443 template <class T>
       
   444 inline const T& TUnion<T>::operator()() const
       
   445 	{
       
   446 	return *(const T*)&iRep[0];
       
   447 	}
       
   448 
       
   449 template <class T>
       
   450 inline T& TUnion<T>::operator()()
       
   451 	{
       
   452 	return *(T*)&iRep[0];
       
   453 	}
       
   454 
       
   455 template <class T>
       
   456 inline void TUnion<T>::Set(const T& aT)
       
   457 	{
       
   458 	new(&iRep[0]) T(aT);
       
   459 	}
       
   460 
       
   461 // Class TDbLookupKey
       
   462 inline TDbLookupKey::TDbLookupKey(): 
       
   463 	iCount(0)
       
   464 	{
       
   465 	}
       
   466 
       
   467 inline TInt TDbLookupKey::Count() const
       
   468 	{
       
   469 	return iCount;
       
   470 	}
       
   471 
       
   472 inline const TDbLookupKey::SColumn* TDbLookupKey::First() const
       
   473 	{
       
   474 	return &iKey[0];
       
   475 	}
       
   476 
       
   477 // Class TDbSeekKey
       
   478 /** Constructs an empty key value. 
       
   479 
       
   480 Add() should be called before the key value is used for lookup. */
       
   481 inline TDbSeekKey::TDbSeekKey(): 
       
   482 	iMaxKeys(1)
       
   483 	{
       
   484 	}
       
   485 
       
   486 /** Constructs a key value for an TInt8, TInt16 or TInt32 column.
       
   487 
       
   488 @param aKey The key value to lookup. */
       
   489 inline TDbSeekKey::TDbSeekKey(TInt aKey): 
       
   490 	iMaxKeys(1)
       
   491 	{
       
   492 	Add(aKey);
       
   493 	}
       
   494 
       
   495 /** Constructs a key value for a Bit, TUint8, TUint16 or TUint32 column.
       
   496 
       
   497 @param aKey The key value to lookup. */
       
   498 inline TDbSeekKey::TDbSeekKey(TUint aKey): 
       
   499 	iMaxKeys(1)
       
   500 	{
       
   501 	Add(aKey);
       
   502 	}
       
   503 
       
   504 inline TDbSeekKey::TDbSeekKey(TInt64 aKey): 
       
   505 	iMaxKeys(1)
       
   506 	{
       
   507 	Add(aKey);
       
   508 	}
       
   509 
       
   510 /** Constructs a key value for a TReal32 column.
       
   511 
       
   512 @param aKey The key value to lookup. */
       
   513 inline TDbSeekKey::TDbSeekKey(TReal32 aKey): 
       
   514 	iMaxKeys(1)
       
   515 	{
       
   516 	Add(aKey);
       
   517 	}
       
   518 
       
   519 /** Construct a key value for a TReal64 column.
       
   520 
       
   521 @param aKey The key value to lookup. */
       
   522 inline TDbSeekKey::TDbSeekKey(TReal64 aKey): 
       
   523 	iMaxKeys(1)
       
   524 	{
       
   525 	Add(aKey);
       
   526 	}
       
   527 
       
   528 /** Constructs a key value for a TDateTime column.
       
   529 
       
   530 @param aKey The key value to lookup. */
       
   531 inline TDbSeekKey::TDbSeekKey(TTime aKey): 
       
   532 	iMaxKeys(1)
       
   533 	{
       
   534 	Add(aKey);
       
   535 	}
       
   536 
       
   537 /** Constructs a key value for a non-Unicode text column.
       
   538 
       
   539 Note that the seek key does not copy the text data contained by the descriptor. 
       
   540 This needs to be retained until the seek key is no longer required.
       
   541 
       
   542 @param aKey The key value to lookup. */
       
   543 inline TDbSeekKey::TDbSeekKey(const TDesC8& aKey): 
       
   544 	iMaxKeys(1)
       
   545 	{
       
   546 	Add(aKey);
       
   547 	}
       
   548 
       
   549 /** Constructs a key value for a Unicode text column.
       
   550 
       
   551 Note that the seek key does not copy the text data contained by the descriptor. 
       
   552 This needs to be retained until the seek key is no longer required.
       
   553 
       
   554 @param aKey The key value to lookup. */
       
   555 inline TDbSeekKey::TDbSeekKey(const TDesC16& aKey): 
       
   556 	iMaxKeys(1)
       
   557 	{
       
   558 	Add(aKey);
       
   559 	}
       
   560 
       
   561 inline TDbSeekKey::TDbSeekKey(TInt aKeys,TInt): 
       
   562 	iMaxKeys(aKeys)
       
   563 	{
       
   564 	}
       
   565 
       
   566 // Class TDbSeekMultiKey
       
   567 /** Constructs an empty multi-column key value. */
       
   568 template <TInt S>
       
   569 inline TDbSeekMultiKey<S>::TDbSeekMultiKey(): 
       
   570 	TDbSeekKey(S,0)
       
   571 	{
       
   572 	}
       
   573 
       
   574 // Class RDbTable
       
   575 /** Sets the specified index as the active index for this table. The rows will 
       
   576 be presented in index order, and this index key will be used for lookup by 
       
   577 the SeekL() function.
       
   578 
       
   579 If successful, the rowset is reset to the beginning.
       
   580 
       
   581 @param anIndex The name of the index to activate.
       
   582 @return KErrNone, if successful, otherwise one of the system-wide error codes. 
       
   583 Specifically:KErrWrite if the table was created with insert-only access.KErrNotFound 
       
   584 if the index does not exist on the table. This can also be one of the DBMS 
       
   585 database error codes. 
       
   586 
       
   587 @capability Note For a secure shared database, the caller must satisfy the read
       
   588             access policy for the table.
       
   589 */
       
   590 inline TInt RDbTable::SetIndex(const TDesC& anIndex)
       
   591 	{
       
   592 	return SetIndex(&anIndex);
       
   593 	}
       
   594 
       
   595 /** Sets the ordering to be the underlying ordering of the rows — this will 
       
   596 usually provide faster navigation of the rowset.
       
   597 
       
   598 @return KErrNone, if successful, otherwise one of the system-wide error codes. 
       
   599 Specifically:KErrWrite if the table was created with insert-only access. This 
       
   600 can also be one of the DBMS database error codes. 
       
   601 
       
   602 @capability Note For a secure shared database, the caller must satisfy the read
       
   603             access policy for the table.
       
   604 */
       
   605 inline TInt RDbTable::SetNoIndex()
       
   606 	{
       
   607 	return SetIndex(0);
       
   608 	}
       
   609 
       
   610 /** Constructs this object by invoking the matching constructor for RWriteStream.
       
   611 
       
   612 @param anExternalizer Specifies an externaliser */
       
   613 inline RDbColWriteStream::RDbColWriteStream(const MExternalizer<TStreamRef> &anExternalizer): 
       
   614 	RWriteStream(anExternalizer)
       
   615 	{
       
   616 	}
       
   617 
       
   618 // Class CDbNames
       
   619 inline TInt CDbNames::Count() const
       
   620 	{
       
   621 	return iList.Count();
       
   622 	}
       
   623 
       
   624 inline const TDesC& CDbNames::operator[](TInt anIndex) const
       
   625 	{
       
   626 	return iList[anIndex];
       
   627 	}
       
   628 
       
   629 // Class RDbDatabase
       
   630 
       
   631 /**
       
   632 Creates a table on the database.
       
   633 
       
   634 @param aName Table name.
       
   635 @param aColSet A set of column definitions which describe the table structure.
       
   636 
       
   637 @return KErrNone The operation has completed successfully;
       
   638         KErrNoMemory, an out of memory condition has occurred;
       
   639         KErrAlreadyExists, a table with that name already exists;
       
   640         KErrArgument, empty column set, duplicated column name, invalid column length;
       
   641         KErrBadName, invalid table name, invalid column name (containing spaces for example);
       
   642         KErrNotSupported, unknown column type, unknown column attributes;
       
   643         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
       
   644                       Note that other system-wide error codes may also be returned.
       
   645 
       
   646 @capability Note For a secure shared database, the caller must satisfy the schema
       
   647             access policy for the database.
       
   648 */
       
   649 inline TInt RDbDatabase::CreateTable(const TDesC& aName,const CDbColSet& aColSet)
       
   650 	{
       
   651 	return CreateTable(aName,aColSet,NULL);
       
   652 	}
       
   653 
       
   654 /**
       
   655 Creates a table on the database.
       
   656 
       
   657 @param aName Table name.
       
   658 @param aColSet A set of column definitions which describe the table structure.
       
   659 @param aPrimaryKey Primary key definition.
       
   660 
       
   661 @return KErrNone The operation has completed successfully;
       
   662         KErrNoMemory, an out of memory condition has occurred;
       
   663         KErrAlreadyExists, a table with that name already exists;
       
   664         KErrArgument, empty column set, duplicated column name, invalid column length;
       
   665         KErrBadName, invalid table name, invalid column name (containing spaces for example);
       
   666         KErrNotSupported, unknown column type, unknown column attributes;
       
   667         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
       
   668                       Note that other system-wide error codes may also be returned.
       
   669 
       
   670 @capability Note For a secure shared database, the caller must satisfy the schema
       
   671             access policy for the database.
       
   672 */
       
   673 inline TInt RDbDatabase::CreateTable(const TDesC& aName,const CDbColSet& aColSet,const CDbKey& aPrimaryKey)
       
   674 	{
       
   675 	return CreateTable(aName,aColSet,&aPrimaryKey);
       
   676 	}
       
   677 
       
   678 // Class RDbIncremental
       
   679 /** Initiates the execution of a DDL (SQL schema update) statement on the database.
       
   680 
       
   681 This is the incremental form of RDbDatabase::Execute().
       
   682 
       
   683 Note that to begin executing a DML (SQL data update) statement incrementally, 
       
   684 use the RDbUpdate class.
       
   685 
       
   686 @param aDatabase The database on which the DDL (SQL schema update) statement 
       
   687 is to execute.
       
   688 @param aSql The DDL SQL statement to be executed on the database.
       
   689 @param aStep On return, contains the initial step count for the incremental 
       
   690 operation. This value should be passed in to subsequent calls to Next() to 
       
   691 continue the operation.
       
   692 @return KErrNone if successful, otherwise another of the system-wide error 
       
   693 codes.
       
   694 @see RDbDatabase::Execute()
       
   695 @see RDbUpdate 
       
   696 
       
   697 @capability Note For a secure shared database, the caller must satisfy:
       
   698             - the schema access policy for the database, if the SQL statement is 
       
   699 			  CREATE/DROP/ALTER; 
       
   700             - the write access policy for the table in the SQL, if the SQL statement is 
       
   701 			  INSERT/UPDATE/DELETE; 
       
   702 */
       
   703 inline TInt RDbIncremental::Execute(RDbDatabase& aDatabase,const TDesC& aSql,TInt& aStep)
       
   704 	{
       
   705 	return Execute(aDatabase,aSql,EDbCompareNormal,aStep);
       
   706 	}
       
   707 
       
   708 ////////////////////////////////////////////////////////////////////////////////////////////
       
   709 // CDbStrings class
       
   710 
       
   711 /**
       
   712 @return The number of elements of the controlled strings array.
       
   713 */
       
   714 inline TInt CDbStrings::Count() const
       
   715 	{
       
   716 	return iList.Count();
       
   717 	}
       
   718 
       
   719 /**
       
   720 Allows access to "aIndex" element of the controlled strings array.
       
   721 @return "aIndex" element of the controlled strings array.
       
   722 */
       
   723 inline const TDesC& CDbStrings::operator[](TInt aIndex) const
       
   724 	{
       
   725 	return iList[aIndex];
       
   726 	}
       
   727