本文整理汇总了C++中RSqlStatement::ColumnIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ RSqlStatement::ColumnIndex方法的具体用法?C++ RSqlStatement::ColumnIndex怎么用?C++ RSqlStatement::ColumnIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSqlStatement
的用法示例。
在下文中一共展示了RSqlStatement::ColumnIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetListForItemL
/**
GetListForItemL has a dual nature. If aIsGroup is ETrue, a list of contact items belonging to
specified group is returned. Otherwise a list of group ids to which contact id belongs is returned.
@param aItemId contact item id
@param aIsGroup ETrue if the method will fill a group.
*/
CContactIdArray* CPplGroupsTable::GetListForItemL(TContactItemId aItemId, TBool aIsGroup)
{
/*
// Check if group membership information was not requested or if the item
// is not derived from CContactItemPlusGroup.
if (!(aType == KUidContactGroup || aType == KUidContactCard ||
aType == KUidContactOwnCard || aType == KUidContactICCEntry) )
{
return NULL;
}
*/
// build the RSqlStatement
RSqlStatement stmnt;
CleanupClosePushL(stmnt);
TInt idIndex;
// build the CCntSqlStatement statement
const TInt KWhereParamIndex(KFirstIndex); // only one parameter in the query
if (aIsGroup)
{
// group -> select members
stmnt.PrepareL(iDatabase, iSelectMembersStmnt->SqlStringL() );
User::LeaveIfError(stmnt.BindInt(KWhereParamIndex, aItemId ) );
idIndex = stmnt.ColumnIndex(KGroupContactGroupMemberId() );
}
else
{
// member -> select groups
stmnt.PrepareL(iDatabase, iSelectGroupsStmnt->SqlStringL() );
User::LeaveIfError(stmnt.BindInt(KWhereParamIndex, aItemId ) );
idIndex = stmnt.ColumnIndex(KGroupContactGroupId() );
}
User::LeaveIfError(idIndex);
// fetch the list of any matching ids
CContactIdArray* items = CContactIdArray::NewLC();
TInt err(KErrNone);
while ((err = stmnt.Next() ) == KSqlAtRow)
{
items->AddL(stmnt.ColumnInt(idIndex) );
}
// leave if we didn't complete going through the results properly
if(err != KSqlAtEnd)
{
User::Leave(err);
}
CleanupStack::Pop(items);
CleanupStack::PopAndDestroy(&stmnt);
return items;
}
示例2: GetAllFilenamesL
// -----------------------------------------------------------------------------
// CUpnpSecurityDbConnection::GetAllFilenamesL
// Get all filenames.
// -----------------------------------------------------------------------------
//
void CUpnpSecurityDbConnection::GetAllFilenamesL(
RPointerArray<HBufC>& aFilenameArray )
{
TInt err;
RSqlStatement statement;
User::LeaveIfError( statement.Prepare( iDatabase, KUpnpSecSqlSelectAllFiles ) );
CleanupClosePushL( statement );
TInt columnIndex = statement.ColumnIndex( KUpnpSecSqlFilename );
while ( (err = statement.Next()) == KSqlAtRow )
{
TPtrC data = statement.ColumnTextL( columnIndex );
HBufC* filename = data.AllocLC();
aFilenameArray.AppendL( filename );
CleanupStack::Pop( filename );
}
if ( err != KSqlAtEnd )
{
User::LeaveIfError( err );
}
CleanupStack::PopAndDestroy( &statement );
}
示例3: ReadBinaryBlobL
/**
Utility method used to read binary blob fields from contacts database. Provides a mechanism to
fill a contact item with informations stored in binary blobs within contact database.
A reference to the contact item to be fill has to be provided. A template has to be provided
if the contact item is based on a template. Template can be NULL. Also a view definition can
be provided to filter which fields are read from blob fields.
@param aItem Contact item to be filled with information from binary blob field.
@param aView View definition specifying what item fields should be read from binary blob field
@param aTemplate Contact item representing a template based on which aItem should be read. Can be NULL
@param aDatabase RSqlDatabase reference.
@leave KErrNotFound if the specified contact item does not exist any more in contact database
*/
void TCntPersistenceUtility::ReadBinaryBlobL(CContactItem& aItem, const CContactItemViewDef& aView, const CContactItem* aTemplate, RSqlDatabase& aDatabase)
{
HBufC* selectString = HBufC::NewLC(KSelectTwoFields().Length() + KContactBinaryFieldHeader().Length() + KContactBinaryFields().Length() + KSqlContactTableName().Length() + KContactId().Length());
TPtr ptrSelectString = selectString->Des();
ptrSelectString.Format(KSelectTwoFields, &KContactBinaryFieldHeader, &KContactBinaryFields, &KSqlContactTableName, &KContactId, aItem.Id());
RSqlStatement selectStmt;
CleanupClosePushL(selectStmt);
User::LeaveIfError(selectStmt.Prepare(aDatabase, ptrSelectString));
TInt err = selectStmt.Next();
if(err != KSqlAtRow)
{
if(err == KSqlAtEnd)
{
User::Leave(KErrNotFound);
}
else
{
User::Leave(err);
}
}
TPtrC8 binaryHeader;
selectStmt.ColumnBinary(User::LeaveIfError(selectStmt.ColumnIndex(KContactBinaryFieldHeader)), binaryHeader);
RDesReadStream binaryHeaderStream(binaryHeader);
CleanupClosePushL(binaryHeaderStream);
CEmbeddedStore* binaryHeaderStore = CEmbeddedStore::FromLC(binaryHeaderStream);
TPtrC8 binaryFields;
selectStmt.ColumnBinary(User::LeaveIfError(selectStmt.ColumnIndex(KContactBinaryFields)), binaryFields);
RDesReadStream binaryFieldsStream(binaryFields);
CleanupClosePushL(binaryFieldsStream);
CEmbeddedStore* binaryBlobStore = CEmbeddedStore::FromLC(binaryFieldsStream);
ReadBinaryBlobL(*binaryHeaderStore, *binaryBlobStore, aItem, aView, aTemplate);
CleanupStack::PopAndDestroy(6, selectString); //binaryHeaderStore, binaryHeaderStrean, binaryBlobStore, binaryBlobStream, selectStmt, selectString
}
示例4: GetAllIpAddressesL
// -----------------------------------------------------------------------------
// CUpnpSecurityDbConnection::GetAllIpAddressesL
// Get all ips.
// -----------------------------------------------------------------------------
//
void CUpnpSecurityDbConnection::GetAllIpAddressesL(
RArray<TInetAddr>& aAddressArray )
{
TInt err;
RSqlStatement statement;
User::LeaveIfError( statement.Prepare( iDatabase,
KUpnpSecSqlSelectAllIpAddresses ) );
CleanupClosePushL( statement );
TInt columnIndex = statement.ColumnIndex( KUpnpSecSqlIp );
while ( (err = statement.Next()) == KSqlAtRow )
{
TUint32 data = statement.ColumnInt( columnIndex );
aAddressArray.AppendL( TInetAddr( data, 0 ) );
}
if ( err != KSqlAtEnd )
{
User::LeaveIfError( err );
}
CleanupStack::PopAndDestroy( &statement );
}