本文整理汇总了C++中deleteRecord函数的典型用法代码示例。如果您正苦于以下问题:C++ deleteRecord函数的具体用法?C++ deleteRecord怎么用?C++ deleteRecord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deleteRecord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
int FileSystem::addInformationToFile()
{//Обозначаем переменные
string FileName;
int InformationCount;//Кол-во добавляемой информации,
int CountLength=8;
int resultCode = 1;
int lenCritical = 48;
int CntCritical = 2 ^ 16;
//int BlockNf, SegmNf, BlockNs, SegmNs; //Номер блока , номер сегмента
FileDescriptor AddFile;
FileDescriptor NextFile;
//FileDescriptor LastFile;
int ResultCount;
int freeSpace; //кол-во свободных блоков перед следующим файлом
int RecordNumber,NextRecordNumber; //Номер изменяемой записи, номер следующей записи
int i; //Счетчик
//Собствено функция
cout << "Введите имя файла" << endl;
cin >> FileName;
if (getRecordNumber(FileName)==0)//Проверка ввода имени
return(1);
cout << "Введите кол-во добавляемой информации" << endl;
cin >> InformationCount;
InformationCount=InformationCount/512+1;
AddFile = getRecord(FileName);
if ((AddFile.descriptorType) == "0010000000000000") //!!!!!!!в дескрипторе число блоков сделал интом!!!!!!
return(1);
RecordNumber=getRecordNumber(FileName);
NextRecordNumber=RecordNumber+1;
NextFile=getRecord(NextRecordNumber);
if ((toInt(AddFile.firstBlockNumber) + AddFile.blockCount + InformationCount) > (toInt(NextFile.firstBlockNumber)))
{
//LastFile=AddFile;
//LastFile.blockCount+=InformationCount;
AddFile.blockCount+=InformationCount;
for(i=217;((getRecord(i).fileType)=="");i--)
//LastFile.firstBlockNumber=toString((toInt(getRecord(i).firstBlockNumber)+getRecord(i).blockCount+1),8);
AddFile.firstBlockNumber=toString((toInt(getRecord(i).firstBlockNumber)+getRecord(i).blockCount+1),8);
deleteRecord(FileName);
//writeRecord(LastFile);
writeRecord(AddFile);
resultCode=0;
}
else
{
AddFile.blockCount=(AddFile.blockCount+InformationCount);
deleteRecord(FileName);
writeRecord(AddFile,RecordNumber);
resultCode=0;
}
return(resultCode);
};
示例2: QWidget
void StocksDialog::createDataPage ()
{
QWidget *w = new QWidget(this);
Q3VBoxLayout *vbox = new Q3VBoxLayout(w);
vbox->setMargin(5);
vbox->setSpacing(0);
barEdit = new BarEdit(w);
QString s = tr("Open");
QString s2 = "Open";
barEdit->createField(s, s2, FALSE);
s = tr("High");
s2 = "High";
barEdit->createField(s, s2, FALSE);
s = tr("Low");
s2 = "Low";
barEdit->createField(s, s2, FALSE);
s = tr("Close");
s2 = "Close";
barEdit->createField(s, s2, FALSE);
s = tr("Volume");
s2 = "Volume";
barEdit->createField(s, s2, FALSE);
connect(barEdit, SIGNAL(signalDeleteRecord()), this, SLOT(deleteRecord()));
connect(barEdit, SIGNAL(signalSaveRecord()), this, SLOT(saveRecord()));
connect(barEdit, SIGNAL(signalSearch(QDateTime)), this, SLOT(slotDateSearch(QDateTime)));
connect(barEdit, SIGNAL(signalFirstRecord()), this, SLOT(slotFirstRecord()));
connect(barEdit, SIGNAL(signalLastRecord()), this, SLOT(slotLastRecord()));
connect(barEdit, SIGNAL(signalPrevRecord()), this, SLOT(slotPrevRecord()));
connect(barEdit, SIGNAL(signalNextRecord()), this, SLOT(slotNextRecord()));
vbox->addWidget(barEdit);
addTab(w, tr("Data"));
}
示例3: while
/*
* destructor, free all ressources
*
*/
AutoFocus::~AutoFocus()
{
for (uint32_t i=0; i<hashSize; i++) {
if (listIPRecords[i].size()==0) continue;
list<IPRecord*>::iterator iter = listIPRecords[i].begin();
while (iter != listIPRecords[i].end()) {
std::map<report_enum,af_attribute*>::iterator iter2 = (*iter)->m_attributes.begin();
while (iter2 != (*iter)->m_attributes.end())
{
delete (iter2->second);
iter2++;
}
delete *iter;
iter++;
}
listIPRecords[i].clear();
}
delete[] listIPRecords;
for (uint32_t i = 0; i < numTrees;i++)
{
if (m_treeRecords[i] != NULL)
deleteRecord(i);
}
msg(MSG_FATAL,"Autofocus is done");
}
示例4: iter
void RocksRecordStore::cappedDeleteAsNeeded(OperationContext* txn) {
if (!cappedAndNeedDelete())
return;
// This persistent iterator is necessary since you can't read your own writes
boost::scoped_ptr<rocksdb::Iterator> iter( _db->NewIterator( _readOptions( txn ),
_columnFamily ) );
iter->SeekToFirst();
// XXX TODO there is a bug here where if the size of the write batch exceeds the cap size
// then iter will not be valid and it will crash. To fix this we need the ability to
// query the write batch, and delete the oldest record in the write batch until the
// size of the write batch is less than the cap
// XXX PROBLEMS
// 2 threads could delete the same document
// multiple inserts using the same snapshot will delete the same document
while ( cappedAndNeedDelete() && iter->Valid() ) {
invariant(_numRecords > 0);
rocksdb::Slice slice = iter->key();
DiskLoc oldest = _makeDiskLoc( slice );
if ( _cappedDeleteCallback )
uassertStatusOK(_cappedDeleteCallback->aboutToDeleteCapped(txn, oldest));
deleteRecord(txn, oldest);
iter->Next();
}
}
示例5: Q_ASSERT
QList<QAction *> DataTableEditController::createEditActions()
{
Q_ASSERT(addAction==0);
QList<QAction*> actions;
addAction = new QAction(IconUtil::getIcon("add"), tr("Add record"), this);
connect(addAction, SIGNAL(triggered()), this, SLOT(addRecord()));
actions.append(addAction);
deleteAction = new QAction(IconUtil::getIcon("delete"), tr("Delete record"), this);
connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteRecord()));
actions.append(deleteAction);
actions.append(WidgetHelper::createSeparatorAction(this));
commitAction = new QAction(IconUtil::getIcon("commit"), tr("Commit changes"), this);
connect(commitAction, SIGNAL(triggered()), this, SLOT(commit()));
actions.append(commitAction);
rollbackAction = new QAction(IconUtil::getIcon("rollback"), tr("Reset changes"), this);
connect(rollbackAction, SIGNAL(triggered()), this, SLOT(reset()));
actions.append(rollbackAction);
showDmlAction = new QAction(IconUtil::getIcon("query"), tr("Show commit DML"), this);
connect(showDmlAction, SIGNAL(triggered()), this, SLOT(showDml()));
actions.append(showDmlAction);
return actions;
}
示例6: getId
bool DataOp::updateRecord(QString record)
{
QString id, oldRecord;
id = getId(record);
//保存旧数据
oldRecord = selectRecord(id);
if(oldRecord==""){
qDebug() << "更新失败,未找到该条数据"<< record;
return 0;
}
//删除原记录
if(!deleteRecord(getId(record))){
return 0;
}
//添加新记录
if(!insertRecord(record)){
qDebug() << "更新失败,尝试恢复旧数据";
if(!insertRecord(oldRecord)){
qDebug() << "数据重大错误";
}
return 0;
}else{
return 1;
}
return 0;
}
示例7: switch
void
ReportEdit::doubleClicked( const QModelIndex & index )
{
const int row = index.row();
const QDateTime key = m_model->index( row, 0 ).data().toDateTime();
switch ( index.column() ) {
case 1:
if ( QMessageBox::question( this, "Подтверджение", "Удалить запись?",
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) == QMessageBox::Yes ) {
deleteRecord( key, row );
}
break;
case 2:
modifyNumText( key, row );
break;
case 3:
modifyNum( key, row );
break;
case 4: {
toggleZakaz( key );
break;
}
default:
;
}
}
示例8: test3
/*
* test3 -- 削除
*/
Result test3()
{
Condition condition;
/*
* 以下のクエリを実行
* delete from TABLE_NAME where name != 'Mickey'
*/
strcpy(condition.name, "name");
condition.dataType = TYPE_VARCHAR;
condition.operator = OPR_NOT_EQUAL;
strcpy(condition.val.stringVal, "Mickey");
if (deleteRecord(TABLE_NAME, &condition) != OK) {
fprintf(stderr, "Cannot delete records.\n");
return NG;
}
printf("delete from TABLE_NAME where name != 'Mickey'\n");
/* データを表示する */
printTableData(TABLE_NAME);
printf("\n");
/*
* 以下のクエリを実行
* delete from TABLE_NAME
*/
strcpy(condition.name, "");
condition.dataType = TYPE_UNKNOWN;
condition.operator = OPR_UNKNOWN;
strcpy(condition.val.stringVal, "");
condition.val.intVal = 0;
if (deleteRecord(TABLE_NAME, &condition) != OK) {
fprintf(stderr, "Cannot delete records.\n");
return NG;
}
printf("delete from TABLE_NAME\n");
/* データを表示する */
printTableData(TABLE_NAME);
return OK;
}
示例9: CardUI
Card::Card(QSqlQueryModel *personModel, QSqlQueryModel *responseModel, QWidget *parent) : CardUI(parent){
setFormPersonMap(personModel);
setFormResponseMap(responseModel);
connect(submitNew, SIGNAL(clicked()), this, SLOT(addRecord()));
connect(submitEdit, SIGNAL(clicked()), this, SLOT(editRecord()));
connect(submitReset, SIGNAL(clicked()), this, SLOT(clearFields()));
connect(submitDelete,SIGNAL(clicked()), this, SLOT(deleteRecord()));
}
示例10: main
int main()
{
FILE *cfPtr; /* credit.dat file pointer */
int choice; /* user's choice */
/* fopen opens the file; exits if file cannot be opened */
if ( ( cfPtr = fopen( "credit.dat", "rb+" ) ) == NULL ) {
printf( "File could not be opened.\n" );
} /* end if */
else {
/* enable user to specify action */
while ( ( choice = enterChoice() ) != 6 ) {
switch ( choice ) {
/* create text file from record file */
case 1:
textFile( cfPtr );
break;
/* update record */
case 2:
updateRecord( cfPtr );
break;
/* create record */
case 3:
newRecord( cfPtr );
break;
/* delete existing record */
case 4:
deleteRecord( cfPtr );
break;
/* sum up balances of valid records and record sum in text file */
case 5:
sumRecords( cfPtr );
break;
/* display message if user does not select valid choice */
default:
printf( "Incorrect choice\n" );
break;
} /* end switch */
} /* end while */
fclose( cfPtr ); /* fclose closes the file */
} /* end else */
return 0; /* indicates successful termination */
} /* end main */
示例11: LOG
void IDBServer::deleteRecord(const IDBRequestData& requestData, const IDBKeyRangeData& keyRangeData)
{
LOG(IndexedDB, "IDBServer::deleteRecord");
auto transaction = m_transactions.get(requestData.transactionIdentifier());
if (!transaction)
return;
transaction->deleteRecord(requestData, keyRangeData);
}
示例12: deleteRecord
//Ìî³äPBFriendAgreeReceive
int cProcUserAgreeFriend::setPBFriendAgreeReceive(PBFriendAgreeReceive& u_PBFriendAgreeReceive,const string& u_strToken,\
const unsigned int& u_friendId)
{
unsigned int u_userId = 0;
int u_result = 0;
if (!getUserIdbyToken(u_strToken,u_userId))
{
g_cMyGlog.errorlogRecord("procUserAddFriend getUserIdbyToken error:Token:%s\n",u_strToken.c_str());
return K_ACCOUNT_UNNORMAL;
}
if (!isUserExist(u_friendId))
{
deleteRecord(u_userId,u_friendId);
return K_FRIEND_IS_NOT_EXIST;
}
if (hasHistoryRecord(u_userId,u_friendId))
{
deleteRecord(u_userId,u_friendId);
return K_OPPOSIT_IS_FRIEND;
}
else
{
if (!insertRecord(u_userId,u_friendId) || !insertRecord(u_friendId,u_userId))
{
u_result = -1;
}
else
{
deleteRecord(u_userId,u_friendId);
u_PBFriendAgreeReceive.set_agreeresult(ADD_FRIEND_SUCCESS);
PBWaitingFriend* u_PBWaitingFriend;
u_PBWaitingFriend = u_PBFriendAgreeReceive.mutable_waitings();
g_cProcUserWaitingFriend.getUserWaitingFriend(*u_PBWaitingFriend,u_userId);
PBAllFriend* u_PBAllFriend;
u_PBAllFriend = u_PBFriendAgreeReceive.mutable_friends();
g_cProcUserGetAllFriend.getAllFriendByUserId(*u_PBAllFriend,u_userId);
}
}
return u_result;
}
示例13: deleteRecord
void FileRecordMergeMgr::deleteAllMergedItemsButKey(RecordKeyVector &recList) {
//if the key is also in the list, this method won't delete it.
for (RecordKeyVector::const_iterator_type iter = recList.begin(); iter != recList.end(); iter = recList.next()) {
if (*iter == recList.getKey()) {
continue;
}
deleteRecord(*iter);
}
recList.clearVector();
}
示例14: head
vector<Address> RecordManager::findAllRecord(string fileName, const vector<int>& op, const vector<vector<char>>& value,
const vector<int>& begin, const vector<int>& end, const vector<int> &type, int recordSize,
vector<vector<char>>& returnRecord, int toDelete){
vector<Address> returnAddr;
vector<Address> nullAddr;
vector<char> nextBlock;
vector<char> nextOffset;
vector<char> tempRecord;
Address addr;
if (bmanager.getFileBlockNumber(fileName) == 0){
return nullAddr;
}
Address head(fileName, 0, 0);
int headSize;
if (recordSize < 20)
headSize = 20;
else
headSize = recordSize;
vector<char> headRecord = bmanager.read(head, headSize);
setNextAddr(headRecord, nextBlock, nextOffset, headSize - 8);
int size = getSize(headRecord);
//cout << "findallrecord: size: " << size << endl;
for (int i = 0; i < size; i++){
addr.setAddr(fileName, char4ToInt(nextBlock), char4ToInt(nextOffset));
tempRecord = bmanager.read(addr,recordSize);
int flag = 0;
for (int j = 0; j < op.size(); j++){//取一条记录i和j个条件比
int n=compareVc(value[j], tempRecord, begin[j], end[j], type[j]);
if (n == 0 && (op[j] == 0 || op[j] == 3 || op[j] == 4))
continue;
else if (n == 1 && (op[j] == 1 || op[j] == 3 || op[j] == 5))
continue;
else if (n == 2 && (op[j] == 2 || op[j] == 4 || op[j] == 5))
continue;
else{
flag = 1;
break;
}
}
//cout <<"flag: "<< flag << endl;
if (flag==0){
if (toDelete){
//printvc(tempRecord);
deleteRecord(tempRecord, fileName, recordSize, 1);
}
returnRecord.push_back(tempRecord);
returnAddr.push_back(addr);
}
setNextAddr(tempRecord, nextBlock, nextOffset, recordSize - 8);
}
return returnAddr;
}
示例15: testTombstone
RC testTombstone(void)
{
RM_TableData *table = (RM_TableData *)malloc(sizeof(RM_TableData));
TestRecord inserts[] = {
{ 1, "aaaa", 3 },
{ 2, "bbbb", 2 },
{ 3, "cccc", 1 },
{ 4, "dddd", 3 },
{ 5, "eeee", 5 },
{ 6, "ffff", 1 },
{ 7, "gggg", 3 },
{ 8, "hhhh", 3 },
{ 9, "iiii", 2 },
{ 10, "jjjj", 5 },
};
int numInserts = 10, numUpdates = 3, numDeletes = 5, numFinal = 5, i;
Record *r;
RID *rids;
Schema *schema;
testName = "test creating a new table and insert,update,delete tuples";
schema = testSchema();
rids = (RID *)malloc(sizeof(RID) * numInserts);
TEST_CHECK(initRecordManager(NULL));
TEST_CHECK(createTable("test_table_r", schema));
TEST_CHECK(openTable(table, "test_table_r"));
// insert rows into table
for (i = 0; i < numInserts; i++)
{
r = fromTestRecord(schema, inserts[i]);
TEST_CHECK(insertRecord(table, r));
rids[i] = r->id;
}
TEST_CHECK(deleteRecord(table, rids[9]));
RID id;
id.page = rids[9].page;
id.slot = rids[10].slot;
int isTombstone = checkIfTombstoneEncountered(table, rids[9]);
TEST_CHECK(closeTable(table));
TEST_CHECK(deleteTable("test_table_r"));
TEST_CHECK(shutdownRecordManager());
free(table);
if (isTombstone == 1) {
return RC_OK;
}
else {
return RC_NOT_A_TOMBSTONE;
}
}