本文整理汇总了C++中CCommsDbTableView::PutRecordChanges方法的典型用法代码示例。如果您正苦于以下问题:C++ CCommsDbTableView::PutRecordChanges方法的具体用法?C++ CCommsDbTableView::PutRecordChanges怎么用?C++ CCommsDbTableView::PutRecordChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCommsDbTableView
的用法示例。
在下文中一共展示了CCommsDbTableView::PutRecordChanges方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TPtrC
TInt CCommDbTest036_02::executeStepL()
{
CCommsDbTemplateRecord* templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(MODEM_BEARER));
CleanupStack::PushL(templateRecord);
User::LeaveIfError(templateRecord->Modify());
TBufC8<KCommsDbSvrMaxFieldLength> firstInputString = _L8("string");
templateRecord->WriteTextL(TPtrC(COMMDB_NAME), _L("DummyName"));
templateRecord->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING), firstInputString);
User::LeaveIfError(templateRecord->StoreModifications());
CleanupStack::PopAndDestroy(templateRecord);
//Create a view on the modem table, over write the template value previosly set and check it sticks
CCommsDbTableView* tableView = iTheDb->OpenTableLC(TPtrC(MODEM_BEARER));
TUint32 dummyId;
//Create a new record, so we can be sure it is the same as the templated one
User::LeaveIfError(tableView->InsertRecord(dummyId));
tableView->WriteTextL(TPtrC(COMMDB_NAME), _L("NewModem"));
//Do overwrite of setting
TBufC8<KCommsDbSvrMaxFieldLength> overwriteString = _L8("different string");
tableView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING), overwriteString);
User::LeaveIfError(tableView->PutRecordChanges());
TBuf8<KCommsDbSvrMaxFieldLength> retrievedString;
tableView->ReadTextL(TPtrC(MODEM_FAX_INIT_STRING), retrievedString);
CleanupStack::PopAndDestroy(tableView);
if(retrievedString!=overwriteString)
return KErrGeneral;
return KErrNone;
}
示例2: SetLocalIpAddrL
/**
* Function that takes an IP address from user input, accesses the
* Bluetooth PAN Profile table in the CommDb and updates the IpAddr
* field with the supplied address.
*/
void CPanConnections::SetLocalIpAddrL(TUint32 addr)
{
iLocalIpAddr = addr;
iSrcAddr.SetAddress(iLocalIpAddr);
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
// Get the LAN service table
CCommsDbTableView* tableView = db->OpenTableLC(TPtrC(LAN_SERVICE));
TBuf<KMaxBufferSize> tableName;
TInt err = tableView->GotoFirstRecord();
if(err == KErrNone)
{
// Get the name of the table
tableView->ReadTextL(TPtrC(COMMDB_NAME), tableName);
if(tableName == TPtrC(_S("BluetoothPANProfile")))
{
TInetAddr tempAddr;
TBuf<KMaxBufferSize> dispBuf;
tempAddr.SetAddress(iLocalIpAddr);
tempAddr.Output(dispBuf);
User::LeaveIfError(tableView->UpdateRecord());
tableView->WriteTextL(_L("IpAddr"), dispBuf);
User::LeaveIfError(tableView->PutRecordChanges());
User::LeaveIfError(db->CommitTransaction());
}
}
else
{
User::Leave(KErrNotFound);
}
CleanupStack::PopAndDestroy(2);//db & tableView
}
示例3: storeWPADataL
void XQAccessPointManagerPrivate::storeWPADataL(const TInt aIapId, const TDesC& aPresharedKey, const XQWLAN& aWlan)
{
CCommsDbTableView* wLanServiceTable;
CApUtils* apUtils = CApUtils::NewLC(*ipCommsDB);
TUint32 iapId = apUtils->IapIdFromWapIdL(aIapId);
CleanupStack::PopAndDestroy(apUtils);
TUint32 serviceId;
CCommsDbTableView* iapTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(IAP),
TPtrC(COMMDB_ID),
iapId);
User::LeaveIfError(iapTable->GotoFirstRecord());
iapTable->ReadUintL(TPtrC(IAP_SERVICE), serviceId);
CleanupStack::PopAndDestroy( iapTable );
wLanServiceTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(XQ_WLAN_SERVICE),
TPtrC(XQ_WLAN_SERVICE_ID),
serviceId );
TInt errorCode = wLanServiceTable->GotoFirstRecord();
if (errorCode == KErrNone) {
User::LeaveIfError(wLanServiceTable->UpdateRecord());
} else {
TUint32 dummyUid(0);
User::LeaveIfError(wLanServiceTable->InsertRecord(dummyUid));
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SERVICE_ID), aIapId);
}
CleanupCancelPushL(*wLanServiceTable);
TBool usesPsk(aWlan.usesPreSharedKey());
// Save WPA Mode
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_ENABLE_WPA_PSK), usesPsk);
// Save security mode
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SECURITY_MODE),
fromQtSecurityModeToS60SecurityMode(aWlan.securityMode()));
// Save PreShared Key
TBuf8<KWpaKeyMaxLength> keyWPA;
//convert to 8 bit
keyWPA.Copy(aPresharedKey);
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WPA_PRE_SHARED_KEY),keyWPA);
// Check and save PreShared Key Length
TInt len(keyWPA.Length());
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WPA_KEY_LENGTH),len);
User::LeaveIfError(wLanServiceTable->PutRecordChanges());
CleanupStack::Pop(wLanServiceTable); // table rollback...
CleanupStack::PopAndDestroy(wLanServiceTable);
}
示例4: ret
TInt CCommDbTest036_06::executeStepL()
{
CCommsDbTemplateRecord* templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(DIAL_IN_ISP));
CleanupStack::PushL(templateRecord);
User::LeaveIfError(templateRecord->Modify());
TBufC<KCommsDbSvrMaxFieldLength> inputString = _L("test string");
templateRecord->WriteTextL(TPtrC(COMMDB_NAME), _L("Name"));
// templateRecord->WriteTextL(TPtrC(ISP_IF_NAME), _L("SLIP"));
templateRecord->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER), ETrue);
templateRecord->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER), ETrue);
templateRecord->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER), ETrue);
templateRecord->WriteLongTextL(TPtrC(ISP_LOGIN_SCRIPT), inputString);
User::LeaveIfError(templateRecord->StoreModifications());
CleanupStack::PopAndDestroy(templateRecord);
//Create a view on the DialInISP table, make a new record and change the value we set int he template
CCommsDbTableView* tableView = iTheDb->OpenTableLC(TPtrC(DIAL_IN_ISP));
TUint32 dummyId;
//Create a new record, so we can be sure it is the same as the templated one
User::LeaveIfError(tableView->InsertRecord(dummyId));
tableView->WriteTextL(TPtrC(COMMDB_NAME), _L("Test ISP"));
// tableView->WriteTextL(TPtrC(ISP_IF_NAME), _L("Test If"));
tableView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER), EFalse);
tableView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER), EFalse);
tableView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER), EFalse);
//Overwrite value set above in template
TBufC<KCommsDbSvrMaxFieldLength> overwriteString = _L("new string");
tableView->WriteLongTextL(TPtrC(ISP_LOGIN_SCRIPT), overwriteString);
User::LeaveIfError(tableView->PutRecordChanges());
//Retrieve the string we just set
HBufC* retrievedString = tableView->ReadLongTextLC(TPtrC(ISP_LOGIN_SCRIPT));
TInt ret(KErrNone);
if(*retrievedString!=overwriteString)
ret= KErrGeneral;
CleanupStack::PopAndDestroy(); //retrievedString
CleanupStack::PopAndDestroy(tableView);
return ret;
}
示例5: ConfigureIAPL
/**
* Function that accesses the PAN Service Table in the CommsDb and configures
* the IAP to the required settings.
*/
void CPanConnections::ConfigureIAPL(TBool aIsListening, TBTDevAddr* aDevAddr, TBool aUsePANNotifier)
{
// Open CommDb and get a view of the PAN service extentions table.
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
CCommsDbTableView* tableView = db->OpenTableLC(TPtrC(PAN_SERVICE_EXTENSIONS));
TBuf<KMaxBufferSize> tableName;
TInt err = tableView->GotoFirstRecord();
if(err == KErrNone)
{
tableView->ReadTextL(TPtrC(COMMDB_NAME), tableName);
if(tableName == TPtrC(_S("PANServiceExtensionsTable1")))
{
User::LeaveIfError(tableView->UpdateRecord());// Start update
//enable listening mode
tableView->WriteBoolL(TPtrC(PAN_ALLOW_INCOMING),aIsListening);
tableView->WriteBoolL(TPtrC(PAN_DISABLE_SDP_QUERY), 0);
tableView->WriteBoolL(TPtrC(PAN_PROMPT_FOR_REMOTE_DEVICES), aUsePANNotifier);
if(aDevAddr)
{
TBuf<KMaxBufferSize> buf;
aDevAddr->GetReadable(buf);
tableView->WriteTextL(TPtrC(PAN_PEER_MAC_ADDRESSES), buf);
}
else
{
tableView->WriteTextL(TPtrC(PAN_PEER_MAC_ADDRESSES), _L(""));
}
// Finalise changes made.
User::LeaveIfError(tableView->PutRecordChanges());// Finish update
User::LeaveIfError(db->CommitTransaction());
CleanupStack::PopAndDestroy(2); // db & tableView
return;
}
}
User::Leave(KErrNotFound);
}
示例6: SetFixedRoleL
/**
* Function that accesses the PAN Service table in the CommDb
* and applies the appropriate role, this function will be used for
* local or peer as well as the PAN role (U or Gn).
*/
void CPanConnections::SetFixedRoleL(TSide aSide, TUint aRole)
{
if (aSide == ELocalRole)
iLocalRole = aRole;
else
iPeerRole = aRole;
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
CCommsDbTableView* tableView = db->OpenTableLC(TPtrC(PAN_SERVICE_EXTENSIONS));
TBuf<KMaxBufferSize> tableName;
TInt err = tableView->GotoFirstRecord();
if(err == KErrNone)
{
tableView->ReadTextL(TPtrC(COMMDB_NAME), tableName);
if(tableName == TPtrC(_S("PANServiceExtensionsTable1")))
{
User::LeaveIfError(tableView->UpdateRecord());
if(aSide == ELocalRole)
{
tableView->WriteBoolL(TPtrC(PAN_LOCAL_ROLE), aRole);
}
else
{
tableView->WriteBoolL(TPtrC(PAN_PEER_ROLE), aRole);
}
User::LeaveIfError(tableView->PutRecordChanges());
User::LeaveIfError(db->CommitTransaction());
CleanupStack::PopAndDestroy(2);
return;
}
}
User::Leave(KErrNotFound);
}
示例7: storeWEPDataL
//.........这里部分代码省略.........
CleanupStack::PopAndDestroy(iapTable);
wLanServiceTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(XQ_WLAN_SERVICE),
TPtrC(XQ_WLAN_SERVICE_ID),
serviceId);
TInt errorCode = wLanServiceTable->GotoFirstRecord();
if (errorCode == KErrNone) {
User::LeaveIfError(wLanServiceTable->UpdateRecord());
}
else {
TUint32 dummyUid = 0;
User::LeaveIfError(wLanServiceTable->InsertRecord(dummyUid));
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SERVICE_ID), aIapId);
}
CleanupCancelPushL(*wLanServiceTable);
// Save index of key in use
TUint32 keyInUse(KFirstWepKey);
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WEP_INDEX), keyInUse);
// Save authentication mode
TUint32 auth(0); // set to open...
if (isS60VersionGreaterThan3_1()) {
//TODO: wLanServiceTable->WriteUintL(TPtrC(NU_WLAN_AUTHENTICATION_MODE), auth);
} else {
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_AUTHENTICATION_MODE), auth);
}
// not we need to convert the key.... to 8bit and to hex... and again detect the required bits..
TBuf8<KMaxWepKeyLen> key;
//convert to 8 bit
key.Copy(aPresharedKey);
TBool useHex(EFalse);
TWepKeyLength keyLength;
TBool validKey = validWepKeyLength(aPresharedKey, useHex, keyLength);
if (!useHex) {
// Must be converted to hexa and stored as a hexa
// Ascii key is half the length of Hex
HBufC8* buf8Conv = HBufC8::NewLC(key.Length() * 2);
asciiToHex(key, buf8Conv);
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY1), buf8Conv->Des());
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY1), buf8Conv->Des());
}
CleanupStack::PopAndDestroy(buf8Conv);
} else if (isHex(aPresharedKey)) {
//already in hexa format
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY1), key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY1), key);
}
}
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WEP_KEY1_FORMAT), useHex);
key.Zero();
// write default values to the rest of the columns
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY2),
key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY2),
key );
}
// Save third WEP key
if (isS60VersionGreaterThan3_1()) {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_HEX_WEP_KEY3),
key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY3),
key);
}
// Save fourth WEP key
if (isS60VersionGreaterThan3_1()) {
//TODO: wLanServiceTable->WriteTextL(TPtrC(NU_WLAN_WEP_KEY4),
// key);
} else {
wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WEP_KEY4),
key);
}
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WEP_KEY2_FORMAT),
(TUint32&)useHex);
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WEP_KEY3_FORMAT),
(TUint32&)useHex);
wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WEP_KEY4_FORMAT),
(TUint32&)useHex);
wLanServiceTable->PutRecordChanges();
CleanupStack::Pop(wLanServiceTable); // table rollback...
CleanupStack::PopAndDestroy(wLanServiceTable);
}