|
@@ -22,14 +22,6 @@ void fwdb::OpenDataBase()
|
|
mdatabase = QSqlDatabase::database("sqliteadc");
|
|
mdatabase = QSqlDatabase::database("sqliteadc");
|
|
else
|
|
else
|
|
mdatabase = QSqlDatabase::addDatabase("QSQLITE","sqliteadc");
|
|
mdatabase = QSqlDatabase::addDatabase("QSQLITE","sqliteadc");
|
|
-// mdatabase = QSqlDatabase::addDatabase("QSQLITE");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// if(QSqlDatabase::contains("sqlite"))
|
|
|
|
-// mdatabase = QSqlDatabase::database("sqlite");
|
|
|
|
-// else
|
|
|
|
-// mdatabase = QSqlDatabase::addDatabase("QSQLITE","sqlite");
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
mdatabase.setDatabaseName(mstrdbpath.data());
|
|
mdatabase.setDatabaseName(mstrdbpath.data());
|
|
@@ -50,7 +42,6 @@ void fwdb::OpenDataBase()
|
|
|
|
|
|
bool bHaveTable = true;
|
|
bool bHaveTable = true;
|
|
|
|
|
|
- //查询数据
|
|
|
|
sql_query.exec("select count(*) from sqlite_master where type='table' and name = 'accountdata'");
|
|
sql_query.exec("select count(*) from sqlite_master where type='table' and name = 'accountdata'");
|
|
if(!sql_query.exec())
|
|
if(!sql_query.exec())
|
|
{
|
|
{
|
|
@@ -79,21 +70,7 @@ void fwdb::OpenDataBase()
|
|
qDebug() << "Error: Fail to create table."<< sql_query.lastError();
|
|
qDebug() << "Error: Fail to create table."<< sql_query.lastError();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-// if(!sql_query.exec("CREATE INDEX index_vehid ON groupdata (vehid)"))
|
|
|
|
-// {
|
|
|
|
-// qDebug() << "Error: Fail to create index_vehid."<< sql_query.lastError();
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-// if(!sql_query.exec("CREATE INDEX index_recvtime ON groupdata (recvtime)"))
|
|
|
|
-// {
|
|
|
|
-// qDebug() << "Error: Fail to create index_recvtime."<< sql_query.lastError();
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-// if(!sql_query.exec("CREATE INDEX index_recordid ON groupdata (recordid)"))
|
|
|
|
-// {
|
|
|
|
-// qDebug() << "Error: Fail to create index_recordid."<< sql_query.lastError();
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
char strsen[1000];
|
|
char strsen[1000];
|
|
QDateTime now = QDateTime::currentDateTime();
|
|
QDateTime now = QDateTime::currentDateTime();
|
|
|
|
|
|
@@ -201,11 +178,6 @@ int fwdb::CheckAuth(std::string strusername, std::string strpassword ,std::strin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// int id = query.value(0).toInt();
|
|
|
|
-// qint64 recordid = query.value(1).toLongLong();
|
|
|
|
-// mql_xvectorrecordtime.push_back(recordid);
|
|
|
|
-// std::string strvehid = query.value(3).toString().toStdString();
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -269,14 +241,14 @@ int fwdb::QueryUser(std::string strusername,std::string & strvalidtime, std::str
|
|
{
|
|
{
|
|
strerrorcode = "No this user.";
|
|
strerrorcode = "No this user.";
|
|
mmutexdb.unlock();
|
|
mmutexdb.unlock();
|
|
- return 0;
|
|
|
|
|
|
+ return -2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
mmutexdb.unlock();
|
|
mmutexdb.unlock();
|
|
|
|
|
|
strerrorcode = "No this user.";
|
|
strerrorcode = "No this user.";
|
|
- return 0;
|
|
|
|
|
|
+ return -2;
|
|
}
|
|
}
|
|
|
|
|
|
int fwdb::AddUser(std::string strusername, std::string strpassword, std::string &strerrorcode)
|
|
int fwdb::AddUser(std::string strusername, std::string strpassword, std::string &strerrorcode)
|