metadataengine/server/src/mdsindexer.cpp
branchRCL_3
changeset 6 646a02f170b9
parent 0 c53acadfccc6
equal deleted inserted replaced
3:6752808b2036 6:646a02f170b9
    39 	--iId;
    39 	--iId;
    40 	}
    40 	}
    41 
    41 
    42 void MMdSIndexer::GetLastItemIdL()
    42 void MMdSIndexer::GetLastItemIdL()
    43 	{
    43 	{
    44 	_LIT( KGetLastMaxId, "SELECT max(seq) FROM SQLITE_SEQUENCE WHERE name!='symbian_security';" );
    44 	_LIT( KGetLastMaxId, "SELECT max(seq) FROM SQLITE_SEQUENCE WHERE name!='symbian_security' LIMIT 1;" );
    45 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
    45 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
    46 
    46 
    47 	RRowData getData;
    47 	RRowData getData;
    48 	CleanupClosePushL(getData);
    48 	CleanupClosePushL(getData);
    49 
    49 
    62 	CleanupStack::PopAndDestroy(2, &getData);
    62 	CleanupStack::PopAndDestroy(2, &getData);
    63 	}
    63 	}
    64 
    64 
    65 TItemId MMdSIndexer::GetIndexL()
    65 TItemId MMdSIndexer::GetIndexL()
    66 	{
    66 	{
    67 	_LIT( KIndexerQuery, "SELECT last_insert_rowid();" );
       
    68 
       
    69 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
    67 	CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
    70 
    68 	return connection.LastInsertedRowId();
    71 	RRowData getData;
       
    72 	CleanupClosePushL(getData);
       
    73 
       
    74 	RMdsStatement selectObject;
       
    75 	CleanupClosePushL(selectObject);
       
    76 
       
    77 	TItemId id = KNoId;
       
    78 	//Get one row and set first column to id
       
    79 	connection.ExecuteQueryL(KIndexerQuery,selectObject,getData);
       
    80 	getData.AppendL(TColumn(id));
       
    81 	if (connection.NextRowL(selectObject, getData))
       
    82 		{
       
    83 		getData.Column(0).Get(id);
       
    84 		}
       
    85 
       
    86 	CleanupStack::PopAndDestroy(2, &getData);
       
    87 	return id;
       
    88 	}
    69 	}
    89 
    70 
    90 TItemId MMdSIndexer::ExecuteAndGetIndexL( const TDesC &aSqlClause,
    71 TItemId MMdSIndexer::ExecuteAndGetIndexL( const TDesC &aSqlClause,
    91 	    								 const RRowData& aRowData )
    72 	    								 const RRowData& aRowData )
    92     {
    73     {