QString dbstr
("create table if not exists Data( Time_Interval INTEGER, Channel1 varchar(250),Channel2 varchar(250),Channel3 varchar(250),Channel4 varchar(250),Channel5 varchar(250),Channel6 varchar(250),Channel7 varchar(250), Channel8 varchar(250),Channel9 varchar(250),Channel10 varchar(250),Channel11 varchar(250),Channel12 varchar(250),Channel13 varchar(250),Channel14 varchar(250),Channel15 varchar(250),Channel16 varchar(250),Channel17 varchar(250),Channel18 varchar(250),Channel19 varchar(250),Channel20 varchar(250),Channel21 varchar(250),Channel22 varchar(250),Channel23 varchar(250)
)");
query.exec(dbstr);
QString dbstr("create table if not exists Data( Time_Interval INTEGER, Channel1 varchar(250),Channel2 varchar(250),Channel3 varchar(250),Channel4 varchar(250),Channel5 varchar(250),Channel6 varchar(250),Channel7 varchar(250),
Channel8 varchar(250),Channel9 varchar(250),Channel10 varchar(250),Channel11 varchar(250),Channel12 varchar(250),Channel13 varchar(250),Channel14 varchar(250),Channel15 varchar(250),Channel16 varchar(250),Channel17 varchar(250),Channel18 varchar(250),Channel19 varchar(250),Channel20 varchar(250),Channel21 varchar(250),Channel22 varchar(250),Channel23 varchar(250)
)");
query.exec(dbstr);
To copy to clipboard, switch view to plain text mode
m_query.exec("begin transaction Trans");
for (int i = 0; i < radata2.count(); ++i)
{
QString sQuery
= "insert into Data";
sQuery
+= " values (";for
(int j
= 0; j < radata2
[i
]->count
(); j
++) sQuery
+= QString("%1").
arg("'" + radata2
[i
]->at
(j
) + "'") + ", ";sQuery
+= ")";
q.exec(sQuery);
}
m_query.exec("begin transaction Trans");
for (int i = 0; i < radata2.count(); ++i)
{
QString sQuery = "insert into Data";
sQuery += " values (";for (int j = 0; j < radata2[i]->count(); j++) sQuery += QString("%1").arg("'" + radata2[i]->at(j) + "'") + ", ";sQuery += ")";
QSqlQuery q;
q.exec(sQuery);
}
To copy to clipboard, switch view to plain text mode
can some one suggest me what is the best method while dealing with so many tables.
Bookmarks