백업
git-svn-id: svn://192.168.0.12/source@213 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -500,6 +500,7 @@ void Widget::on_group_button_import()
|
||||
int nCount=0;
|
||||
QStringList attributes;
|
||||
QString strquery;
|
||||
QSqlQuery query;
|
||||
while(!in.atEnd())
|
||||
{
|
||||
QString strLine;
|
||||
@@ -520,36 +521,37 @@ void Widget::on_group_button_import()
|
||||
attributes << strings.at(i);
|
||||
nCount++;
|
||||
}
|
||||
|
||||
strquery = "insert into data_" + strgroup.at(0) + " (";
|
||||
|
||||
foreach(QString str, attributes)
|
||||
{
|
||||
strquery += (str.trimmed() + ",");
|
||||
}
|
||||
|
||||
strquery = strquery.left(strquery.length() - 1);
|
||||
strquery += ") VALUES (";
|
||||
|
||||
foreach(QString str,attributes)
|
||||
{
|
||||
strquery += ":" + str.trimmed().toUpper() + ",";
|
||||
}
|
||||
strquery = strquery.left(strquery.length() - 1);
|
||||
strquery += ")";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
strquery = "insert into data_" + strgroup.at(0) + " (";
|
||||
|
||||
foreach(QString str, attributes)
|
||||
{
|
||||
strquery += (str.trimmed() + ",");
|
||||
}
|
||||
|
||||
strquery = strquery.left(strquery.length() - 1);
|
||||
strquery += ") VALUES (";
|
||||
|
||||
foreach(QString str,attributes)
|
||||
{
|
||||
strquery += ":" + str.trimmed().toUpper() + ",";
|
||||
}
|
||||
strquery = strquery.left(strquery.length() - 1);
|
||||
strquery += ")";
|
||||
|
||||
|
||||
strLine = strLine.replace("\"","");
|
||||
QStringList strings = strLine.split(",");
|
||||
|
||||
QSqlQuery query;
|
||||
query.prepare(strquery.toUtf8());
|
||||
for(int i=0; i<attributes.size();i++)
|
||||
{
|
||||
|
||||
if(attributes.at(i).trimmed() == "article_order")
|
||||
{
|
||||
|
||||
if(strings.at(i).trimmed().length() == 0)
|
||||
{
|
||||
QString strEmpty;
|
||||
@@ -558,7 +560,9 @@ void Widget::on_group_button_import()
|
||||
else
|
||||
{
|
||||
query.bindValue(":"+attributes.at(i).toUpper(), strings.at(i).trimmed().toInt());
|
||||
}
|
||||
}
|
||||
|
||||
query.bindValue(":"+attributes.at(i).toUpper(), strings.at(i).trimmed().toInt());
|
||||
}
|
||||
|
||||
if(strings.at(i).trimmed().length() == 0)
|
||||
|
||||
Reference in New Issue
Block a user