在转换LEVELDB数据时候出现的 -abort() has been called错误

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kele_imon/article/details/79955742

错误描述如下图:


原因:这是因为在转换数据集的时候,放置原始数据集的文件夹命名含有非法字符,比如我的文件夹就含有了空格,如下图

只要把空格取消掉就可以了。问题解决。

阅读更多

C++程序显示debug error abort()has been called

04-11

我在写一个连接oracle数据库,读取一个表,然后删除表中赘余属性的C++程序rnrn在vs2015上运行能显示出正确结果 但是之后会弹出debug error的信息窗口,检查后发现问题出现在LoadTable()这个函数上rn我把这个函数的调用注释掉就不会出错,但我把这个函数的函数体内容全部注释掉,只留return语句,再调用时还是出错,不知道问题到底出在哪里。rn rn下面是完整的代码rnrnrn// MyC++.cpp : 定义控制台应用程序的入口点。rnrn#includern#includern#includern#includern#includern#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF")rnusing namespace std;rnrn#define MAXATTRIBUTIONCOUNT 15rn#define MAXELEMENTS 10rnrntypedef struct rn string attName;rn bool necessary;rn_attribute;//表属性rnrntypedef struct _classification rn string value;rn int element[MAXELEMENTS];rn int elementCount;rn struct _classification* next;rn_classification;//分类rnrn//数据库操作rnclass CDBOperationrnrnpublic:rn CDBOperation(void);rn ~CDBOperation(void);rnrn bool ConnToDB(char* ConnectionString,char* UserID,char* Password);rnrn _RecordsetPtr ExecuteWithResSQL(const char*);//查询操作rn _RecordsetPtr ExecuteWithResSQL(const string );rn bool ExecuteWithoutResSQL(const char*);//增删操作rn bool ExecuteWithoutResSQL(const string);rnrn void PrintResult();//打印查询结果rnrnprivate:rn void PrintErrorInfo(_com_error &);rnrn _ConnectionPtr CreateConnPtr();rn _CommandPtr CreateCommPtr();rn //_RecordsetPtr CreateRecsetPtr();rnrnprivate:rn _ConnectionPtr m_pConnection;rn _CommandPtr m_pCommand;rn _RecordsetPtr m_pRst;rn;rnrn/****************CDBOperation类定义***********************/rnCDBOperation::CDBOperation(void)rnrn CoInitialize(NULL);rn m_pConnection = CreateConnPtr();rn m_pCommand = CreateCommPtr();rn m_pRst = nullptr;rnrnrnCDBOperation::~CDBOperation(void)rnrn m_pConnection->Close();rn CoUninitialize();rnrnrnbool CDBOperation::ConnToDB(char *ConnectionString, char* UserID, char *Password)rnrn if (nullptr == m_pConnection)rn rn cout << "Failed to create connection!" << endl;rn return false;rn rn tryrn rn HRESULT hr = m_pConnection->Open(ConnectionString,UserID,Password,NULL);rn if (TRUE == FAILED(hr))rn rn return false;rn rn m_pCommand->ActiveConnection = m_pConnection;rn return TRUE;rn rn catch (_com_error &e)rn rn PrintErrorInfo(e);rn return false;rn rnrnrn_RecordsetPtr CDBOperation::ExecuteWithResSQL(const char* sql)rnrn rn tryrn rn m_pCommand->CommandText = _bstr_t(sql);rn rn m_pRst = m_pCommand->Execute(NULL,NULL,adCmdText);rn if (NULL == m_pRst)rn rn cout << "查询数据库出错!" << endl;rn return nullptr;rn rn if (m_pRst->adoEOF)rn rn rn cout << "表中无记录!" << endl;rn return nullptr;rn rn return m_pRst;rn rn catch (_com_error &e)rn rn PrintErrorInfo(e);rn return NULL;rn rnrnrn_RecordsetPtr CDBOperation::ExecuteWithResSQL(const string sql)rnrn return ExecuteWithResSQL(sql.data());rnrnrnbool CDBOperation::ExecuteWithoutResSQL(const char* sql)rnrn if (ExecuteWithResSQL(sql))return true;rn else return false;rnrnrnbool CDBOperation::ExecuteWithoutResSQL(const string sql)rnrn return ExecuteWithoutResSQL(sql.data());rnrnrnvoid CDBOperation::PrintResult()rnrn if (!m_pRst)rn rn cout << "没有可打印的查询结果!"<adoEOF)rn rn vAge = p->GetCollect(_variant_t(s1.data()));rn vName = p->GetCollect(_variant_t("name"));rn cout << "age: " << (string)(_bstr_t)vAge << "\n";rn cout << "name: " << (string)(_bstr_t)vName << endl;rn p->MoveNext();rn rnrnrn_ConnectionPtr CDBOperation::CreateConnPtr()rnrn HRESULT hr;rn _ConnectionPtr connPtr;rn hr = connPtr.CreateInstance(__uuidof(Connection));rn if (FAILED(hr) == TRUE)rn rn return NULL;rn rn return connPtr;rnrnrn_CommandPtr CDBOperation::CreateCommPtr()rnrn HRESULT hr;rn _CommandPtr commPtr;rn hr = commPtr.CreateInstance(__uuidof(Command));rn if (FAILED(hr) == TRUE)rn rn return NULL;rn rn return commPtr;rnrnrnvoid CDBOperation::PrintErrorInfo(_com_error &e)rnrn cout << "Error infomation is as follows:\n";rn cout << "ErrorNo: " << e.Error() << "\n";rn cout << "Error Message: " << e.ErrorMessage() << "\n";rn cout << "Error Source: " << (LPCTSTR)e.Source() << "\n";rn cout << "Error Description: " << (LPCTSTR)e.Description() << "\n";rnrnrn//数据库表rnclass Table rn friend class CDBOperation;rnpublic:rn Table();rn ~Table();rn //bool AnalyseTable(CDBOperation, string);rn bool LoadTable(CDBOperation, string);rn void ShowAttribute();rn void ShowTable();rn //约简算法rn void BlindReduct();rnrn //显示约简后的表rn void ShowReductAtrribute();rn void ShowReductTable();rnprivate:rn _classification *FindClassification(const string);rn void PreprocessTable(void);rnprivate:rn _attribute attribute[MAXATTRIBUTIONCOUNT];rn int attriCount;//实际的属性数目rn _classification *classification;rn int classCount;//基本集数rn;rnrnrnTable::Table()rnrn this->attriCount = 0; rn this->classification = nullptr;rn this->classCount = 0;rnrnrnTable::~Table()rnrn _classification *ptr=this->classification;rn while (ptr)rn rn this->classification = ptr->next;rn delete ptr;rn ptr = this->classification;rn rnrnrnvoid Table::PreprocessTable()rnrn for (int i = 0; i < this->attriCount; i++)this->attribute[i].necessary = true;rnrn_classification* Table::FindClassification(const string val)rnrn if (val == " ") cout << "无效的分类!" << endl; return nullptr; rn _classification *ptr = this->classification;rn while ((ptr)&&(ptr->value != val))ptr=ptr->next;rn if (!ptr)rn rn ptr = new _classification;rn ptr->value = val;rn ptr->elementCount = 0;rn ptr->next = this->classification;rn this->classification = ptr;rn this->classCount++;rn rn return ptr;rnrnrn/*bool Table::AnalyseTable(CDBOperation dbOp, string tableName)rnrn if (tableName == " ") cout << "表名不能为空!" << endl; return false; //表名为空rn this->attriCount = 0;rnrn for (int i = 0; i < (int)tableName.length(); i++)tableName[i] = toupper(tableName[i]);//将表名转为大写rnrnrn _RecordsetPtr setPtr = dbOp.ExecuteWithResSQL("select column_name from user_tab_columns where table_name = '" + tableName + "'");rnrn rn while (!setPtr->adoEOF)rn rn this->attribute[attriCount].attName = (string)(_bstr_t)setPtr->GetCollect(_variant_t("COLUMN_NAME"));rn this->attribute[attriCount].necessary = true;rn this->attriCount++;rn setPtr->MoveNext();rn rnrn return true;rn*/rnrnbool Table::LoadTable(CDBOperation dbOp, string tableName)rnrn //表名为空rn if (tableName == " ") cout << "表名不能为空!" << endl; return false; rn this->attriCount = 0;rnrn //将表名转为大写rn for (int i = 0; i < (int)tableName.length(); i++)tableName[i] = toupper(tableName[i]);rnrn //分析表列名rn _RecordsetPtr setPtr = dbOp.ExecuteWithResSQL("select column_name from user_tab_columns where table_name = '" + tableName + "'");rnrn if (!setPtr||setPtr->adoEOF)return false;rnrn while (!setPtr->adoEOF)rn rn this->attribute[attriCount].attName = (string)(_bstr_t)setPtr->GetCollect(_variant_t("COLUMN_NAME"));rn this->attribute[attriCount].necessary = true;rn this->attriCount++;rn setPtr->MoveNext();rn rnrn//查询表数据 rn setPtr = dbOp.ExecuteWithResSQL("select * from "+tableName);rn rn string val="";rn int number = 1;rnrn while (!setPtr->adoEOF)rn rn for (int i = 0; i < this->attriCount;i++)rn val=val+ (string)(_bstr_t)setPtr->GetCollect(_variant_t(this->attribute[i].attName.data()))+" ";rn _classification *ptr = this->FindClassification(val);rn ptr->element[ptr->elementCount] = number;rn ptr->elementCount++;rnrn number++;rn val = "";rn setPtr->MoveNext();rn rn return true;rnrnrnvoid Table::ShowAttribute()rnrn if (this->attriCount == 0) cout << "没有可显示的列名!" ; return; rnrn cout << left << setw(5) << "编号";rn for (int i = 0; i < this->attriCount; i++)rn cout << left<attribute[i].attName << " ";rnrnrnvoid Table::ShowTable()rnrn this->ShowAttribute();rn cout << endl<classification)cout << "没有可显示的元组!"; return;rn _classification *ptr = this->classification;rn while (ptr)rn rn for (int i = 0; i < ptr->elementCount; i++)rn rn cout << left << setw(5) << ptr->element[i];rn //读取一个分类的value并分离出每个属性的具体值rn istringstream ss(ptr->value);rn string val;rn while (ss >> val)cout << left << setw(16) << val;rn rn cout << endl<next;rn rnrnrnvoid Table::BlindReduct()rnrn this->PreprocessTable();rnrn set attri;rn _classification *ptr = this->classification;rnrn for (int i = 0; i < this->attriCount; i++)//当前删除第几个属性rn rn while (ptr)//删除当前属性能得到的所有分类rn rn istringstream ss(ptr->value);rn string val, fVal;rn int count = 0;//当前添加第几个属性的值rn while (ss >> val)rn rn if (this->attribute[count].necessary&&count!=i)fVal = fVal + val + " ";//获得删除后的属性值集合rn count++;rn rn if(!fVal.empty())attri.insert(fVal);rn ptr = ptr->next;rn rn if (attri.size() == this->classCount)this->attribute[i].necessary = false;rn attri.clear();rn ptr = this->classification;rn rnrnrnvoid Table::ShowReductAtrribute()rnrn if (this->attriCount == 0) cout << "没有可显示的列名!"; return; rnrn cout << left << setw(5) << "编号";rn for (int i = 0; i < this->attriCount; i++)rn if(this->attribute[i].necessary)rn cout << left << setw(15) << this->attribute[i].attName << " ";rnrnrnvoid Table::ShowReductTable()rnrn this->ShowReductAtrribute();rn cout << endl << endl;;rn rn if (!this->classification) cout << "没有可显示的元组!"; return; rn _classification *ptr = this->classification;rn while (ptr)rn rn for (int i = 0; i < ptr->elementCount; i++)rn rn cout << left << setw(5) << ptr->element[i];rn //读取一个分类的value并分离出每个属性的具体值rn istringstream ss(ptr->value);rn string val;rn int count = 0;rn while (ss >> val)rn rn rn if (this->attribute[count].necessary)rn cout << left << setw(16) << val;rn count++;rn rn cout << endl << endl;rn rn rn ptr = ptr->next;rn rnrnrnint main()rnrn CDBOperation dbOper;rn bool bConn = dbOper.ConnToDB("Provider = OraOLEDB.Oracle.1; Persist Security Info = True; Data Source = orcl","system","system");rn if (false == bConn) cout << "连接数据库出错!"; getchar(); return 0; rn else cout << "连接成功!"<> s;rn Table table;rn //读取表数据rn table.LoadTable(dbOper,s);rn //未约简的表rn table.ShowTable();rn rn /cout << endl;rn //盲目约简rn table.BlindReduct();rn //约简后的表rn table.ShowReductTable();rn cout << endl;rn table.~Table();rn dbOper.~CDBOperation();rn getchar();*/rn return 0;rn

