williamr@2: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: // Class TDbCol williamr@2: inline TDbCol::TDbCol(const TDesC &aName) williamr@2: : iName(aName) williamr@2: { williamr@2: } williamr@2: williamr@2: /** williamr@2: TDbCol copy constructor. williamr@2: @param aSrcCol This TDbCol object will be constructed as an exact copy of aSrcCol object. williamr@2: */ williamr@2: inline TDbCol::TDbCol(const TDbCol& aSrcCol) : williamr@2: iType(aSrcCol.iType), williamr@2: iMaxLength(aSrcCol.iMaxLength), williamr@2: iAttributes(aSrcCol.iAttributes), williamr@2: iName(static_cast (aSrcCol.iName)) williamr@2: { williamr@2: } williamr@2: williamr@2: /** williamr@2: TDbCol "=" operator. williamr@2: @param aSrcCol This TDbCol object will be made to be an exact copy of aSrcCol object. williamr@2: */ williamr@2: inline TDbCol& TDbCol::operator=(const TDbCol& aSrcCol) williamr@2: { williamr@2: iType = aSrcCol.iType; williamr@2: iMaxLength = aSrcCol.iMaxLength; williamr@2: iAttributes = aSrcCol.iAttributes; williamr@2: iName = static_cast (aSrcCol.iName); williamr@2: return *this; williamr@2: } williamr@2: williamr@2: /** Tests if a column is of the Long column type, i.e. one of the EDbColLongXxxx williamr@2: types. williamr@2: williamr@2: @param aType The column type to test. williamr@2: @return ETrue if the aType is a Long column type, EFalse otherwise. */ williamr@2: inline TBool TDbCol::IsLong(TDbColType aType) williamr@2: { williamr@2: return aType>=EDbColLongText8; williamr@2: } williamr@2: williamr@2: // Class CDbColSet williamr@2: /** Returns the number of column definitions in the set. williamr@2: williamr@2: Note that using a TDbColSetIter is another way to iterate through the contents williamr@2: of a CDbColSet. williamr@2: williamr@2: @return The number of columns in the columns set. */ williamr@2: inline TInt CDbColSet::Count() const williamr@2: { williamr@2: return iColumns.Count(); williamr@2: } williamr@2: williamr@2: /** Removes all of the columns from the column set. */ williamr@2: inline void CDbColSet::Clear() williamr@2: { williamr@2: iColumns.Reset(); williamr@2: } williamr@2: williamr@2: /** Returns a column definition by its ordinal number in the set. williamr@2: williamr@2: Note that using a TDbColSetIter is another way to iterate through the contents williamr@2: of a CDbColSet. williamr@2: williamr@2: @param aCol The ordinal number of the column in the set. Columns in a column williamr@2: set are numbered from 1 to Count(), unlike Symbian OS array classes. Ordinal williamr@2: 0 is reserved to represent the invalid column number KDbNullColNo. williamr@2: @return The column definition requested. */ williamr@2: inline const TDbCol& CDbColSet::operator[](TDbColNo aCol) const williamr@2: { williamr@2: return iColumns[aCol-1];// 1-based column ids williamr@2: } williamr@2: williamr@2: // Class TDbColSetIter williamr@2: inline TDbColSetIter::operator TAny* () const williamr@2: { williamr@2: return CONST_CAST(TDbCol*,iColumn); williamr@2: } williamr@2: williamr@2: /** Dereferences the iterator on the current column definition. williamr@2: williamr@2: @return A const reference to the current column definition. */ williamr@2: inline const TDbCol& TDbColSetIter::operator*() const williamr@2: { williamr@2: __ASSERT_DEBUG(iIndexCount(),User::Invariant()); williamr@2: return *iColumn; williamr@2: } williamr@2: williamr@2: /** Gets a member of the currently referenced column definition. This enables the williamr@2: use of the following constructs: williamr@2: williamr@2: if (iter->iType==EDbColText && iter->iMaxLength<50) williamr@2: williamr@2: @return A const pointer to the current column definition. */ williamr@2: inline const TDbCol* TDbColSetIter::operator->() const williamr@2: { williamr@2: __ASSERT_DEBUG(iIndexCount(),User::Invariant()); williamr@2: return iColumn; williamr@2: } williamr@2: williamr@2: /** Returns a column ordinal in the set for the currently referenced column definition. williamr@2: williamr@2: @return The column ordinal of the current column definition. */ williamr@2: inline TDbColNo TDbColSetIter::Col() const williamr@2: { williamr@2: __ASSERT_DEBUG(iIndexCount(),User::Invariant()); williamr@2: return iIndex+1; williamr@2: } williamr@2: williamr@2: /** Moves the iterator to the next column in the set post increment operator. williamr@2: williamr@2: Note that this is implemented in terms of the pre-increment operator, and williamr@2: is less efficient. williamr@2: williamr@2: @param Unused: required for the C++ compiler to resolve the ambiguity with williamr@2: the pre-increment operator. williamr@2: @return A copy of this iterator, referring to the column definition before williamr@2: the increment operation is performed. */ williamr@2: inline TDbColSetIter TDbColSetIter::operator++(TInt) williamr@2: { williamr@2: TDbColSetIter tmp(*this); williamr@2: ++(*this); williamr@2: return tmp; williamr@2: } williamr@2: williamr@2: /** williamr@2: TDbKeyCol copy constructor. williamr@2: @param aSrcKeyCol This TDbKeyCol object will be constructed as an exact copy of aSrcKeyCol object. williamr@2: */ williamr@2: inline TDbKeyCol::TDbKeyCol(const TDbKeyCol& aSrcKeyCol) : williamr@2: iOrder(aSrcKeyCol.iOrder), williamr@2: iLength(aSrcKeyCol.iLength), williamr@2: iName(static_cast (aSrcKeyCol.iName)) williamr@2: { williamr@2: } williamr@2: williamr@2: /** williamr@2: TDbKeyCol "=" operator. williamr@2: @param aSrcKeyCol This TDbKeyCol object will be made to be an exact copy of aSrcKeyCol object. williamr@2: */ williamr@2: inline TDbKeyCol& TDbKeyCol::operator=(const TDbKeyCol& aSrcKeyCol) williamr@2: { williamr@2: iOrder = aSrcKeyCol.iOrder; williamr@2: iLength = aSrcKeyCol.iLength; williamr@2: iName = static_cast (aSrcKeyCol.iName); williamr@2: return *this; williamr@2: } williamr@2: williamr@2: williamr@2: // Class CDbKey williamr@2: inline TInt CDbKey::Count() const williamr@2: { williamr@2: return iKeys.Count(); williamr@2: } williamr@2: williamr@2: /** Returns a key column by its position in the key. williamr@2: williamr@2: @param aCol The position of the column in the key. These are numbered from williamr@2: 0 to Count()-1. williamr@2: @return The key column requested. */ williamr@2: inline const TDbKeyCol& CDbKey::operator[](TInt aCol) const williamr@2: { williamr@2: return iKeys[aCol]; williamr@2: } williamr@2: williamr@2: /** Makes the key unique. This ensures that every key value in the index is distinct williamr@2: from every other. */ williamr@2: inline void CDbKey::MakeUnique() williamr@2: { williamr@2: iAttributes|=EUnique; williamr@2: } williamr@2: williamr@2: /** Tests whether the key is unique. williamr@2: williamr@2: @return ETrue, if the key is unique; EFalse, otherwise. */ williamr@2: inline TBool CDbKey::IsUnique() const williamr@2: { williamr@2: return iAttributes&EUnique; williamr@2: } williamr@2: williamr@2: /** Tests whether the key is the primary key. williamr@2: williamr@2: @return ETrue, if the key is unique; EFalse, otherwise. */ williamr@2: inline TBool CDbKey::IsPrimary() const williamr@2: { williamr@2: return iAttributes&EPrimary; williamr@2: } williamr@2: williamr@2: /** Sets the way in which Text columns are compared for the key. All Text columns williamr@2: in the key are compared in the same way. williamr@2: williamr@2: @param aComparison The comparison type to use. */ williamr@2: inline void CDbKey::SetComparison(TDbTextComparison aComparison) williamr@2: { williamr@2: iComparison=aComparison; williamr@2: } williamr@2: williamr@2: /** Returns the method used to compare Text columns in this key. williamr@2: williamr@2: @return The comparison type used for the key. */ williamr@2: inline TDbTextComparison CDbKey::Comparison() const williamr@2: { williamr@2: return iComparison; williamr@2: } williamr@2: williamr@2: inline void CDbKey::MakePrimary() williamr@2: { williamr@2: iAttributes|=EPrimary; williamr@2: } williamr@2: williamr@2: // Class TDbQuery williamr@2: /** Constructs a query object from an SQL string and a text comparison mode. williamr@2: williamr@2: Note that no copy is made of the descriptor passed; it is stored by reference williamr@2: in the query object. williamr@2: williamr@2: @param aQuery The SQL string as a descriptor. williamr@2: @param aComparison The type of text comparison to use in evaluation of the williamr@2: SQL. If not supplied, normal comparison is used. */ williamr@2: inline TDbQuery::TDbQuery(const TDesC& aQuery,TDbTextComparison aComparison): williamr@2: iQuery(aQuery), williamr@2: iComparison(aComparison) williamr@2: { williamr@2: } williamr@2: williamr@2: /** Returns the SQL string in the query object. williamr@2: williamr@2: @return A descriptor containing the SQL string. */ williamr@2: inline const TDesC& TDbQuery::Query() const williamr@2: { williamr@2: return iQuery; williamr@2: } williamr@2: williamr@2: /** Returns the text comparison mode for the query object. williamr@2: williamr@2: @return The text comparison mode. */ williamr@2: inline TDbTextComparison TDbQuery::Comparison() const williamr@2: { williamr@2: return iComparison; williamr@2: } williamr@2: williamr@2: // Class RDbHandleBase williamr@2: inline RDbHandleBase::RDbHandleBase(): williamr@2: iObject(0) williamr@2: { williamr@2: } williamr@2: williamr@2: // Class RDbRowSet williamr@2: williamr@2: /** Positions the cursor at the beginning of the rowset. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline void RDbRowSet::BeginningL() williamr@2: { williamr@2: GotoL(EBeginning); williamr@2: } williamr@2: williamr@2: /** Positions the cursor at the end of the rowset. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline void RDbRowSet::EndL() williamr@2: { williamr@2: GotoL(EEnd); williamr@2: } williamr@2: williamr@2: /** Positions the cursor on the first row in the rowset. If there are no rows, williamr@2: the cursor is positioned at the end. williamr@2: williamr@2: @return ETrue if the cursor is now at a row, EFalse if it is at the end. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline TBool RDbRowSet::FirstL() williamr@2: { williamr@2: return GotoL(EFirst); williamr@2: } williamr@2: williamr@2: /** Positions the cursor on the last row in the rowset. If there are no rows, the williamr@2: cursor is positioned at the beginning. williamr@2: williamr@2: @return ETrue if the cursor is now at a row, EFalse if it is at the beginning. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline TBool RDbRowSet::LastL() williamr@2: { williamr@2: return GotoL(ELast); williamr@2: } williamr@2: williamr@2: /** Moves the cursor to the next row in the rowset. If there are no more rows, williamr@2: the cursor is positioned to the end. williamr@2: williamr@2: If the cursor is at the beginning prior to the function, it is equivalent williamr@2: to FirstL(). williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline TBool RDbRowSet::NextL() williamr@2: { williamr@2: return GotoL(ENext); williamr@2: } williamr@2: williamr@2: /** Moves the cursor to the previous row in the rowset. If there are no more rows, williamr@2: the cursor is positioned to the beginning. williamr@2: williamr@2: If the cursor is at the end prior to the function, it is equivalent to LastL(). williamr@2: williamr@2: @return ETrue if the cursor is now at a row, EFalse if it is at the beginning. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline TBool RDbRowSet::PreviousL() williamr@2: { williamr@2: return GotoL(EPrevious); williamr@2: } williamr@2: williamr@2: /** Tests whether a column has the NULL value. williamr@2: williamr@2: Columns which have the NULL value can still be extracted with the correct williamr@2: accessor function, in which case numerical columns will return a 0 (or equivalent) williamr@2: value, and text and binary columns will have a zero length. williamr@2: williamr@2: @param aCol The column ordinal for the column to test. williamr@2: @return ETrue if column aCol is NULL, otherwise EFalse. */ williamr@2: inline TBool RDbRowSet::IsColNull(TDbColNo aCol) const williamr@2: { williamr@2: return ColSize(aCol)==0; williamr@2: } williamr@2: williamr@2: /** Extracts a signed integer column value. The type should fit within a TInt. williamr@2: williamr@2: @param aCol The column ordinal of the column to extract. williamr@2: @return The value of column aCol. */ williamr@2: inline TInt RDbRowSet::ColInt(TDbColNo aCol) const williamr@2: { williamr@2: return ColInt32(aCol); williamr@2: } williamr@2: williamr@2: /** Extracts an unsigned integer column value. williamr@2: williamr@2: @param aCol The column ordinal of the column to extract. williamr@2: @return The value of column aCol. */ williamr@2: inline TUint RDbRowSet::ColUint(TDbColNo aCol) const williamr@2: { williamr@2: return ColUint32(aCol); williamr@2: } williamr@2: williamr@2: /** Extracts a TReal64 column value. williamr@2: williamr@2: @param aCol The column ordinal of the column to extract. williamr@2: @return The value of column aCol. */ williamr@2: inline TReal RDbRowSet::ColReal(TDbColNo aCol) const williamr@2: { williamr@2: return ColReal64(aCol); williamr@2: } williamr@2: williamr@2: /** Sets a signed integer column value. The type should fit into a TInt. williamr@2: williamr@2: @param aCol The column ordinal of the column to set. williamr@2: @param aValue The new column value. */ williamr@2: inline void RDbRowSet::SetColL(TDbColNo aCol,TInt aValue) williamr@2: { williamr@2: SetColL(aCol, TInt32(aValue)); williamr@2: } williamr@2: williamr@2: /** Sets a signed integer column value. The type should fit into a TInt. williamr@2: williamr@2: @param aCol The column ordinal of the column to set. williamr@2: @param aValue The new column value. */ williamr@2: inline void RDbRowSet::SetColL(TDbColNo aCol,TUint aValue) williamr@2: { williamr@2: SetColL(aCol,TUint32(aValue)); williamr@2: } williamr@2: williamr@2: // Class TDbWindow williamr@2: /** Constructs this object with a size of ENone. This can be used to request a williamr@2: view with no pre-evaluation window. */ williamr@2: inline TDbWindow::TDbWindow(): williamr@2: iSize(ENone) williamr@2: { williamr@2: } williamr@2: williamr@2: /** Constructs this object with a size of EUnlimited. This is used to request a williamr@2: completely pre-evaluated view. The constant KDbUnlimitedWindow is an instance williamr@2: of such a TDbWindow. williamr@2: williamr@2: @param The argument is only used to direct the compiler to construct an unlimited williamr@2: window. */ williamr@2: inline TDbWindow::TDbWindow(TUnlimited): williamr@2: iSize(EUnlimited) williamr@2: { williamr@2: } williamr@2: williamr@2: /** Returns the number of rows stored by the view. williamr@2: williamr@2: @return The number of rows stored by the window. This could be one of the williamr@2: special values ENone or EUnlimited. */ williamr@2: inline TInt TDbWindow::Size() const williamr@2: { williamr@2: return iSize; williamr@2: } williamr@2: williamr@2: /** Returns the preferred position in the window of the current row marker. i.e. williamr@2: the position with the forward and backward slots as requested. williamr@2: williamr@2: @return The preferred position in the window. It is undefined if this is not williamr@2: a limited window. */ williamr@2: inline TInt TDbWindow::PreferredPos() const williamr@2: { williamr@2: return iPreferredPos; williamr@2: } williamr@2: williamr@2: // Class TUnion williamr@2: template williamr@2: inline TUnion::operator const T&() const williamr@2: { williamr@2: return *(const T*)&iRep[0]; williamr@2: } williamr@2: williamr@2: template williamr@2: inline const T& TUnion::operator()() const williamr@2: { williamr@2: return *(const T*)&iRep[0]; williamr@2: } williamr@2: williamr@2: template williamr@2: inline T& TUnion::operator()() williamr@2: { williamr@2: return *(T*)&iRep[0]; williamr@2: } williamr@2: williamr@2: template williamr@2: inline void TUnion::Set(const T& aT) williamr@2: { williamr@2: new(&iRep[0]) T(aT); williamr@2: } williamr@2: williamr@2: // Class TDbLookupKey williamr@2: inline TDbLookupKey::TDbLookupKey(): williamr@2: iCount(0) williamr@2: { williamr@2: } williamr@2: williamr@2: inline TInt TDbLookupKey::Count() const williamr@2: { williamr@2: return iCount; williamr@2: } williamr@2: williamr@2: inline const TDbLookupKey::SColumn* TDbLookupKey::First() const williamr@2: { williamr@2: return &iKey[0]; williamr@2: } williamr@2: williamr@2: // Class TDbSeekKey williamr@2: /** Constructs an empty key value. williamr@2: williamr@2: Add() should be called before the key value is used for lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: } williamr@2: williamr@2: /** Constructs a key value for an TInt8, TInt16 or TInt32 column. williamr@2: williamr@2: @param aKey The key value to lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(TInt aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: /** Constructs a key value for a Bit, TUint8, TUint16 or TUint32 column. williamr@2: williamr@2: @param aKey The key value to lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(TUint aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: inline TDbSeekKey::TDbSeekKey(TInt64 aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: /** Constructs a key value for a TReal32 column. williamr@2: williamr@2: @param aKey The key value to lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(TReal32 aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: /** Construct a key value for a TReal64 column. williamr@2: williamr@2: @param aKey The key value to lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(TReal64 aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: /** Constructs a key value for a TDateTime column. williamr@2: williamr@2: @param aKey The key value to lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(TTime aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: /** Constructs a key value for a non-Unicode text column. williamr@2: williamr@2: Note that the seek key does not copy the text data contained by the descriptor. williamr@2: This needs to be retained until the seek key is no longer required. williamr@2: williamr@2: @param aKey The key value to lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(const TDesC8& aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: /** Constructs a key value for a Unicode text column. williamr@2: williamr@2: Note that the seek key does not copy the text data contained by the descriptor. williamr@2: This needs to be retained until the seek key is no longer required. williamr@2: williamr@2: @param aKey The key value to lookup. */ williamr@2: inline TDbSeekKey::TDbSeekKey(const TDesC16& aKey): williamr@2: iMaxKeys(1) williamr@2: { williamr@2: Add(aKey); williamr@2: } williamr@2: williamr@2: inline TDbSeekKey::TDbSeekKey(TInt aKeys,TInt): williamr@2: iMaxKeys(aKeys) williamr@2: { williamr@2: } williamr@2: williamr@2: // Class TDbSeekMultiKey williamr@2: /** Constructs an empty multi-column key value. */ williamr@2: template williamr@2: inline TDbSeekMultiKey::TDbSeekMultiKey(): williamr@2: TDbSeekKey(S,0) williamr@2: { williamr@2: } williamr@2: williamr@2: // Class RDbTable williamr@2: /** Sets the specified index as the active index for this table. The rows will williamr@2: be presented in index order, and this index key will be used for lookup by williamr@2: the SeekL() function. williamr@2: williamr@2: If successful, the rowset is reset to the beginning. williamr@2: williamr@2: @param anIndex The name of the index to activate. williamr@2: @return KErrNone, if successful, otherwise one of the system-wide error codes. williamr@2: Specifically:KErrWrite if the table was created with insert-only access.KErrNotFound williamr@2: if the index does not exist on the table. This can also be one of the DBMS williamr@2: database error codes. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline TInt RDbTable::SetIndex(const TDesC& anIndex) williamr@2: { williamr@2: return SetIndex(&anIndex); williamr@2: } williamr@2: williamr@2: /** Sets the ordering to be the underlying ordering of the rows — this will williamr@2: usually provide faster navigation of the rowset. williamr@2: williamr@2: @return KErrNone, if successful, otherwise one of the system-wide error codes. williamr@2: Specifically:KErrWrite if the table was created with insert-only access. This williamr@2: can also be one of the DBMS database error codes. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the read williamr@2: access policy for the table. williamr@2: */ williamr@2: inline TInt RDbTable::SetNoIndex() williamr@2: { williamr@2: return SetIndex(0); williamr@2: } williamr@2: williamr@2: /** Constructs this object by invoking the matching constructor for RWriteStream. williamr@2: williamr@2: @param anExternalizer Specifies an externaliser */ williamr@2: inline RDbColWriteStream::RDbColWriteStream(const MExternalizer &anExternalizer): williamr@2: RWriteStream(anExternalizer) williamr@2: { williamr@2: } williamr@2: williamr@2: // Class CDbNames williamr@2: inline TInt CDbNames::Count() const williamr@2: { williamr@2: return iList.Count(); williamr@2: } williamr@2: williamr@2: inline const TDesC& CDbNames::operator[](TInt anIndex) const williamr@2: { williamr@2: return iList[anIndex]; williamr@2: } williamr@2: williamr@2: // Class RDbDatabase williamr@2: williamr@2: /** williamr@2: Creates a table on the database. williamr@2: williamr@2: @param aName Table name. williamr@2: @param aColSet A set of column definitions which describe the table structure. williamr@2: williamr@2: @return KErrNone The operation has completed successfully; williamr@2: KErrNoMemory, an out of memory condition has occurred; williamr@2: KErrAlreadyExists, a table with that name already exists; williamr@2: KErrArgument, empty column set, duplicated column name, invalid column length; williamr@2: KErrBadName, invalid table name, invalid column name (containing spaces for example); williamr@2: KErrNotSupported, unknown column type, unknown column attributes; williamr@2: KErrPermissionDenied, the caller does not satisfy the relevant database security policies. williamr@2: Note that other system-wide error codes may also be returned. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the schema williamr@2: access policy for the database. williamr@2: */ williamr@2: inline TInt RDbDatabase::CreateTable(const TDesC& aName,const CDbColSet& aColSet) williamr@2: { williamr@2: return CreateTable(aName,aColSet,NULL); williamr@2: } williamr@2: williamr@2: /** williamr@2: Creates a table on the database. williamr@2: williamr@2: @param aName Table name. williamr@2: @param aColSet A set of column definitions which describe the table structure. williamr@2: @param aPrimaryKey Primary key definition. williamr@2: williamr@2: @return KErrNone The operation has completed successfully; williamr@2: KErrNoMemory, an out of memory condition has occurred; williamr@2: KErrAlreadyExists, a table with that name already exists; williamr@2: KErrArgument, empty column set, duplicated column name, invalid column length; williamr@2: KErrBadName, invalid table name, invalid column name (containing spaces for example); williamr@2: KErrNotSupported, unknown column type, unknown column attributes; williamr@2: KErrPermissionDenied, the caller does not satisfy the relevant database security policies. williamr@2: Note that other system-wide error codes may also be returned. williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy the schema williamr@2: access policy for the database. williamr@2: */ williamr@2: inline TInt RDbDatabase::CreateTable(const TDesC& aName,const CDbColSet& aColSet,const CDbKey& aPrimaryKey) williamr@2: { williamr@2: return CreateTable(aName,aColSet,&aPrimaryKey); williamr@2: } williamr@2: williamr@2: // Class RDbIncremental williamr@2: /** Initiates the execution of a DDL (SQL schema update) statement on the database. williamr@2: williamr@2: This is the incremental form of RDbDatabase::Execute(). williamr@2: williamr@2: Note that to begin executing a DML (SQL data update) statement incrementally, williamr@2: use the RDbUpdate class. williamr@2: williamr@2: @param aDatabase The database on which the DDL (SQL schema update) statement williamr@2: is to execute. williamr@2: @param aSql The DDL SQL statement to be executed on the database. williamr@2: @param aStep On return, contains the initial step count for the incremental williamr@2: operation. This value should be passed in to subsequent calls to Next() to williamr@2: continue the operation. williamr@2: @return KErrNone if successful, otherwise another of the system-wide error williamr@2: codes. williamr@2: @see RDbDatabase::Execute() williamr@2: @see RDbUpdate williamr@2: williamr@2: @capability Note For a secure shared database, the caller must satisfy: williamr@2: - the schema access policy for the database, if the SQL statement is williamr@2: CREATE/DROP/ALTER; williamr@2: - the write access policy for the table in the SQL, if the SQL statement is williamr@2: INSERT/UPDATE/DELETE; williamr@2: */ williamr@2: inline TInt RDbIncremental::Execute(RDbDatabase& aDatabase,const TDesC& aSql,TInt& aStep) williamr@2: { williamr@2: return Execute(aDatabase,aSql,EDbCompareNormal,aStep); williamr@2: } williamr@2: williamr@2: //////////////////////////////////////////////////////////////////////////////////////////// williamr@2: // CDbStrings class williamr@2: williamr@2: /** williamr@2: @return The number of elements of the controlled strings array. williamr@2: */ williamr@2: inline TInt CDbStrings::Count() const williamr@2: { williamr@2: return iList.Count(); williamr@2: } williamr@2: williamr@2: /** williamr@2: Allows access to "aIndex" element of the controlled strings array. williamr@2: @return "aIndex" element of the controlled strings array. williamr@2: */ williamr@2: inline const TDesC& CDbStrings::operator[](TInt aIndex) const williamr@2: { williamr@2: return iList[aIndex]; williamr@2: }