本文整理汇总了C++中CCommsDbTableView::InsertRecord方法的典型用法代码示例。如果您正苦于以下问题:C++ CCommsDbTableView::InsertRecord方法的具体用法?C++ CCommsDbTableView::InsertRecord怎么用?C++ CCommsDbTableView::InsertRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCommsDbTableView
的用法示例。
在下文中一共展示了CCommsDbTableView::InsertRecord方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TPtrC
TInt CCommDbTest036_03::executeStepL()
{
CCommsDbTemplateRecord* templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(MODEM_BEARER));
CleanupStack::PushL(templateRecord);
User::LeaveIfError(templateRecord->Modify());
TBufC<KCommsDbSvrMaxFieldLength> inputString = _L("string");
templateRecord->WriteTextL(TPtrC(COMMDB_NAME), _L("DummyName"));
templateRecord->WriteTextL(TPtrC(MODEM_PORT_NAME), inputString);
User::LeaveIfError(templateRecord->StoreModifications());
CleanupStack::PopAndDestroy(templateRecord);
//Create a view on the modem table, make a new record and check the value is the one set for the template
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"));
User::LeaveIfError(tableView->PutRecordChanges());
//Retrieve the string we set for the template
TBuf<KCommsDbSvrMaxFieldLength> retrievedString;
tableView->ReadTextL(TPtrC(MODEM_PORT_NAME), retrievedString);
CleanupStack::PopAndDestroy(tableView);
if(retrievedString!=inputString)
return KErrGeneral;
return KErrNone;
}
示例2: 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);
}
示例3: 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;
}
示例4: storeWEPDataL
void XQAccessPointManagerPrivate::storeWEPDataL(const TInt aIapId, const TDesC& aPresharedKey)
{
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);
// 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),
//.........这里部分代码省略.........