数据库】 Debug Error! R6010 abort() has been called 【问题】

01-30

贴代码:rnrnrnrn//验证rn if (CServerDlg::CheckPacket(RecvBuf)==_T("Registration"))rn rn CString Buf,UserName,PassWord;rn Buf=str.Right(str.GetLength()-13);rn int pos=Buf.Find(_T(";"));rn UserName=Buf.Left(pos);rn PassWord=Buf.Right(Buf.GetLength()-pos-1);rn //打开数据表rn theApp.pRecordset.CreateInstance(__uuidof(Recordset));rn theApp.pRecordset->Open("SELECT * FROM User",theApp.pConnect.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);rn //检查用户名rn theApp.pRecordset->MoveFirst();rn while (!theApp.pRecordset->adoEOF)rn rn _variant_t _UserName;rn _UserName=theApp.pRecordset->GetCollect("用户名");rn if (_UserName==UserName)rn rn TCHAR SendBuf[1024]=_T("Error");rn send(m_ClientArray.ClientSock,(char*)SendBuf,1024,0);rn break;rn rn elsern rn TCHAR SendBuf[1024]=_T("Correct");rn send(m_ClientArray.ClientSock,(char*)SendBuf,1024,0);rn break;rn rn theApp.pRecordset->MoveNext();rn rn theApp.pRecordset->Close();rn theApp.pRecordset.Release();rn theApp.pRecordset=NULL;rnrn rn //登录信息rn if(CServerDlg::CheckPacket(RecvBuf)==_T("Login"))rn rn //取出用户名,密码。rn CString _Buf,__UserName,__PassWord;rn _Buf=str.Right(str.GetLength()-6);rn int _pos=_Buf.Find(_T(";"));rn __UserName=_Buf.Left(_pos);rn __PassWord=_Buf.Right(_Buf.GetLength()-_pos-1);rn //核对用户名,密码是否正确。rn theApp.pRecordset->MoveFirst();rn while (!theApp.pRecordset->adoEOF)rn rn _variant_t DataBase_UserName=theApp.pRecordset->GetCollect("用户名");rn if (__UserName==DataBase_UserName)rn rn _variant_t DataBase_PassWord=theApp.pRecordset->GetCollect("密码");rn if (__PassWord==DataBase_PassWord)rn rn TCHAR Check_Succeed[1024]=_T("登陆成功");rn send(m_ClientArray.ClientSock,(char *)Check_Succeed,1024,0);rn break;rn rn elsern rn TCHAR Check_Error[1024]=_T("密码错误");rn send(m_ClientArray.ClientSock,(char *)Check_Error,1024,0);rn break;rn rn rn theApp.pRecordset->MoveNext();rn rn theApp.pRecordset->Close();rn theApp.pRecordset.Release();rn theApp.pRecordset=NULL;rn rnrn代码里有两个 if语句!rn当我把第二个if语句删除后,错误就不会产生了,不知道是什么原因。rnrn我猜可能是 没有释放什么资源 冲突造成的把!rn求大神!!!

没有更多推荐了,返回首页