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