/** * Method to read the IsEnabled flag from plugin Id table * @param aPluginID The ID of the plugin * @param aFlag [out] The flag that indicates the plugin id is enables or disabled */ void CSmfCredMgrDbUser::readFlagInPluginIdTable(const TDesC& aPluginID, TInt& aFlag) { TInt err(KErrNone); RSqlStatement sqlReadStatement; TInt paramIndex(KErrNone); err = sqlReadStatement.Prepare(iDataBase, KSmfDbReadFlagInPluginTable); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); paramIndex = sqlReadStatement.ParameterIndex(_L(":iID")); err = sqlReadStatement.BindText(paramIndex, aPluginID); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); while ((err = sqlReadStatement.Next()) == KSqlAtRow) { //sometimes sqlStmt.Next returns KSqlAtRow even if no row is present if (!sqlReadStatement.IsNull(0)) { aFlag = sqlReadStatement.ColumnInt(0); } } sqlReadStatement.Close(); }
/** * Method to fetch Authentication app ID from RegTokenValidityTable * giving the reg token * @param aRegToken The Registration token of the authentication app * @param aAuthAppId [out] The ID of the Authentication app */ void CSmfCredMgrDbUser::readAuthAppIdInRegTokenTable(const TDesC& aRegToken, TDes& aAuthAppId) { TInt err(KErrNone); RSqlStatement sqlReadStatement; TInt paramIndex(KErrNone); TInt64 duration; TBuf<KMaxBufSize> tokenBuf(aRegToken); err = sqlReadStatement.Prepare(iDataBase, KSmfDbReadAuthAppIdInRegTokenTable); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); paramIndex = sqlReadStatement.ParameterIndex(_L(":iID")); err = sqlReadStatement.BindText(paramIndex, tokenBuf); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); while ((err = sqlReadStatement.Next()) == KSqlAtRow) { //sometimes sqlStmt.Next returns KSqlAtRow even if no row is present if (!sqlReadStatement.IsNull(0)) { duration = sqlReadStatement.ColumnInt(1); if (duration) //to be checked with epoch date-time { sqlReadStatement.ColumnText(0, aAuthAppId); } } else { __ASSERT_DEBUG( 0, User::Invariant()); } } sqlReadStatement.Close(); }
/** * Method to fetch Registration token of the Authentication app from RegTokenValidityTable * @param aAuthAppId The ID of the Authentication app * @param aRegToken [out] The Registration token of the authentication app */ void CSmfCredMgrDbUser::readRegistrationTokenL(const TDesC& aAuthAppId, TDesC& aRegToken) { TInt err(KErrNone); RSqlStatement sqlReadStatement; TInt paramIndex(KErrNone); err = sqlReadStatement.Prepare(iDataBase, KSmfDbReadRegistrationToken); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); paramIndex = sqlReadStatement.ParameterIndex(_L(":iID")); err = sqlReadStatement.BindText(paramIndex, aAuthAppId); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); while ((err = sqlReadStatement.Next()) == KSqlAtRow) { //sometimes sqlStmt.Next returns KSqlAtRow even if no row is present if (!sqlReadStatement.IsNull(0)) { aRegToken = sqlReadStatement.ColumnTextL(0);//aKey.AllocL(); } else { __ASSERT_DEBUG( 0, User::Invariant()); } } sqlReadStatement.Close(); }
/** * Method to fetch Validity of the Authentication app * @param aAuthAppId The ID of the Authentication app * @param aValidity [out] The time by which the Auth set will expire */ void CSmfCredMgrDbUser::readValidity(const TDesC& aAuthAppId, TInt64& aValidity) { TInt err(KErrNone); RSqlStatement sqlReadStatement; TInt paramIndex(KErrNone); err = sqlReadStatement.Prepare(iDataBase, KSmfDbReadValidity); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); paramIndex = sqlReadStatement.ParameterIndex(_L(":iID")); err = sqlReadStatement.BindText(paramIndex, aAuthAppId); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); while ((err = sqlReadStatement.Next()) == KSqlAtRow) { //sometimes sqlStmt.Next returns KSqlAtRow even if no row is present if (!sqlReadStatement.IsNull(0)) { aValidity = sqlReadStatement.ColumnInt64(1); } else { __ASSERT_DEBUG( 0, User::Invariant()); } } sqlReadStatement.Close(); }
/** * Method to fetch all the URLs associated with the Authentication app * @param aAuthAppId The ID of the Authentication app * @param aArray [out] The array to be updated with URLs */ void CSmfCredMgrDbUser::readUrlL(const TDesC& aAuthAppId, RPointerArray<HBufC>& aArray) { TInt err(KErrNone); RSqlStatement sqlReadStatement; TInt paramIndex(KErrNone); err = sqlReadStatement.Prepare(iDataBase, KSmfDbReadURL); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); paramIndex = sqlReadStatement.ParameterIndex(_L(":iID")); err = sqlReadStatement.BindText(paramIndex, aAuthAppId); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); while ((err = sqlReadStatement.Next()) == KSqlAtRow) { //sometimes sqlStmt.Next returns KSqlAtRow even if no row is present if (!sqlReadStatement.IsNull(0)) { TBuf<KMaxBufSize> urlBuf; HBufC* buf = HBufC::NewL(KMaxBufSize); sqlReadStatement.ColumnText(0, urlBuf); buf->Des().Copy(urlBuf); aArray.Append(buf); } else { __ASSERT_DEBUG( 0, User::Invariant()); } } sqlReadStatement.Close(); }
/** * Method to Key-Secret pairs of the Authentication app * @param aAuthAppId The ID of the Authentication app * @param aArray [out] The array containing the key-secret pair */ void CSmfCredMgrDbUser::readAuthTokensL(const TDesC& aAuthAppId, RArray< TSmfAuthToken>& aArray) { TInt err(KErrNone); RSqlStatement sqlReadStatement; TInt paramIndex(KErrNone); err = sqlReadStatement.Prepare(iDataBase, KSmfDbReadAuthTokens); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); paramIndex = sqlReadStatement.ParameterIndex(_L(":iID")); err = sqlReadStatement.BindText(paramIndex, aAuthAppId); __ASSERT_DEBUG( (err >= KErrNone), User::Invariant()); while ((err = sqlReadStatement.Next()) == KSqlAtRow) { //sometimes sqlStmt.Next returns KSqlAtRow even if no row is present if (!sqlReadStatement.IsNull(0)) { TSmfAuthToken Set; Set.iKey = HBufC::NewL(KMaxAuthTokenLength); Set.iSecret = HBufC::NewL(KMaxAuthTokenLength); TBuf<KMaxBufSize> keyBuf; TBuf<KMaxBufSize> secretBuf; sqlReadStatement.ColumnText(0, keyBuf); sqlReadStatement.ColumnText(1, secretBuf); Set.iKey->Des().Copy(keyBuf); Set.iSecret->Des().Copy(secretBuf); //add it to the array aArray.Append(Set); } else { __ASSERT_DEBUG( 0, User::Invariant()); } } sqlReadStatement.Close(); }