for 循环,对数据进行批处理并在 C++ 中丢弃
for loop that batch the data and throw it out in c++
void write_token_to_data()
{
typedef double* DynamicMatrix[l+m];
// DynamicMatrix Count;
typedef double* DynamicMatrix2[l+m];
//DynamicMatrix2 Prob;
for(int i=0; i<(l+m); i++)
{
for(int j=0; j<(l+m); j++)
{
if(mysqlinsert2(i,j,combine[i],combine[j]))
{
cout<<"insert OK!!"<<endl;
}
else
{
cout<<"insert failed"<<endl;
}
}
}
}//end of function
这是我的问题我怎样才能改变这个子函数,我可以保持我,J组合[i],组合[J]直到数字 100 ,并将这四个值扔到 MySQLinsert 函数中并释放for循环索引101中的数组并继续记录值,长话短说,我想将这个MySQL插入分成小部分
- You can contruct a string in the form
(i,j,cobine[i],combine[j]) for each iteration.
- Inorder to insert a multiple rows in a single query.
[Normal insert query for multiple records
INSERT INTO Table ( Column1, Column2 ) VALUES
( Value1, Value2 ), ( Value1, Value2 )
]
- also rewrite mysqlinsert2(i,j,combine[i],combine[j]) into *mysqlinsert2(str)*.and execute the string.
for(int i=0; i<(l+m); i++){
for(int j=0; j<(l+m); j++){
if (till count => 100) {
// concatinate the string with prev str
str += (i,j,combine[i],combine[j])+',';
}
if (count reaches hundred || count = 0) {
// execute the string
mysqlinsert2(str);
// initialize str as empty string
str = 'INSERT INTO Table ( Column1, Column2, column3, column4 ) VALUES';
count = 0;
}
}
}
相关文章:
- 如何在 SEAL 3.1 中使用 CRT 批处理技术Microsoft?
- 批处理归一化层构造
- 多 GPU 批处理 1D FFT:似乎只有一个 GPU 可以工作
- 我们在批处理模式下使用 G++ 时遇到错误
- 如何在 c++ 窗口中将参数和返回的退出值传递到批处理文件/从批处理文件获取返回的退出值
- 从之前添加的批处理文件中删除单词
- 使用qprocess将参数传递给批处理
- 从批处理中提取矩阵,表示为张量
- 无法从C++ Windows 服务执行批处理文件
- 如何将批处理文件的输出读取到C 中的字符串中
- cmake:生成批处理文件调用cl.exe
- 是否可以使用开发控制台使用批处理脚本编译 c++
- 用于批处理分配的库
- 在调用进程的上下文中通过 win32 执行批处理,从而保留环境变量
- 如何运行批处理文件和读取输出
- 嵌入批处理脚本文件并在C 控制台项目中运行
- GetCommandLine():无法从批处理文件(GCC-Compiler)传递多行参数
- AWS 批处理"unable to connect to endpoint"
- exe文件不被识别为内部或外部命令,可操作的程序或批处理文件在C++
- 在简单的外壳中进行批处理处理