Truncate table my_objects; Drop table my_objects; create table my_objects as select * from all_objects; insert into my_objects select * from my_objects; insert into my_objects select * from my_objects; insert into my_objects select * from my_objects; insert into my_objects select * from my_objects; insert into my_objects select * from my_objects; |
--创建新表 truncate table my_objects2; drop table my_objects2; create table my_objects2 ( owner varchar2(30), object_name varchar2(30), subobject_name varchar2(30), object_id int, data_object_id int); |
//消除一些无用的警告 #pragma warning(disable:4146 4244) //导入ADO应用库,并对命名空间及EOF重命名 #import "C:Program FilesCommon FilesSystemADOmsado15.dll" rename_namespace("MYADO") rename("EOF", "EndOfFile") 下面的是关键实现代码: //初始化连接对象 hr = m_pConnection.CreateInstance(__uuidof(MYADO::Connection)); //初始化记录集对象 m_pRs.CreateInstance(__uuidof(MYADO::Recordset)); //设置连接参数 CString strConnection; strConnection.Format(_T("Provider=OraOLEDB.Oracle.1;" "Password=%s;" "User ID=%s;" "Data Source=%s"), strPwd, strUser, strSID); //连接到数据库 m_pConnection->Open((_bstr_t)strConnection,_T(""),_T(""),-1); //执行SQL语句 strSQL.Format("Truncate table my_objects"); m_pConnection->Execute(_bstr_t(strSQL),NULL,MYADO::adCmdText); //打开记录集 strSQL.Format("Select object_name from my_objects"); m_pRs->Open((_bstr_t)strSQL, m_pConnection.GetInterfacePtr(), MYADO::adOpenForwardOnly, MYADO::adLockReadOnly, MYADO::adCmdText); //遍历并读取数据 while(!m_pRs->EndOfFile) { varValue = m_pRs->Fields->GetItem(long(0))->GetValue(); m_pRs->MoveNext(); } strSQL.Format("Insert into my_objects2 values ('TestTest','TestTest','TestTest',0,0)"); //写入数据 for(int i=0;i<100000;i++) { m_pConnection->Execute( _bstr_t(strSQL),NULL,MYADO::adCmdText); } //关闭连接 m_pConnection->Close(); |
欢迎光临 DIY编程器网 (http://diybcq.com/) | Powered by Discuz! X3.2 |